mirror of
https://github.com/beetbox/beets.git
synced 2025-12-25 01:53:31 +01:00
pass arguments to FunctionDef as keyword args
This makes it a lot easier to read.
This commit is contained in:
parent
ed0adc2b63
commit
cda239a06d
1 changed files with 8 additions and 7 deletions
|
|
@ -114,14 +114,15 @@ def compile_func(arg_names, statements, name='_the_func', debug=False):
|
|||
bytecode of the compiled function.
|
||||
"""
|
||||
func_def = ast.FunctionDef(
|
||||
name.encode('utf8'),
|
||||
ast.arguments(
|
||||
[ast.Name(n, ast.Param()) for n in arg_names],
|
||||
None, None,
|
||||
[ex_literal(None) for _ in arg_names],
|
||||
name=name.encode('utf8'),
|
||||
args=ast.arguments(
|
||||
args=[ast.Name(n, ast.Param()) for n in arg_names],
|
||||
vararg=None,
|
||||
kwarg=None,
|
||||
defaults=[ex_literal(None) for _ in arg_names],
|
||||
),
|
||||
statements,
|
||||
[],
|
||||
body=statements,
|
||||
decorator_list=[],
|
||||
)
|
||||
mod = ast.Module([func_def])
|
||||
ast.fix_missing_locations(mod)
|
||||
|
|
|
|||
Loading…
Reference in a new issue