MCPcopy
hub / github.com/pandas-dev/pandas / decorator

Function decorator

pandas/core/accessor.py:283–294  ·  view source on GitHub ↗
(accessor: TypeT)

Source from the content-addressed store, hash-verified

281 """
282
283 def decorator(accessor: TypeT) -> TypeT:
284 if hasattr(cls, name):
285 warnings.warn(
286 f"registration of accessor {accessor!r} under name "
287 f"{name!r} for type {cls!r} is overriding a preexisting "
288 f"attribute with the same name.",
289 UserWarning,
290 stacklevel=find_stack_level(),
291 )
292 setattr(cls, name, Accessor(name, accessor))
293 cls._accessors.add(name)
294 return accessor
295
296 return decorator
297

Callers

nothing calls this directly

Calls 3

find_stack_levelFunction · 0.90
AccessorClass · 0.85
addMethod · 0.45

Tested by

no test coverage detected