Skip to content

Commit 86f07ae

Browse files
committed
refactor: provide correct signature for the autorun instance based on the function it decorates
1 parent 7033c8f commit 86f07ae

File tree

3 files changed

+27
-1
lines changed

3 files changed

+27
-1
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## Upcoming
4+
5+
- refactor: provide correct signature for the autorun instance based on the function it decorates
6+
37
## Version 0.18.3
48

59
- refactor(combine_reducers): add custom payload to `CombineReducerInitAction` and `CombineReducerRegisterAction` to allow custom initialization of sub-reducers

redux/autorun.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,14 @@ def __init__(
7979
self._selector = selector
8080
self._comparator = comparator
8181
self._should_be_called = False
82+
signature = inspect.signature(func)
83+
parameters = list(signature.parameters.values())
84+
if parameters and parameters[0].kind in [
85+
inspect.Parameter.POSITIONAL_ONLY,
86+
inspect.Parameter.POSITIONAL_OR_KEYWORD,
87+
]:
88+
parameters = parameters[1:]
89+
self._signature = signature.replace(parameters=parameters)
8290
if options.keep_ref:
8391
self._func = func
8492
elif inspect.ismethod(func):
@@ -326,3 +334,17 @@ def unsubscribe() -> None:
326334
self._subscriptions.discard(callback_ref)
327335

328336
return unsubscribe
337+
338+
@property
339+
def __signature__(
340+
self: Autorun[
341+
State,
342+
Action,
343+
Event,
344+
SelectorOutput,
345+
ComparatorOutput,
346+
AutorunOriginalReturnType,
347+
AutorunArgs,
348+
],
349+
) -> inspect.Signature:
350+
return self._signature

setup_scm_schemes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ def local_scheme(version) -> str: # noqa: ANN001
1212
original_local_version = get_local_node_and_date(version)
1313
if not original_local_version:
1414
return original_local_version
15-
numeric_version = original_local_version.replace('+', '').replace('.d', '')
15+
numeric_version = original_local_version.replace('+', '').replace('.d', '')[:12]
1616
return datetime.now(UTC).strftime('%y%m%d') + numeric_version

0 commit comments

Comments
 (0)