generated from jCloud/repository-template
Convert project and docs directory to pathlib.Path objects at the constructor of core.python._core.PythonDocumentationGenerator
This commit is contained in:
@@ -22,6 +22,15 @@ __all__ = [
|
|||||||
'PythonDocumentationGenerator'
|
'PythonDocumentationGenerator'
|
||||||
]
|
]
|
||||||
|
|
||||||
|
# class PythonModuleDocumentationGenerator:
|
||||||
|
# '''
|
||||||
|
# A documentation generator for a Python module.
|
||||||
|
|
||||||
|
|
||||||
|
# '''
|
||||||
|
|
||||||
|
# def __init__(self, module_path: )
|
||||||
|
|
||||||
class PythonDocumentationGenerator:
|
class PythonDocumentationGenerator:
|
||||||
'''
|
'''
|
||||||
The class for the documentation generator.
|
The class for the documentation generator.
|
||||||
@@ -36,8 +45,8 @@ class PythonDocumentationGenerator:
|
|||||||
assert_that_is_instance(project_directory, ExistingDirectory)
|
assert_that_is_instance(project_directory, ExistingDirectory)
|
||||||
assert_that_is_instance(docs_directory, ExistingDirectory)
|
assert_that_is_instance(docs_directory, ExistingDirectory)
|
||||||
|
|
||||||
self.project_directory = project_directory
|
self.project_directory = pathlib.Path(str(project_directory))
|
||||||
self.docs_directory = docs_directory
|
self.docs_directory = pathlib.Path(str(docs_directory))
|
||||||
|
|
||||||
def _namespace(self, directory: pathlib.Path) -> PythonPackageNamespace:
|
def _namespace(self, directory: pathlib.Path) -> PythonPackageNamespace:
|
||||||
namespace = PythonPackageNamespace(directory.name, [])
|
namespace = PythonPackageNamespace(directory.name, [])
|
||||||
@@ -58,9 +67,9 @@ class PythonDocumentationGenerator:
|
|||||||
:rtype: PythonPackageNamespace
|
:rtype: PythonPackageNamespace
|
||||||
'''
|
'''
|
||||||
|
|
||||||
src_dir = pathlib.Path(str(self.project_directory / 'src'))
|
src_dir = self.project_directory / 'src'
|
||||||
|
|
||||||
return [
|
return [
|
||||||
self._namespace(dir)
|
self._namespace(dir)
|
||||||
for dir in src_dir.iterdir()
|
for dir in src_dir.iterdir() if dir.is_dir()
|
||||||
]
|
]
|
||||||
Reference in New Issue
Block a user