8000 Fix ruff compressions and performance issues (#490) · readthedocs/sphinx-autoapi@4e2d9ae · GitHub
[go: up one dir, main page]

Skip to content

Commit 4e2d9ae

Browse files
authored
Fix ruff compressions and performance issues (#490)
* Fix ruff compressions and performance issues * Avoid multiline comprehension
1 parent f5c7295 commit 4e2d9ae

File tree

3 files changed

+3
-4
lines changed

3 files changed

+3
-4
lines changed

autoapi/_astroid_utils.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,7 @@ class NotConstException(Exception):
145145

146146
def _inner(node: astroid.nodes.NodeNG) -> Any:
147147
if isinstance(node, (astroid.nodes.List, astroid.nodes.Tuple)):
148-
new_value = []
149-
for element in node.elts:
150-
new_value.append(_inner(element))
148+
new_value = [_inner(element) for element in node.elts]
151149

152150
if isinstance(node, astroid.nodes.Tuple):
153151
return tuple(new_value)

autoapi/_objects.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ def _ask_ignore(self, skip: bool) -> bool:
248248
return ask_result if ask_result is not None else skip
249249

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

253253

254254
class PythonFunction(PythonObject):

docs/changes/490.misc.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix ruff compressions and performance issues.

0 commit comments

Comments
 (0)
0