Skip to content

Commit

Permalink
Simplify _get_argnames()
Browse files Browse the repository at this point in the history
There's no need to check for emptiness; if they're empty, the list
comprehension already is no-op anyway.
  • Loading branch information
lieryan committed Dec 14, 2022
1 parent f1393db commit 5f24a11
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions rope/refactor/extract.py
Expand Up @@ -948,15 +948,13 @@ def _handle_loop_context(self, node):

def _get_argnames(arguments):
result = []
if arguments.posonlyargs:
result.extend(node.arg for node in arguments.posonlyargs)
result.extend(node.arg for node in arguments.posonlyargs)
result.extend(node.arg for node in arguments.args if isinstance(node, ast.arg))
if arguments.vararg:
result.append(arguments.vararg.arg)
if arguments.kwarg:
result.append(arguments.kwarg.arg)
if arguments.kwonlyargs:
result.extend(node.arg for node in arguments.kwonlyargs)
result.extend(node.arg for node in arguments.kwonlyargs)
return result


Expand Down

0 comments on commit 5f24a11

Please sign in to comment.