Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def p_typedargslist_kwarg(self, p):
"""typedargslist : POW tfpdef"""
p[0] = ast.arguments(
posonlyargs=[],
args=[],
vararg=None,
kwonlyargs=[],
kw_defaults=[],
kwarg=p[2],
defaults=[],
)
def p_typedargslist_kwarg(self, p):
"""typedargslist : POW tfpdef"""
p[0] = ast.arguments(
args=[], vararg=None, kwonlyargs=[], kw_defaults=[], kwarg=p[2], defaults=[]
)
def p_typedargslist_times5_comma(self, p):
"""typedargslist : TIMES comma_tfpdef_list comma_pow_tfpdef_opt"""
# *, x, **kwargs
p0 = ast.arguments(
posonlyargs=[],
args=[],
vararg=None,
kwonlyargs=[],
kw_defaults=[],
kwarg=p[3],
defaults=[],
)
self._set_var_args(p0, None, p[2]) # *args
p[0] = p0
def p_typedargslist_t8(self, p):
"""typedargslist : tfpdef equals_test_opt comma_tfpdef_list_opt comma_opt TIMES tfpdef_opt comma_tfpdef_list_opt"""
p0 = ast.arguments(
args=[], vararg=None, kwonlyargs=[], kw_defaults=[], kwarg=None, defaults=[]
)
self._set_regular_args(p0, p[1], p[2], p[3], p[4])
self._set_var_args(p0, p[6], p[7])
p[0] = p0
def p_lambdef(self, p):
"""lambdef : lambda_tok varargslist_opt COLON test"""
p1, p2, p4 = p[1], p[2], p[4]
if p2 is None:
args = ast.arguments(
args=[],
vararg=None,
kwonlyargs=[],
kw_defaults=[],
kwarg=None,
defaults=[],
)
else:
args = p2
p0 = ast.Lambda(args=args, body=p4, lineno=p1.lineno, col_offset=p1.lexpos)
p[0] = p0
def p_varargslist_v8(self, p):
"""varargslist : vfpdef equals_test_opt comma_vfpdef_list_opt comma_opt TIMES vfpdef_opt comma_vfpdef_list_opt"""
# x, *args
p0 = ast.arguments(
args=[], vararg=None, kwonlyargs=[], kw_defaults=[], kwarg=None, defaults=[]
)
self._set_regular_args(p0, p[1], p[2], p[3], p[4])
self._set_var_args(p0, p[6], p[7])
p[0] = p0
def p_typedargslist_t10(self, p):
"""typedargslist : tfpdef equals_test_opt comma_tfpdef_list_opt comma_opt TIMES tfpdef_opt COMMA POW vfpdef"""
# x, *args, **kwargs
p0 = ast.arguments(
args=[], vararg=None, kwonlyargs=[], kw_defaults=[], kwarg=p[9], defaults=[]
)
self._set_regular_args(p0, p[1], p[2], p[3], p[4])
self._set_var_args(p0, p[6], None)
p[0] = p0
def p_typedargslist_times4_tfpdef(self, p):
"""typedargslist : TIMES tfpdef comma_pow_tfpdef_opt"""
# *args, **kwargs
p0 = ast.arguments(
args=[], vararg=None, kwonlyargs=[], kw_defaults=[], kwarg=p[3], defaults=[]
)
self._set_var_args(p0, p[2], None)
p[0] = p0
def p_typedargslist_t5(self, p):
"""typedargslist : tfpdef equals_test_opt comma_tfpdef_list_opt comma_opt"""
# x
p0 = ast.arguments(
args=[], vararg=None, kwonlyargs=[], kw_defaults=[], kwarg=None, defaults=[]
)
self._set_regular_args(p0, p[1], p[2], p[3], p[4])
p[0] = p0
def p_varargslist_v7(self, p):
"""varargslist : vfpdef equals_test_opt comma_vfpdef_list_opt comma_opt POW vfpdef"""
# x, **kwargs
p0 = ast.arguments(
posonlyargs=[],
args=[],
vararg=None,
kwonlyargs=[],
kw_defaults=[],
kwarg=p[6],
defaults=[],
)
self._set_regular_args(p0, p[1], p[2], p[3], p[4])
p[0] = p0