chore: lint source code using Ruff

This commit is contained in:
jakob.scheid committed 2026-09-21 20:10:09 +02:00
1 parent aa4a139878
commit de3eac3bb1
35 files changed
+161 -130

No files matched your search

+1
View File
@@ -13,6 +13,7 @@
# limitations under the License.
import pytest
from jcloud_docsgen.cli.cli import create_argument_parser
+4 -1
View File
@@ -13,8 +13,11 @@
# limitations under the License.
import pathlib
import pytest
from jcloud_docsgen.cli.cli import create_argument_parser, main as cli_main
from jcloud_docsgen.cli.cli import create_argument_parser
from jcloud_docsgen.cli.cli import main as cli_main
from jcloud_docsgen.cli.languages.python import parse_sections_list
from jcloud_docsgen.core.python import (
PythonDefinitionDocumentationIncludeSections,
@@ -12,21 +12,22 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import pytest
from src.jcloud_docsgen.core.python._core import (
PythonDefinitionDocumentationGenerator,
PythonDefinitionDocumentationIncludeSections,
)
from src.jcloud_docsgen.core.python.arguments import (
PythonArgumentKind,
PythonFunctionArgument,
)
from src.jcloud_docsgen.core.python.definitions import (
PythonFunctionDefinition,
PythonAsyncFunctionDefinition,
PythonClassDefinition,
)
from src.jcloud_docsgen.core.python.arguments import (
PythonFunctionArgument,
PythonArgumentKind,
PythonFunctionDefinition,
)
from src.jcloud_docsgen.core.python.docstrings import PythonDocstring
import pytest
def _signature_section(signature: str) -> str:
@@ -12,13 +12,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import pathlib
import pytest
from src.jcloud_docsgen.core.python import PythonDocumentationGenerator
from src.jcloud_docsgen.core.python.namespaces import (
PythonModuleNamespace,
PythonPackageNamespace,
)
import pytest
import pathlib
@pytest.mark.parametrize(
@@ -12,10 +12,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import pathlib
import pytest
from src.jcloud_docsgen.core.python import PythonModuleDocumentationGenerator
from src.jcloud_docsgen.exceptions import InvalidNamespaceError
import pathlib
import pytest
@pytest.mark.parametrize(
@@ -12,9 +12,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import pytest
from src.jcloud_docsgen.core.python._core import _argument_kind_human_readable
from src.jcloud_docsgen.core.python.arguments import PythonArgumentKind
import pytest
@pytest.mark.parametrize(
@@ -12,18 +12,20 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import ast
import pytest
from src.jcloud_docsgen.core.python._core import _collect_definitions
from src.jcloud_docsgen.core.python.arguments import (
PythonArgumentKind,
PythonFunctionArgument,
)
from src.jcloud_docsgen.core.python.definitions import (
PythonClassDefinition,
PythonFunctionDefinition,
)
from src.jcloud_docsgen.core.python.arguments import (
PythonFunctionArgument,
PythonArgumentKind,
)
from src.jcloud_docsgen.core.python.docstrings import PythonDocstring
import pytest
import ast
def module(source_code: str) -> ast.Module:
@@ -12,9 +12,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from src.jcloud_docsgen.core.python._core import _fit_row_length
import pytest
from src.jcloud_docsgen.core.python._core import _fit_row_length
@pytest.mark.parametrize(
'expected_length,row,expected',
@@ -12,16 +12,17 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import docstring_parser
import pytest
from src.jcloud_docsgen.core.python._core import (
_function_params_info,
_FunctionParamInfo,
)
from src.jcloud_docsgen.core.python.arguments import (
PythonFunctionArgument,
PythonArgumentKind,
PythonFunctionArgument,
)
import pytest
import docstring_parser
def docstring_args_list(
@@ -12,9 +12,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from src.jcloud_docsgen.core.python._core import _markdown_table
import pytest
from src.jcloud_docsgen.core.python._core import _markdown_table
@pytest.mark.parametrize(
(
@@ -12,12 +12,13 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import pytest
from src.jcloud_docsgen.core.python._core import _signature_argument_list
from src.jcloud_docsgen.core.python.arguments import (
PythonFunctionArgument,
PythonArgumentKind,
PythonFunctionArgument,
)
import pytest
@pytest.mark.parametrize(
@@ -12,13 +12,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import ast
import pytest
from src.jcloud_docsgen.core.python.arguments import (
PythonArgumentKind,
PythonASTArgumentsListParser,
PythonFunctionArgument,
PythonArgumentKind,
)
import pytest
import ast
def argument_list(argument_list: str) -> ast.arguments:
@@ -12,16 +12,17 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import pytest
from src.jcloud_docsgen.core.python.arguments import (
PythonFunctionArgument,
PythonArgumentKind,
PythonFunctionArgument,
)
from src.jcloud_docsgen.exceptions import (
InvalidPythonIdentifierError,
InvalidPythonAnnotationError,
InvalidPythonIdentifierError,
PythonArgumentStructureError,
)
import pytest
@pytest.mark.parametrize(
@@ -12,18 +12,19 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from src.jcloud_docsgen.core.python.definitions import (
PythonFunctionDefinition,
PythonClassDefinition,
)
import pytest
from src.jcloud_docsgen.core.python.arguments import (
PythonFunctionArgument,
PythonArgumentKind,
PythonFunctionArgument,
)
from src.jcloud_docsgen.core.python.definitions import (
PythonClassDefinition,
PythonFunctionDefinition,
)
from src.jcloud_docsgen.core.python.docstrings import PythonDocstring
from src.jcloud_docsgen.exceptions import InvalidPythonIdentifierError
from tests.utils.ast_node import ast_node
import pytest
@pytest.mark.parametrize(
@@ -12,10 +12,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import pytest
from src.jcloud_docsgen.core.python.definitions import PythonDefinition
from src.jcloud_docsgen.core.python.docstrings import PythonDocstring
from src.jcloud_docsgen.exceptions import InvalidPythonIdentifierError
import pytest
@pytest.mark.parametrize(
@@ -12,15 +12,16 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from src.jcloud_docsgen.core.python.definitions import PythonFunctionDefinition
import pytest
from src.jcloud_docsgen.core.python.arguments import (
PythonFunctionArgument,
PythonArgumentKind,
PythonFunctionArgument,
)
from src.jcloud_docsgen.core.python.definitions import PythonFunctionDefinition
from src.jcloud_docsgen.core.python.docstrings import PythonDocstring
from src.jcloud_docsgen.exceptions import InvalidPythonIdentifierError
from tests.utils.ast_node import ast_node
import pytest
@pytest.mark.parametrize(
@@ -12,9 +12,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from src.jcloud_docsgen.core.python.namespaces import PythonModuleNamespace
import pytest
from src.jcloud_docsgen.core.python.namespaces import PythonModuleNamespace
class StrSubclass(str): ...
@@ -12,9 +12,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from src.jcloud_docsgen.core.python.namespaces import PythonNamespace
import pytest
from src.jcloud_docsgen.core.python.namespaces import PythonNamespace
class StrSubclass(str): ...
@@ -12,14 +12,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from src.jcloud_docsgen.core.python.namespaces import (
PythonPackageNamespace,
PythonModuleNamespace,
)
import pytest
from src.jcloud_docsgen.core.python.namespaces import (
PythonModuleNamespace,
PythonPackageNamespace,
)
from src.jcloud_docsgen.exceptions import (
NamespaceNotFoundError,
InvalidNamespaceError,
NamespaceNotFoundError,
)
@@ -12,10 +12,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from src.jcloud_docsgen.utils import assert_that_is_instance
import pytest
import types
import pytest
from src.jcloud_docsgen.utils import assert_that_is_instance
class TestType: ...
@@ -12,10 +12,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from src.jcloud_docsgen.utils import get_relative_path_segments
import pytest
import pathlib
import pytest
from src.jcloud_docsgen.utils import get_relative_path_segments
@pytest.mark.parametrize(
'path,root,expected',
+2 -1
View File
@@ -12,9 +12,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from src.jcloud_docsgen.utils import human_readable_list
import pytest
from src.jcloud_docsgen.utils import human_readable_list
@pytest.mark.parametrize(
'ls,final_separator,quotation_mark,expected',
+2 -1
View File
@@ -12,9 +12,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from src.jcloud_docsgen.utils import non_empty_str
import pytest
from src.jcloud_docsgen.utils import non_empty_str
@pytest.mark.parametrize(
'value,expected',
+2 -3
View File
@@ -12,13 +12,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from typing import Union
import ast
__all__ = ['ast_node']
def ast_node(statement: str) -> Union[ast.stmt, None]:
def ast_node(statement: str) -> ast.stmt | None:
"""
Returns an AST node from the statement.
@@ -26,7 +25,7 @@ def ast_node(statement: str) -> Union[ast.stmt, None]:
:type statement: str
:return: The node.
:rtype: Union[ast.stmt, None]
:rtype: ast.stmt | None
"""
body = ast.parse(statement).body