MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / format_argspec_init

Function format_argspec_init

lib/sqlalchemy/util/langhelpers.py:679–709  ·  view source on GitHub ↗

format_argspec_plus with considerations for typical __init__ methods Wraps format_argspec_plus with error handling strategies for typical __init__ cases: .. sourcecode:: text object.__init__ -> (self) other unreflectable (usually C) -> (self, *args, **kwargs)

(method, grouped=True)

Source from the content-addressed store, hash-verified

677
678
679def format_argspec_init(method, grouped=True):
680 """format_argspec_plus with considerations for typical __init__ methods
681
682 Wraps format_argspec_plus with error handling strategies for typical
683 __init__ cases:
684
685 .. sourcecode:: text
686
687 object.__init__ -> (self)
688 other unreflectable (usually C) -> (self, *args, **kwargs)
689
690 """
691 if method is object.__init__:
692 grouped_args = "(self)"
693 args = "(self)" if grouped else "self"
694 proxied = "()" if grouped else ""
695 else:
696 try:
697 return format_argspec_plus(method, grouped=grouped)
698 except TypeError:
699 grouped_args = "(self, *args, **kwargs)"
700 args = grouped_args if grouped else "self, *args, **kwargs"
701 proxied = "(*args, **kwargs)" if grouped else "*args, **kwargs"
702 return dict(
703 self_arg="self",
704 grouped_args=grouped_args,
705 apply_pos=args,
706 apply_kw=args,
707 apply_pos_proxied=proxied,
708 apply_kw_proxied=proxied,
709 )
710
711
712def create_proxy_methods(

Callers

nothing calls this directly

Calls 1

format_argspec_plusFunction · 0.85

Tested by

no test coverage detected