diff --git a/autoapi/_astroid_utils.py b/autoapi/_astroid_utils.py index e9a85f64..5510dbe5 100644 --- a/autoapi/_astroid_utils.py +++ b/autoapi/_astroid_utils.py @@ -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) diff --git a/autoapi/_objects.py b/autoapi/_objects.py index 0340baaf..9f40b942 100644 --- a/autoapi/_objects.py +++ b/autoapi/_objects.py @@ -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): diff --git a/docs/changes/490.misc.rst b/docs/changes/490.misc.rst new file mode 100644 index 00000000..a9bfeeca --- /dev/null +++ b/docs/changes/490.misc.rst @@ -0,0 +1 @@ +Fix ruff compressions and performance issues. \ No newline at end of file