From 23e450e9df4704992452db66c8f0ddb468fe135c Mon Sep 17 00:00:00 2001 From: Jakob Scheid Date: Fri, 18 Sep 2026 17:02:09 +0200 Subject: [PATCH] style: remove trailing whitespace Removed all trailing whitespace. --- src/jcloud_docsgen/core/python/_core.py | 14 +++++++------- src/jcloud_docsgen/core/python/arguments.py | 6 +++--- src/jcloud_docsgen/core/python/definitions.py | 4 ++-- src/jcloud_docsgen/core/python/docstrings.py | 6 +++--- src/jcloud_docsgen/core/python/namespaces.py | 8 ++++---- src/jcloud_docsgen/exceptions.py | 2 +- src/jcloud_docsgen/utils.py | 12 ++++++------ .../core/python/_core/test__collect_definitions.py | 4 ++-- 8 files changed, 28 insertions(+), 28 deletions(-) diff --git a/src/jcloud_docsgen/core/python/_core.py b/src/jcloud_docsgen/core/python/_core.py index b4f64f2..7be8d77 100644 --- a/src/jcloud_docsgen/core/python/_core.py +++ b/src/jcloud_docsgen/core/python/_core.py @@ -149,7 +149,7 @@ def _signature_argument_list( for arg in positional_only_args: args.append(arg.signature_repr()) - + if positional_only_args: args.append('/') @@ -164,7 +164,7 @@ def _signature_argument_list( for arg in keyword_only_args: args.append(arg.signature_repr()) - + if kwargs is not None: args.append(kwargs.signature_repr()) @@ -202,7 +202,7 @@ def _markdown_table( ) -> str: ''' Generates a table. - + If ``allow_markdown_table`` is ``False``, an alternative representation is used. @@ -226,7 +226,7 @@ def _markdown_table( if not header or not body: return '' - + header_len = len(header) if allow_markdown_table: @@ -593,7 +593,7 @@ class PythonDefinitionDocumentationGenerator: md += self.definition.doc.docstring elif not self.skip_empty_sections: md += 'There is no docstring to show.' - + if _is_docstring(self.definition.doc) or not self.skip_empty_sections: if self.allow_html: md += '' @@ -859,10 +859,10 @@ class PythonDefinitionDocumentationGenerator: if isinstance(self.definition, PythonClassDefinition): if self.include_sections.bases: md += self._generate_bases_section() + '\n\n' - + if self.include_sections.class_body: md += self._generate_body_section() + '\n\n' - + if self.include_sections.decorators: md += self._generate_decorators_section() + '\n\n' diff --git a/src/jcloud_docsgen/core/python/arguments.py b/src/jcloud_docsgen/core/python/arguments.py index 869660a..4caa419 100644 --- a/src/jcloud_docsgen/core/python/arguments.py +++ b/src/jcloud_docsgen/core/python/arguments.py @@ -70,7 +70,7 @@ class PythonFunctionArgument: 'invalid identifier', identifier = name ) - + # check whether the annotation is a valid annotation # Currently, it is only checked whether the parameter is not # empty. @@ -84,7 +84,7 @@ class PythonFunctionArgument: self.kind = kind self.default = default self.annotation = annotation - + if self.kind in ( PythonArgumentKind.VARARG, PythonArgumentKind.KWARGS @@ -103,7 +103,7 @@ class PythonFunctionArgument: and self.default == value.default and self.annotation == value.annotation ) - + def __repr__(self) -> str: return type(self).__name__ + repr(( self.name, diff --git a/src/jcloud_docsgen/core/python/definitions.py b/src/jcloud_docsgen/core/python/definitions.py index 04fc9df..905cee7 100644 --- a/src/jcloud_docsgen/core/python/definitions.py +++ b/src/jcloud_docsgen/core/python/definitions.py @@ -101,7 +101,7 @@ class PythonDefinition: _python_docstring(ast.get_docstring(node)), [ast.unparse(d) for d in node.decorator_list] ) - + def __eq__(self, value: object) -> bool: if not isinstance(value, PythonDefinition): return False @@ -224,7 +224,7 @@ class PythonClassDefinition(PythonDefinition): self.decorators, self.body ) - + @classmethod def from_node(cls, node: ast.stmt) -> PythonClassDefinition: ''' diff --git a/src/jcloud_docsgen/core/python/docstrings.py b/src/jcloud_docsgen/core/python/docstrings.py index 7d24b86..6405eab 100644 --- a/src/jcloud_docsgen/core/python/docstrings.py +++ b/src/jcloud_docsgen/core/python/docstrings.py @@ -22,7 +22,7 @@ __all__ = [ class PythonDocstring: ''' Represents a Python docstring. - + :param docstring: The docstring as a string. :type docstring: str ''' @@ -32,12 +32,12 @@ class PythonDocstring: def __repr__(self) -> str: return type(self).__name__ + '(' + repr(self.docstring) + ')' - + def __eq__(self, value) -> bool: if not isinstance(value, type(self)): return False return self.docstring == value.docstring - + def parse(self) -> docstring_parser.Docstring: ''' Parses the docstring. diff --git a/src/jcloud_docsgen/core/python/namespaces.py b/src/jcloud_docsgen/core/python/namespaces.py index d6387a5..3cef5d1 100644 --- a/src/jcloud_docsgen/core/python/namespaces.py +++ b/src/jcloud_docsgen/core/python/namespaces.py @@ -118,7 +118,7 @@ class PythonPackageNamespace(PythonNamespace): ''' Returns the names of all sub-namespaces of the specified package namespace and keeps the package structure. - + :param package: The package. :type package: PythonPackageNamespace @@ -134,12 +134,12 @@ class PythonPackageNamespace(PythonNamespace): ) for sn in package._sub_namespaces } - + def sub_namespace_names(self) -> PythonPackageNamespaceDictType: ''' Returns the names of all sub-namespaces and keeps the package structure. - + :return: The names if all sub-namespaces. :rtype: PythonPackageNamespaceDictType ''' @@ -179,7 +179,7 @@ class PythonPackageNamespace(PythonNamespace): 'no such namespace', namespace_identifier = name ) - + def add(self, namespace: PythonNamespace) -> None: ''' Adds a namespace. diff --git a/src/jcloud_docsgen/exceptions.py b/src/jcloud_docsgen/exceptions.py index 2feb8a6..ee2b51a 100644 --- a/src/jcloud_docsgen/exceptions.py +++ b/src/jcloud_docsgen/exceptions.py @@ -33,7 +33,7 @@ class NamespaceError(ValueError): if self.args[0] else "" }' - + class InvalidNamespaceError(NamespaceError): ... class NamespaceNotFoundError(NamespaceError): ... class NamespaceExistsError(NamespaceError): ... diff --git a/src/jcloud_docsgen/utils.py b/src/jcloud_docsgen/utils.py index fae9140..724b74d 100644 --- a/src/jcloud_docsgen/utils.py +++ b/src/jcloud_docsgen/utils.py @@ -70,7 +70,7 @@ class ExistingFile(pathlib.Path): def _quote(string: str, quotation_mark: str) -> str: ''' Quotes a string. - + :param string: The string to quote :type string: str :param quotation_mark: The quotation mark @@ -98,7 +98,7 @@ def human_readable_list( :type final_separator: str :param quotation_mark: The characters that are inserted before and after an element. Default is ''. - + :return: The human-readable list. :rtype: str ''' @@ -106,11 +106,11 @@ def human_readable_list( # empty list if not ls: return '' - + # list with one element if len(ls) == 1: return _quote(str(ls[0]), quotation_mark) - + return ', '.join( [ _quote( @@ -165,7 +165,7 @@ def assert_that_is_instance( obj ).__name__}\'' ) - + def non_empty_str(value: Union[str, None]) -> Union[str, None]: ''' Returns the value or ``None``. @@ -184,7 +184,7 @@ def non_empty_str(value: Union[str, None]) -> Union[str, None]: if value is None: return None - + if value.strip() == '': return None diff --git a/tests/unit/core/python/_core/test__collect_definitions.py b/tests/unit/core/python/_core/test__collect_definitions.py index b61deb8..ad20086 100644 --- a/tests/unit/core/python/_core/test__collect_definitions.py +++ b/tests/unit/core/python/_core/test__collect_definitions.py @@ -75,14 +75,14 @@ class Something: """A class.""" def __init__(self, value: typing.Any = 42) -> None: self._value = value - + @property def value(self) -> typing.Any: """ The value. """ return self.get_value() - + def get_value(self) -> typing.Any: """ Returns the value.