Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions traitlets/traitlets.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,11 @@ class TraitError(Exception):


def isidentifier(s: t.Any) -> bool:
warn(
"traitlets.traitlets.isidentifier(s) is deprecated since traitlets 5.14.4 Use `s.isidentifier()`.",
DeprecationWarning,
stacklevel=2,
)
return t.cast(bool, s.isidentifier())


Expand Down Expand Up @@ -3025,7 +3030,7 @@ class ObjectName(TraitType[str, str]):
def validate(self, obj: t.Any, value: t.Any) -> str:
value = self.coerce_str(obj, value)

if isinstance(value, str) and isidentifier(value):
if isinstance(value, str) and value.isidentifier():
return value
self.error(obj, value)

Expand All @@ -3041,7 +3046,7 @@ class DottedObjectName(ObjectName):
def validate(self, obj: t.Any, value: t.Any) -> str:
value = self.coerce_str(obj, value)

if isinstance(value, str) and all(isidentifier(a) for a in value.split(".")):
if isinstance(value, str) and all(a.isidentifier() for a in value.split(".")):
return value
self.error(obj, value)

Expand Down