MCPcopy Create free account
hub / github.com/easy-graph/Easy-Graph / get_name

Method get_name

easygraph/utils/decorators.py:850–874  ·  view source on GitHub ↗
(arg, first=True)

Source from the content-addressed store, hash-verified

848 applied = set()
849
850 def get_name(arg, first=True):
851 nonlocal mutable_args
852 if isinstance(arg, tuple):
853 name = ", ".join(get_name(x, False) for x in arg)
854 return name if first else f"({name})"
855 if arg in applied:
856 raise EasyGraphError(f"argument {arg} is specified multiple times")
857 applied.add(arg)
858 if arg in sig.names:
859 return sig.names[arg]
860 elif isinstance(arg, str):
861 if sig.kwargs is None:
862 raise EasyGraphError(
863 f"name {arg} is not a named parameter and this function doesn't"
864 " have kwargs"
865 )
866 return f"{sig.kwargs}[{arg!r}]"
867 else:
868 if sig.args is None:
869 raise EasyGraphError(
870 f"index {arg} not a parameter index and this function doesn't"
871 " have args"
872 )
873 mutable_args = True
874 return f"{sig.args}[{arg - sig.n_positional}]"
875
876 if self._finally:
877 # here's where we handle try_finally decorators. Such a decorator

Callers

nothing calls this directly

Calls 2

EasyGraphErrorClass · 0.90
addMethod · 0.80

Tested by

no test coverage detected