generated from jCloud/repository-template
style: format source code using Ruff
This commit is contained in:
41 files changed
+6061
-5670
No files matched your search
@@ -29,11 +29,12 @@ VALID_SECTIONS = list(
|
||||
PythonDefinitionDocumentationIncludeSections()._args.keys()
|
||||
)
|
||||
|
||||
|
||||
def parse_sections_list(
|
||||
include_sections: Optional[list[str]] = None,
|
||||
exclude_sections: list[str] = [],
|
||||
) -> PythonDefinitionDocumentationIncludeSections:
|
||||
'''
|
||||
"""
|
||||
Returns a Python definition documentation sections list from the
|
||||
sections list to be included and the sections list to be excluded.
|
||||
These lists both consist of the sections as strings which contain
|
||||
@@ -46,7 +47,7 @@ def parse_sections_list(
|
||||
|
||||
:return: The Python definition documentation sections object.
|
||||
:rtype: PythonDefinitionDocumentationIncludeSections
|
||||
'''
|
||||
"""
|
||||
|
||||
if include_sections is None:
|
||||
include_sections = VALID_SECTIONS[:]
|
||||
@@ -56,17 +57,18 @@ def parse_sections_list(
|
||||
del include_sections[include_sections.index(section)]
|
||||
|
||||
return PythonDefinitionDocumentationIncludeSections(
|
||||
signature = 'signature' in include_sections,
|
||||
returns = 'returns' in include_sections,
|
||||
params = 'params' in include_sections,
|
||||
exceptions = 'exceptions' in include_sections,
|
||||
examples = 'examples' in include_sections,
|
||||
docstring = 'docstring' in include_sections,
|
||||
bases = 'bases' in include_sections,
|
||||
decorators = 'decorators' in include_sections,
|
||||
class_body = 'class_body' in include_sections,
|
||||
signature='signature' in include_sections,
|
||||
returns='returns' in include_sections,
|
||||
params='params' in include_sections,
|
||||
exceptions='exceptions' in include_sections,
|
||||
examples='examples' in include_sections,
|
||||
docstring='docstring' in include_sections,
|
||||
bases='bases' in include_sections,
|
||||
decorators='decorators' in include_sections,
|
||||
class_body='class_body' in include_sections,
|
||||
)
|
||||
|
||||
|
||||
def _generate(
|
||||
project_directory: pathlib.Path,
|
||||
output_directory: pathlib.Path,
|
||||
@@ -77,7 +79,7 @@ def _generate(
|
||||
allow_html: bool = False,
|
||||
allow_tables: bool = False,
|
||||
) -> None:
|
||||
'''
|
||||
"""
|
||||
Generates the documentation for a Python project.
|
||||
|
||||
:param project_directory: The project directory.
|
||||
@@ -92,17 +94,18 @@ def _generate(
|
||||
:type allow_html: bool
|
||||
:param allow_tables: Indicates whether Markdown tables are allowed.
|
||||
Warning: Markdown tables are not CommonMark.
|
||||
'''
|
||||
"""
|
||||
|
||||
docs_generator = PythonDocumentationGenerator(
|
||||
project_directory,
|
||||
output_directory,
|
||||
include_sections = include_sections,
|
||||
allow_html = allow_html,
|
||||
allow_tables = allow_tables,
|
||||
include_sections=include_sections,
|
||||
allow_html=allow_html,
|
||||
allow_tables=allow_tables,
|
||||
)
|
||||
docs_generator.generate_documentation()
|
||||
|
||||
|
||||
def generate(
|
||||
project_directory: pathlib.Path,
|
||||
output_directory: pathlib.Path,
|
||||
@@ -112,7 +115,7 @@ def generate(
|
||||
allow_html: bool = False,
|
||||
allow_tables: bool = False,
|
||||
) -> None:
|
||||
'''
|
||||
"""
|
||||
Generates the documentation for a Python project.
|
||||
|
||||
:param project_directory: The project directory.
|
||||
@@ -130,14 +133,14 @@ def generate(
|
||||
:type allow_html: bool
|
||||
:param allow_tables: Indicates whether Markdown tables are allowed.
|
||||
Warning: Markdown tables are not CommonMark.
|
||||
'''
|
||||
"""
|
||||
|
||||
sections = parse_sections_list(include_sections, exclude_sections)
|
||||
|
||||
_generate(
|
||||
project_directory,
|
||||
output_directory,
|
||||
include_sections = sections,
|
||||
allow_html = allow_html,
|
||||
allow_tables = allow_tables,
|
||||
include_sections=sections,
|
||||
allow_html=allow_html,
|
||||
allow_tables=allow_tables,
|
||||
)
|
||||
Reference in new issue
Block a user