Skip to content

Commit f9e6f28

Browse files
committed
Should now ignore deprecated args
Should now properly ignore deprecator decorators
1 parent 487f045 commit f9e6f28

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

ngcsimlib/_src/context/contextAwareObjectMeta.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@
77

88
def extract_name(cls, args, kwargs):
99
init = cls.__init__
10+
11+
if getattr(init, "_is_deprecated", False):
12+
unwrapped = getattr(init, "_original", None)
13+
if unwrapped is None:
14+
error("Failed to find a non deprecated init method")
15+
init = unwrapped
16+
1017
sig = inspect.signature(init)
1118
bound = sig.bind_partial(None, *args, **kwargs)
1219
bound.apply_defaults()

ngcsimlib/_src/deprecators.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ def deprecated(fn):
55
def _wrapped(*args, **kwargs):
66
warn(fn.__qualname__, "is deprecated")
77
return fn(*args, **kwargs)
8+
9+
_wrapped._is_deprecated = True
10+
_wrapped._original = fn
811
return _wrapped
912

1013

@@ -25,5 +28,8 @@ def _wrapped(*args, **kwargs):
2528
del kwargs[kwarg]
2629

2730
return fn(*args, **kwargs)
31+
32+
_wrapped._is_deprecated = True
33+
_wrapped._original = fn
2834
return _wrapped
2935
return _deprecate_args

0 commit comments

Comments
 (0)