autodocgenerator 0.8.9.8__py3-none-any.whl → 0.9.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- autodocgenerator/auto_runner/config_reader.py +18 -6
- autodocgenerator/auto_runner/run_file.py +16 -8
- autodocgenerator/config/config.py +4 -4
- autodocgenerator/manage.py +3 -3
- autodocgenerator/ui/progress_base.py +1 -1
- autodocgenerator-0.9.0.0.dist-info/METADATA +699 -0
- {autodocgenerator-0.8.9.8.dist-info → autodocgenerator-0.9.0.0.dist-info}/RECORD +8 -8
- autodocgenerator-0.8.9.8.dist-info/METADATA +0 -577
- {autodocgenerator-0.8.9.8.dist-info → autodocgenerator-0.9.0.0.dist-info}/WHEEL +0 -0
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
import yaml
|
|
2
2
|
from autodocgenerator.factory.modules.general_modules import CustomModule, CustomModuleWithOutContext
|
|
3
|
-
from ..config.config import Config,
|
|
3
|
+
from ..config.config import Config, ProjectBuildConfig
|
|
4
4
|
|
|
5
5
|
|
|
6
|
+
class StructureSettings:
|
|
7
|
+
include_intro_links = True
|
|
8
|
+
include_order = True
|
|
9
|
+
max_doc_part_size = 5_000
|
|
10
|
+
|
|
11
|
+
def load_settings(self, data: dict[str, any]):
|
|
12
|
+
for key, el in data.items():
|
|
13
|
+
setattr(self, key, el)
|
|
6
14
|
|
|
7
|
-
def read_config(file_data: str) -> tuple[Config, list[CustomModule]]:
|
|
8
|
-
data = yaml.safe_load(file_data)
|
|
9
15
|
|
|
16
|
+
def read_config(file_data: str) -> tuple[Config, list[CustomModule], StructureSettings]:
|
|
17
|
+
data = yaml.safe_load(file_data)
|
|
10
18
|
config : Config = Config()
|
|
11
19
|
|
|
12
20
|
ignore_files = data.get("ignore_files", [])
|
|
@@ -15,8 +23,8 @@ def read_config(file_data: str) -> tuple[Config, list[CustomModule]]:
|
|
|
15
23
|
project_name = data.get("project_name")
|
|
16
24
|
project_additional_info = data.get("project_additional_info", {})
|
|
17
25
|
|
|
18
|
-
project_settings = data.get("
|
|
19
|
-
pcs =
|
|
26
|
+
project_settings = data.get("build_settings", {})
|
|
27
|
+
pcs = ProjectBuildConfig()
|
|
20
28
|
pcs.load_settings(project_settings)
|
|
21
29
|
|
|
22
30
|
config.set_language(language).set_project_name(project_name).set_pcs(pcs)
|
|
@@ -31,4 +39,8 @@ def read_config(file_data: str) -> tuple[Config, list[CustomModule]]:
|
|
|
31
39
|
|
|
32
40
|
custom_modules = [CustomModuleWithOutContext(custom_discription[1:]) if custom_discription[0] == "%" else CustomModule(custom_discription) for custom_discription in custom_discriptions]
|
|
33
41
|
|
|
34
|
-
|
|
42
|
+
structure_settings = data.get("structure_settings", {})
|
|
43
|
+
structure_settings_object = StructureSettings()
|
|
44
|
+
structure_settings_object.load_settings(structure_settings)
|
|
45
|
+
|
|
46
|
+
return config, custom_modules, structure_settings_object
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
from autodocgenerator.manage import Manager
|
|
2
2
|
from autodocgenerator.factory.base_factory import DocFactory
|
|
3
|
+
from autodocgenerator.factory.modules.general_modules import CustomModule, CustomModuleWithOutContext
|
|
3
4
|
from autodocgenerator.factory.modules.intro import IntroLinks
|
|
4
5
|
from autodocgenerator.ui.progress_base import ConsoleGtiHubProgress
|
|
5
|
-
from autodocgenerator.auto_runner.config_reader import Config, read_config
|
|
6
|
+
from autodocgenerator.auto_runner.config_reader import Config, read_config, StructureSettings
|
|
6
7
|
from autodocgenerator.engine.models.gpt_model import GPTModel, AsyncGPTModel
|
|
7
8
|
from autodocgenerator.engine.config.config import API_KEY
|
|
8
9
|
|
|
9
10
|
|
|
10
|
-
def gen_doc(project_path: str,
|
|
11
|
+
def gen_doc(project_path: str,
|
|
12
|
+
config: Config,
|
|
13
|
+
custom_modules: list[CustomModule | CustomModuleWithOutContext],
|
|
14
|
+
structure_settings: StructureSettings) -> str:
|
|
11
15
|
|
|
12
16
|
sync_model = GPTModel(API_KEY, use_random=False)
|
|
13
17
|
async_model = AsyncGPTModel(API_KEY)
|
|
@@ -21,11 +25,14 @@ def gen_doc(project_path: str, config: Config, custom_modules):
|
|
|
21
25
|
)
|
|
22
26
|
|
|
23
27
|
|
|
24
|
-
|
|
25
|
-
|
|
28
|
+
manager.generate_code_file()
|
|
29
|
+
manager.generete_doc_parts(max_symbols=structure_settings.max_doc_part_size)
|
|
26
30
|
manager.factory_generate_doc(DocFactory(*custom_modules))
|
|
27
|
-
|
|
28
|
-
|
|
31
|
+
if structure_settings.include_order:
|
|
32
|
+
manager.order_doc()
|
|
33
|
+
|
|
34
|
+
if structure_settings.include_intro_links:
|
|
35
|
+
manager.factory_generate_doc(DocFactory(IntroLinks()))
|
|
29
36
|
manager.clear_cache()
|
|
30
37
|
|
|
31
38
|
return manager.read_file_by_file_key("output_doc")
|
|
@@ -33,12 +40,13 @@ def gen_doc(project_path: str, config: Config, custom_modules):
|
|
|
33
40
|
if __name__ == "__main__":
|
|
34
41
|
with open("autodocconfig.yml", "r", encoding="utf-8") as file:
|
|
35
42
|
config_data = file.read()
|
|
36
|
-
config, custom_modules = read_config(config_data)
|
|
43
|
+
config, custom_modules, structure_settings = read_config(config_data)
|
|
37
44
|
|
|
38
45
|
output_doc = gen_doc(
|
|
39
46
|
".",
|
|
40
47
|
config,
|
|
41
|
-
custom_modules
|
|
48
|
+
custom_modules,
|
|
49
|
+
structure_settings
|
|
42
50
|
)
|
|
43
51
|
|
|
44
52
|
|
|
@@ -4,7 +4,7 @@ from ..factory.base_factory import DocFactory
|
|
|
4
4
|
from ..factory.modules.intro import IntroLinks
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
class
|
|
7
|
+
class ProjectBuildConfig:
|
|
8
8
|
save_logs = False
|
|
9
9
|
log_level = -1
|
|
10
10
|
def load_settings(self, data: dict[str, any]):
|
|
@@ -22,14 +22,14 @@ class Config:
|
|
|
22
22
|
self.language: str = "en"
|
|
23
23
|
self.project_name: str = ""
|
|
24
24
|
self.project_additional_info: dict = {}
|
|
25
|
-
self.
|
|
25
|
+
self.pbc: ProjectBuildConfig = ProjectBuildConfig()
|
|
26
26
|
|
|
27
27
|
def set_language(self, language: str):
|
|
28
28
|
self.language = language
|
|
29
29
|
return self
|
|
30
30
|
|
|
31
|
-
def set_pcs(self, pcs:
|
|
32
|
-
self.
|
|
31
|
+
def set_pcs(self, pcs: ProjectBuildConfig):
|
|
32
|
+
self.pbc = pcs
|
|
33
33
|
return self
|
|
34
34
|
|
|
35
35
|
def set_project_name(self, name: str):
|
autodocgenerator/manage.py
CHANGED
|
@@ -13,7 +13,7 @@ from .factory.modules.general_modules import CustomModule
|
|
|
13
13
|
from .ui.progress_base import BaseProgress, LibProgress
|
|
14
14
|
from .ui.logging import BaseLogger, BaseLoggerTemplate, InfoLog, ErrorLog, WarningLog, FileLoggerTemplate
|
|
15
15
|
from .preprocessor.settings import ProjectSettings
|
|
16
|
-
from .auto_runner.config_reader import
|
|
16
|
+
from .auto_runner.config_reader import ProjectBuildConfig
|
|
17
17
|
from .postprocessor.sorting import get_order, split_text_by_anchors
|
|
18
18
|
from .config.config import Config
|
|
19
19
|
|
|
@@ -44,7 +44,7 @@ class Manager:
|
|
|
44
44
|
self.async_model = async_model
|
|
45
45
|
|
|
46
46
|
self.logger = BaseLogger()
|
|
47
|
-
self.logger.set_logger(FileLoggerTemplate(self.get_file_path("logs"), log_level=self.config.
|
|
47
|
+
self.logger.set_logger(FileLoggerTemplate(self.get_file_path("logs"), log_level=self.config.pbc.log_level))
|
|
48
48
|
|
|
49
49
|
cache_path = os.path.join(self.project_directory, self.CACHE_FOLDER_NAME)
|
|
50
50
|
|
|
@@ -120,6 +120,6 @@ class Manager:
|
|
|
120
120
|
file.write(result)
|
|
121
121
|
|
|
122
122
|
def clear_cache(self):
|
|
123
|
-
if not self.config.
|
|
123
|
+
if not self.config.pbc.save_logs:
|
|
124
124
|
os.remove(self.get_file_path("logs"))
|
|
125
125
|
|
|
@@ -57,7 +57,7 @@ class ConsoleGtiHubProgress(BaseProgress):
|
|
|
57
57
|
def __init__(self):
|
|
58
58
|
super().__init__()
|
|
59
59
|
self.curr_task = None
|
|
60
|
-
self.gen_task = ConsoleTask("General Progress",
|
|
60
|
+
self.gen_task = ConsoleTask("General Progress", 4)
|
|
61
61
|
|
|
62
62
|
def create_new_subtask(self, name: str, total_len: int):
|
|
63
63
|
self.curr_task = ConsoleTask(name, total_len)
|