MCPcopy Create free account
hub / github.com/pytest-dev/pytest / getargs

Method getargs

src/_pytest/_code/code.py:114–126  ·  view source on GitHub ↗

Return a tuple with the argument names for the code object. If 'var' is set True also return the names of the variable and keyword arguments when present.

(self, var: bool = False)

Source from the content-addressed store, hash-verified

112 return Source(self.raw)
113
114 def getargs(self, var: bool = False) -> Tuple[str, ...]:
115 """Return a tuple with the argument names for the code object.
116
117 If 'var' is set True also return the names of the variable and
118 keyword arguments when present.
119 """
120 # Handy shortcut for getting args.
121 raw = self.raw
122 argcount = raw.co_argcount
123 if var:
124 argcount += raw.co_flags & CO_VARARGS
125 argcount += raw.co_flags & CO_VARKEYWORDS
126 return raw.co_varnames[:argcount]
127
128
129class Frame:

Callers 3

getargsMethod · 0.45
repr_argsMethod · 0.45
test_code_getargsFunction · 0.45

Calls

no outgoing calls

Tested by 1

test_code_getargsFunction · 0.36