Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 60c6146

Browse filesBrowse files
authored
Restore and deprecate _unicode_safe_getattr (#133)
1 parent 89f1a86 commit 60c6146
Copy full SHA for 60c6146

File tree

Expand file treeCollapse file tree

1 file changed

+12
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+12
-0
lines changed

‎cssselect/xpath.py

Copy file name to clipboardExpand all lines: cssselect/xpath.py
+12Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
import re
1616
import typing
17+
import warnings
1718
from typing import Optional
1819

1920
from cssselect.parser import (
@@ -37,6 +38,17 @@
3738
)
3839

3940

41+
@typing.no_type_check
42+
def _unicode_safe_getattr(obj, name, default=None):
43+
warnings.warn(
44+
"_unicode_safe_getattr is deprecated and will be removed in the"
45+
" next release, use getattr() instead",
46+
DeprecationWarning,
47+
stacklevel=2,
48+
)
49+
return getattr(obj, name, default)
50+
51+
4052
class ExpressionError(SelectorError, RuntimeError):
4153
"""Unknown or unsupported selector (eg. pseudo-class)."""
4254

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.