Skip to content

Commit

Permalink
Restore and deprecate _unicode_safe_getattr (#133)
Browse files Browse the repository at this point in the history
  • Loading branch information
wRAR committed Oct 27, 2022
1 parent 89f1a86 commit 60c6146
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions cssselect/xpath.py
Expand Up @@ -14,6 +14,7 @@

import re
import typing
import warnings
from typing import Optional

from cssselect.parser import (
Expand All @@ -37,6 +38,17 @@
)


@typing.no_type_check
def _unicode_safe_getattr(obj, name, default=None):
warnings.warn(
"_unicode_safe_getattr is deprecated and will be removed in the"
" next release, use getattr() instead",
DeprecationWarning,
stacklevel=2,
)
return getattr(obj, name, default)


class ExpressionError(SelectorError, RuntimeError):
"""Unknown or unsupported selector (eg. pseudo-class)."""

Expand Down

0 comments on commit 60c6146

Please sign in to comment.