Skip to content

Commit

Permalink
remove depracated Sig method calls
Browse files Browse the repository at this point in the history
  • Loading branch information
valentin-feron committed Nov 16, 2023
1 parent 7b6b07c commit 34b2644
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 11 deletions.
2 changes: 1 addition & 1 deletion meshed/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ def call_on_scope(self, scope: MutableMapping, write_output_into_scope=True):
an actual interface method. Additional control/constraints on read and writes
can be implemented by providing a custom scope for that."""
relevant_kwargs = dict(self.extractor(scope))
args, kwargs = self.sig.args_and_kwargs_from_kwargs(relevant_kwargs)
args, kwargs = self.sig.mk_args_and_kwargs(relevant_kwargs)
output = call_somewhat_forgivingly(
self.func, args, kwargs, enforce_sig=self.sig
)
Expand Down
4 changes: 2 additions & 2 deletions meshed/dag.py
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ def _get_kwargs(self, *args, **kwargs):
"""
Get a dict of {argname: argval} pairs from positional and keyword arguments.
"""
return self.__signature__.kwargs_from_args_and_kwargs(
return self.__signature__.map_arguments(
args, kwargs, apply_defaults=True
)

Expand Down Expand Up @@ -831,7 +831,7 @@ def partial(
9
"""

keyword_dflts = self.__signature__.kwargs_from_args_and_kwargs(
keyword_dflts = self.__signature__.map_arguments(
args=positional_dflts,
kwargs=keyword_dflts,
apply_defaults=_consider_defaulted_arguments_as_bound,
Expand Down
4 changes: 2 additions & 2 deletions meshed/itools.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def _handle_exclude_nodes(func):

@wraps(func)
def _func(*args, **kwargs):
kwargs = sig.kwargs_from_args_and_kwargs(args, kwargs, apply_defaults=True)
kwargs = sig.map_arguments(args, kwargs, apply_defaults=True)
try:
_exclude_nodes = kwargs['_exclude_nodes']
except KeyError:
Expand All @@ -63,7 +63,7 @@ def _func(*args, **kwargs):
_exclude_nodes = set(_exclude_nodes)

kwargs['_exclude_nodes'] = _exclude_nodes
args, kwargs = sig.args_and_kwargs_from_kwargs(kwargs)
args, kwargs = sig.mk_args_and_kwargs(kwargs)
return func(*args, **kwargs)

return _func
Expand Down
2 changes: 1 addition & 1 deletion meshed/slabs.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ def _call_from_dict(kwargs: MutableMapping, func: Callable, sig: Sig):
when there are inputs.
"""
args, kwargs = sig.args_and_kwargs_from_kwargs(
args, kwargs = sig.mk_args_and_kwargs(
kwargs,
allow_excess=True,
ignore_kind=True,
Expand Down
4 changes: 1 addition & 3 deletions meshed/tests/test_dag_variadics.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
from meshed import DAG
from i2 import Sig

# from i2.signatures import kwargs_from_args_and_kwargs


@fixture
def foo():
Expand All @@ -19,7 +17,7 @@ def foo(w, /, x: float, y='YY', *, z: str = 'ZZ', **rest):
pass

sig = Sig(foo)
# res = sig.kwargs_from_args_and_kwargs(
# res = sig.map_arguments(
# (11, 22, "you"), dict(z="zoo", other="stuff"), post_process=True
# )
# assert res == "{'w': 11, 'x': 22, 'y': 'you', 'z': 'zoo', 'other': 'stuff'}"
Expand Down
4 changes: 2 additions & 2 deletions meshed/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ def __init__(
self.__signature__ = self._new_sig()

def __call__(self, *args, **kwargs):
_kwargs = self.sig.kwargs_from_args_and_kwargs(
_kwargs = self.sig.map_arguments(
args, kwargs, apply_defaults=True, allow_partial=True
)
first_arg = next(iter(_kwargs.values()))
Expand Down Expand Up @@ -735,7 +735,7 @@ def named_partial(func, *args, __name__=None, **keywords):


def _place_holder_func(*args, _sig=None, **kwargs):
_kwargs = _sig.kwargs_from_args_and_kwargs(args, kwargs)
_kwargs = _sig.map_arguments(args, kwargs)
_kwargs_str = ', '.join(f'{k}={v}' for k, v in _kwargs.items())
return f'{_sig.name}({_kwargs_str})'

Expand Down

0 comments on commit 34b2644

Please sign in to comment.