Skip to content

Commit

Permalink
Fix ruff compressions and performance issues (#490)
Browse files Browse the repository at this point in the history
* Fix ruff compressions and performance issues

* Avoid multiline comprehension
  • Loading branch information
cclauss authored Nov 25, 2024
1 parent f5c7295 commit 4e2d9ae
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
4 changes: 1 addition & 3 deletions autoapi/_astroid_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,7 @@ class NotConstException(Exception):

def _inner(node: astroid.nodes.NodeNG) -> Any:
if isinstance(node, (astroid.nodes.List, astroid.nodes.Tuple)):
new_value = []
for element in node.elts:
new_value.append(_inner(element))
new_value = [_inner(element) for element in node.elts]

if isinstance(node, astroid.nodes.Tuple):
return tuple(new_value)
Expand Down
2 changes: 1 addition & 1 deletion autoapi/_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ def _ask_ignore(self, skip: bool) -> bool:
return ask_result if ask_result is not None else skip

def _children_of_type(self, type_: str) -> list[PythonObject]:
return list(child for child in self.children if child.type == type_)
return [child for child in self.children if child.type == type_]


class PythonFunction(PythonObject):
Expand Down
1 change: 1 addition & 0 deletions docs/changes/490.misc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix ruff compressions and performance issues.

0 comments on commit 4e2d9ae

Please sign in to comment.