MCPcopy Create free account
hub / github.com/ipython/traitlets / ObjectName

Class ObjectName

traitlets/traitlets.py:3033–3052  ·  view source on GitHub ↗

A string holding a valid object name in this version of Python. This does not check that the name exists in any scope.

Source from the content-addressed store, hash-verified

3031
3032
3033class ObjectName(TraitType[str, str]):
3034 """A string holding a valid object name in this version of Python.
3035
3036 This does not check that the name exists in any scope."""
3037
3038 info_text = "a valid object identifier in Python"
3039
3040 coerce_str = staticmethod(lambda _, s: s)
3041
3042 def validate(self, obj: t.Any, value: t.Any) -> str:
3043 value = self.coerce_str(obj, value)
3044
3045 if isinstance(value, str) and value.isidentifier():
3046 return value
3047 self.error(obj, value)
3048
3049 def from_string(self, s: str) -> str | None:
3050 if self.allow_none and s == "None":
3051 return None
3052 return s
3053
3054
3055class DottedObjectName(ObjectName):

Callers 1

ObjectNameTraitClass · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…