EasyDocPy 1.2.0__tar.gz → 1.4.1__tar.gz
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.
- {easydocpy-1.2.0 → easydocpy-1.4.1}/EasyDocPy.egg-info/PKG-INFO +56 -24
- easydocpy-1.4.1/EasyDocPy.egg-info/SOURCES.txt +26 -0
- {easydocpy-1.2.0 → easydocpy-1.4.1}/PKG-INFO +56 -24
- {easydocpy-1.2.0 → easydocpy-1.4.1}/README.md +55 -23
- easydocpy-1.4.1/easydoc/__init__.py +6 -0
- easydocpy-1.4.1/easydoc/__main__.py +59 -0
- easydocpy-1.4.1/easydoc/classes/__init__.py +20 -0
- easydocpy-1.4.1/easydoc/classes/exceptions.py +11 -0
- easydocpy-1.4.1/easydoc/classes/parsed_objects.py +136 -0
- easydocpy-1.4.1/easydoc/classes/tree_objects.py +197 -0
- easydocpy-1.4.1/easydoc/config/custom_comment_lines.json +9 -0
- easydocpy-1.4.1/easydoc/core/FileParser.py +312 -0
- easydocpy-1.4.1/easydoc/core/InteractiveManager.py +114 -0
- easydocpy-1.4.1/easydoc/core/TreatmentManager.py +127 -0
- easydocpy-1.4.1/easydoc/core/__init__.py +25 -0
- easydocpy-1.4.1/easydoc/core/utils/__init__.py +23 -0
- easydocpy-1.4.1/easydoc/core/utils/const.py +33 -0
- easydocpy-1.4.1/easydoc/core/utils/function_utils.py +13 -0
- easydocpy-1.4.1/easydoc/generators/HTMLGenerator.py +14 -0
- easydocpy-1.4.1/easydoc/generators/MarkdownGenerator.py +317 -0
- easydocpy-1.4.1/easydoc/generators/__init__.py +11 -0
- {easydocpy-1.2.0 → easydocpy-1.4.1}/pyproject.toml +1 -1
- easydocpy-1.2.0/EasyDocPy.egg-info/SOURCES.txt +0 -15
- easydocpy-1.2.0/easydoc/__init__.py +0 -11
- easydocpy-1.2.0/easydoc/__main__.py +0 -29
- easydocpy-1.2.0/easydoc/analyser.py +0 -359
- easydocpy-1.2.0/easydoc/config/custom_comment_lines.json +0 -10
- easydocpy-1.2.0/easydoc/generator.py +0 -155
- easydocpy-1.2.0/easydoc/objects.py +0 -44
- {easydocpy-1.2.0 → easydocpy-1.4.1}/EasyDocPy.egg-info/dependency_links.txt +0 -0
- {easydocpy-1.2.0 → easydocpy-1.4.1}/EasyDocPy.egg-info/entry_points.txt +0 -0
- {easydocpy-1.2.0 → easydocpy-1.4.1}/EasyDocPy.egg-info/top_level.txt +0 -0
- {easydocpy-1.2.0 → easydocpy-1.4.1}/LICENSE +0 -0
- {easydocpy-1.2.0 → easydocpy-1.4.1}/easydoc/templates/template.md +0 -0
- {easydocpy-1.2.0 → easydocpy-1.4.1}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: EasyDocPy
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.4.1
|
|
4
4
|
Summary: python documentation generator
|
|
5
5
|
Author: epsilonkn
|
|
6
6
|
License-Expression: MIT
|
|
@@ -19,6 +19,16 @@ The idea of that package is to create a technical documentation of a python sour
|
|
|
19
19
|
|
|
20
20
|
For more information, read the wiki : https://github.com/epsilonkn/EasyDoc/wiki
|
|
21
21
|
|
|
22
|
+
## Getting Started :
|
|
23
|
+
|
|
24
|
+
**Using pip :**
|
|
25
|
+
|
|
26
|
+
pip install EasyDocPy
|
|
27
|
+
|
|
28
|
+
**On github :**
|
|
29
|
+
\
|
|
30
|
+
Read the wiki of the module
|
|
31
|
+
|
|
22
32
|
## To use it :
|
|
23
33
|
|
|
24
34
|
### To comment your code :
|
|
@@ -147,11 +157,11 @@ Explains a constant in the code. for now, all the constants are written at the b
|
|
|
147
157
|
DEFAULT = "VOID"
|
|
148
158
|
|
|
149
159
|
|
|
150
|
-
|
|
160
|
+
## Generate the documentation :
|
|
151
161
|
|
|
152
|
-
###
|
|
162
|
+
### For a file :
|
|
153
163
|
|
|
154
|
-
|
|
164
|
+
To generate a documentation in command line :
|
|
155
165
|
|
|
156
166
|
easydoc file "/your/path/to/file.py"
|
|
157
167
|
|
|
@@ -159,35 +169,57 @@ Note 1 : your terminal must be in the directory where you want to see the docume
|
|
|
159
169
|
|
|
160
170
|
Note 2 : you can pass the path without double quotes, however it is better to keep them if your path got spaces in it.
|
|
161
171
|
|
|
162
|
-
### In a python program :
|
|
163
172
|
|
|
164
|
-
|
|
173
|
+
### For a directory :
|
|
165
174
|
|
|
166
|
-
|
|
167
|
-
Unfortunately, in the actual state of the module, the control over the module is still very little, this will be improved in the next updates.
|
|
175
|
+
To generate a documentation in command line :
|
|
168
176
|
|
|
169
|
-
|
|
177
|
+
easydoc dir "/your/path/to/dir"
|
|
170
178
|
|
|
171
|
-
|
|
179
|
+
Note 1 : your terminal must be in the directory where you want to see the documentation generated.
|
|
180
|
+
|
|
181
|
+
Note 2 : you can pass the path without double quotes, however it is better to keep them if your path got spaces in it.
|
|
172
182
|
|
|
173
|
-
parser = Parser(path = "/path/to/file.py", automatic = False)
|
|
174
|
-
parse_list = parser.get_parse()
|
|
175
|
-
file_header = parser.get_intro()
|
|
176
183
|
|
|
177
|
-
|
|
184
|
+
### Advanced generation :
|
|
178
185
|
|
|
186
|
+
You can also choose to generate the documentation interactively :
|
|
179
187
|
|
|
188
|
+
easydoc interactive
|
|
180
189
|
|
|
181
|
-
|
|
190
|
+
This way the package will ask you to enter the parameters, here they are :
|
|
182
191
|
|
|
183
|
-
|
|
184
|
-
|-|-|
|
|
185
|
-
|V 1.2.0 | adding custom comment line to add info to the documentation|
|
|
186
|
-
|V 1.3.0| better control over the process when done in a program |
|
|
187
|
-
|V 1.4.0| adding doc generation for an entire directory |
|
|
188
|
-
|V 1.5.0| adding user configuration |
|
|
189
|
-
|......||
|
|
192
|
+
__mandatory :__
|
|
190
193
|
|
|
191
|
-
|
|
194
|
+
- _type_ : type of document to treat : file | dir
|
|
195
|
+
- _path_ : the path to what you want to treat (file or dir)
|
|
196
|
+
|
|
197
|
+
__optional :__
|
|
198
|
+
|
|
199
|
+
- _run_ : start the generation
|
|
200
|
+
- _help_ : shows all the options and their usage
|
|
201
|
+
- _exit_ : close the generation
|
|
202
|
+
- _format_ | f : The format of the documentation | HTML implemented in (V1.5)
|
|
203
|
+
- _language | lang_ : The language in which to doc is written | NOT IMPLEMENTED YET (V1.6 planned)
|
|
204
|
+
- _recursive | rec_ : (dir only) : Enable/disable recursive file search in subdirs
|
|
205
|
+
- _recursive_depth | rec_d_ : (dir only) Depth of recursive search, 0 equals to disable the recursive search
|
|
206
|
+
- _onefile | of_ : (dir only) If enable, will generate the whole directory doc in a single file instead a doc file per source file
|
|
207
|
+
|
|
208
|
+
### Others arguements :
|
|
209
|
+
|
|
210
|
+
__-v | --version :__ Shows the version of the package and stop the program.
|
|
211
|
+
|
|
212
|
+
__--debug :__ Start the debug mode for generation, meaning package will print at each step what it's doing.
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
## Next updates :
|
|
192
216
|
|
|
193
|
-
|
|
217
|
+
|Version | Improvement| Status|
|
|
218
|
+
|-|-|-|
|
|
219
|
+
|V 1.2.0 | Adding custom comment line to add info to the documentation| Done |
|
|
220
|
+
|V 1.3.0| Better control over the process when done in a program | suppressed from the planning |
|
|
221
|
+
|V 1.4.0| V 4 : treatment of dirs \ V 1.4.1 : implementing main file usage in the process \ V 1.4.2 - implementing file meta data in onefile dir doc| In test...|
|
|
222
|
+
|V 1.5.0| Generating the doc as a html file | |
|
|
223
|
+
|V 1.6.0| Translation in differents languages | |
|
|
224
|
+
|V 1.?.0| Adding user configuration | |
|
|
225
|
+
|......|||
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
EasyDocPy.egg-info/PKG-INFO
|
|
5
|
+
EasyDocPy.egg-info/SOURCES.txt
|
|
6
|
+
EasyDocPy.egg-info/dependency_links.txt
|
|
7
|
+
EasyDocPy.egg-info/entry_points.txt
|
|
8
|
+
EasyDocPy.egg-info/top_level.txt
|
|
9
|
+
easydoc/__init__.py
|
|
10
|
+
easydoc/__main__.py
|
|
11
|
+
easydoc/classes/__init__.py
|
|
12
|
+
easydoc/classes/exceptions.py
|
|
13
|
+
easydoc/classes/parsed_objects.py
|
|
14
|
+
easydoc/classes/tree_objects.py
|
|
15
|
+
easydoc/config/custom_comment_lines.json
|
|
16
|
+
easydoc/core/FileParser.py
|
|
17
|
+
easydoc/core/InteractiveManager.py
|
|
18
|
+
easydoc/core/TreatmentManager.py
|
|
19
|
+
easydoc/core/__init__.py
|
|
20
|
+
easydoc/core/utils/__init__.py
|
|
21
|
+
easydoc/core/utils/const.py
|
|
22
|
+
easydoc/core/utils/function_utils.py
|
|
23
|
+
easydoc/generators/HTMLGenerator.py
|
|
24
|
+
easydoc/generators/MarkdownGenerator.py
|
|
25
|
+
easydoc/generators/__init__.py
|
|
26
|
+
easydoc/templates/template.md
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: EasyDocPy
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.4.1
|
|
4
4
|
Summary: python documentation generator
|
|
5
5
|
Author: epsilonkn
|
|
6
6
|
License-Expression: MIT
|
|
@@ -19,6 +19,16 @@ The idea of that package is to create a technical documentation of a python sour
|
|
|
19
19
|
|
|
20
20
|
For more information, read the wiki : https://github.com/epsilonkn/EasyDoc/wiki
|
|
21
21
|
|
|
22
|
+
## Getting Started :
|
|
23
|
+
|
|
24
|
+
**Using pip :**
|
|
25
|
+
|
|
26
|
+
pip install EasyDocPy
|
|
27
|
+
|
|
28
|
+
**On github :**
|
|
29
|
+
\
|
|
30
|
+
Read the wiki of the module
|
|
31
|
+
|
|
22
32
|
## To use it :
|
|
23
33
|
|
|
24
34
|
### To comment your code :
|
|
@@ -147,11 +157,11 @@ Explains a constant in the code. for now, all the constants are written at the b
|
|
|
147
157
|
DEFAULT = "VOID"
|
|
148
158
|
|
|
149
159
|
|
|
150
|
-
|
|
160
|
+
## Generate the documentation :
|
|
151
161
|
|
|
152
|
-
###
|
|
162
|
+
### For a file :
|
|
153
163
|
|
|
154
|
-
|
|
164
|
+
To generate a documentation in command line :
|
|
155
165
|
|
|
156
166
|
easydoc file "/your/path/to/file.py"
|
|
157
167
|
|
|
@@ -159,35 +169,57 @@ Note 1 : your terminal must be in the directory where you want to see the docume
|
|
|
159
169
|
|
|
160
170
|
Note 2 : you can pass the path without double quotes, however it is better to keep them if your path got spaces in it.
|
|
161
171
|
|
|
162
|
-
### In a python program :
|
|
163
172
|
|
|
164
|
-
|
|
173
|
+
### For a directory :
|
|
165
174
|
|
|
166
|
-
|
|
167
|
-
Unfortunately, in the actual state of the module, the control over the module is still very little, this will be improved in the next updates.
|
|
175
|
+
To generate a documentation in command line :
|
|
168
176
|
|
|
169
|
-
|
|
177
|
+
easydoc dir "/your/path/to/dir"
|
|
170
178
|
|
|
171
|
-
|
|
179
|
+
Note 1 : your terminal must be in the directory where you want to see the documentation generated.
|
|
180
|
+
|
|
181
|
+
Note 2 : you can pass the path without double quotes, however it is better to keep them if your path got spaces in it.
|
|
172
182
|
|
|
173
|
-
parser = Parser(path = "/path/to/file.py", automatic = False)
|
|
174
|
-
parse_list = parser.get_parse()
|
|
175
|
-
file_header = parser.get_intro()
|
|
176
183
|
|
|
177
|
-
|
|
184
|
+
### Advanced generation :
|
|
178
185
|
|
|
186
|
+
You can also choose to generate the documentation interactively :
|
|
179
187
|
|
|
188
|
+
easydoc interactive
|
|
180
189
|
|
|
181
|
-
|
|
190
|
+
This way the package will ask you to enter the parameters, here they are :
|
|
182
191
|
|
|
183
|
-
|
|
184
|
-
|-|-|
|
|
185
|
-
|V 1.2.0 | adding custom comment line to add info to the documentation|
|
|
186
|
-
|V 1.3.0| better control over the process when done in a program |
|
|
187
|
-
|V 1.4.0| adding doc generation for an entire directory |
|
|
188
|
-
|V 1.5.0| adding user configuration |
|
|
189
|
-
|......||
|
|
192
|
+
__mandatory :__
|
|
190
193
|
|
|
191
|
-
|
|
194
|
+
- _type_ : type of document to treat : file | dir
|
|
195
|
+
- _path_ : the path to what you want to treat (file or dir)
|
|
196
|
+
|
|
197
|
+
__optional :__
|
|
198
|
+
|
|
199
|
+
- _run_ : start the generation
|
|
200
|
+
- _help_ : shows all the options and their usage
|
|
201
|
+
- _exit_ : close the generation
|
|
202
|
+
- _format_ | f : The format of the documentation | HTML implemented in (V1.5)
|
|
203
|
+
- _language | lang_ : The language in which to doc is written | NOT IMPLEMENTED YET (V1.6 planned)
|
|
204
|
+
- _recursive | rec_ : (dir only) : Enable/disable recursive file search in subdirs
|
|
205
|
+
- _recursive_depth | rec_d_ : (dir only) Depth of recursive search, 0 equals to disable the recursive search
|
|
206
|
+
- _onefile | of_ : (dir only) If enable, will generate the whole directory doc in a single file instead a doc file per source file
|
|
207
|
+
|
|
208
|
+
### Others arguements :
|
|
209
|
+
|
|
210
|
+
__-v | --version :__ Shows the version of the package and stop the program.
|
|
211
|
+
|
|
212
|
+
__--debug :__ Start the debug mode for generation, meaning package will print at each step what it's doing.
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
## Next updates :
|
|
192
216
|
|
|
193
|
-
|
|
217
|
+
|Version | Improvement| Status|
|
|
218
|
+
|-|-|-|
|
|
219
|
+
|V 1.2.0 | Adding custom comment line to add info to the documentation| Done |
|
|
220
|
+
|V 1.3.0| Better control over the process when done in a program | suppressed from the planning |
|
|
221
|
+
|V 1.4.0| V 4 : treatment of dirs \ V 1.4.1 : implementing main file usage in the process \ V 1.4.2 - implementing file meta data in onefile dir doc| In test...|
|
|
222
|
+
|V 1.5.0| Generating the doc as a html file | |
|
|
223
|
+
|V 1.6.0| Translation in differents languages | |
|
|
224
|
+
|V 1.?.0| Adding user configuration | |
|
|
225
|
+
|......|||
|
|
@@ -6,6 +6,16 @@ The idea of that package is to create a technical documentation of a python sour
|
|
|
6
6
|
|
|
7
7
|
For more information, read the wiki : https://github.com/epsilonkn/EasyDoc/wiki
|
|
8
8
|
|
|
9
|
+
## Getting Started :
|
|
10
|
+
|
|
11
|
+
**Using pip :**
|
|
12
|
+
|
|
13
|
+
pip install EasyDocPy
|
|
14
|
+
|
|
15
|
+
**On github :**
|
|
16
|
+
\
|
|
17
|
+
Read the wiki of the module
|
|
18
|
+
|
|
9
19
|
## To use it :
|
|
10
20
|
|
|
11
21
|
### To comment your code :
|
|
@@ -134,11 +144,11 @@ Explains a constant in the code. for now, all the constants are written at the b
|
|
|
134
144
|
DEFAULT = "VOID"
|
|
135
145
|
|
|
136
146
|
|
|
137
|
-
|
|
147
|
+
## Generate the documentation :
|
|
138
148
|
|
|
139
|
-
###
|
|
149
|
+
### For a file :
|
|
140
150
|
|
|
141
|
-
|
|
151
|
+
To generate a documentation in command line :
|
|
142
152
|
|
|
143
153
|
easydoc file "/your/path/to/file.py"
|
|
144
154
|
|
|
@@ -146,35 +156,57 @@ Note 1 : your terminal must be in the directory where you want to see the docume
|
|
|
146
156
|
|
|
147
157
|
Note 2 : you can pass the path without double quotes, however it is better to keep them if your path got spaces in it.
|
|
148
158
|
|
|
149
|
-
### In a python program :
|
|
150
159
|
|
|
151
|
-
|
|
160
|
+
### For a directory :
|
|
152
161
|
|
|
153
|
-
|
|
154
|
-
Unfortunately, in the actual state of the module, the control over the module is still very little, this will be improved in the next updates.
|
|
162
|
+
To generate a documentation in command line :
|
|
155
163
|
|
|
156
|
-
|
|
164
|
+
easydoc dir "/your/path/to/dir"
|
|
157
165
|
|
|
158
|
-
|
|
166
|
+
Note 1 : your terminal must be in the directory where you want to see the documentation generated.
|
|
167
|
+
|
|
168
|
+
Note 2 : you can pass the path without double quotes, however it is better to keep them if your path got spaces in it.
|
|
159
169
|
|
|
160
|
-
parser = Parser(path = "/path/to/file.py", automatic = False)
|
|
161
|
-
parse_list = parser.get_parse()
|
|
162
|
-
file_header = parser.get_intro()
|
|
163
170
|
|
|
164
|
-
|
|
171
|
+
### Advanced generation :
|
|
165
172
|
|
|
173
|
+
You can also choose to generate the documentation interactively :
|
|
166
174
|
|
|
175
|
+
easydoc interactive
|
|
167
176
|
|
|
168
|
-
|
|
177
|
+
This way the package will ask you to enter the parameters, here they are :
|
|
169
178
|
|
|
170
|
-
|
|
171
|
-
|-|-|
|
|
172
|
-
|V 1.2.0 | adding custom comment line to add info to the documentation|
|
|
173
|
-
|V 1.3.0| better control over the process when done in a program |
|
|
174
|
-
|V 1.4.0| adding doc generation for an entire directory |
|
|
175
|
-
|V 1.5.0| adding user configuration |
|
|
176
|
-
|......||
|
|
179
|
+
__mandatory :__
|
|
177
180
|
|
|
178
|
-
|
|
181
|
+
- _type_ : type of document to treat : file | dir
|
|
182
|
+
- _path_ : the path to what you want to treat (file or dir)
|
|
183
|
+
|
|
184
|
+
__optional :__
|
|
185
|
+
|
|
186
|
+
- _run_ : start the generation
|
|
187
|
+
- _help_ : shows all the options and their usage
|
|
188
|
+
- _exit_ : close the generation
|
|
189
|
+
- _format_ | f : The format of the documentation | HTML implemented in (V1.5)
|
|
190
|
+
- _language | lang_ : The language in which to doc is written | NOT IMPLEMENTED YET (V1.6 planned)
|
|
191
|
+
- _recursive | rec_ : (dir only) : Enable/disable recursive file search in subdirs
|
|
192
|
+
- _recursive_depth | rec_d_ : (dir only) Depth of recursive search, 0 equals to disable the recursive search
|
|
193
|
+
- _onefile | of_ : (dir only) If enable, will generate the whole directory doc in a single file instead a doc file per source file
|
|
194
|
+
|
|
195
|
+
### Others arguements :
|
|
196
|
+
|
|
197
|
+
__-v | --version :__ Shows the version of the package and stop the program.
|
|
198
|
+
|
|
199
|
+
__--debug :__ Start the debug mode for generation, meaning package will print at each step what it's doing.
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
## Next updates :
|
|
179
203
|
|
|
180
|
-
|
|
204
|
+
|Version | Improvement| Status|
|
|
205
|
+
|-|-|-|
|
|
206
|
+
|V 1.2.0 | Adding custom comment line to add info to the documentation| Done |
|
|
207
|
+
|V 1.3.0| Better control over the process when done in a program | suppressed from the planning |
|
|
208
|
+
|V 1.4.0| V 4 : treatment of dirs \ V 1.4.1 : implementing main file usage in the process \ V 1.4.2 - implementing file meta data in onefile dir doc| In test...|
|
|
209
|
+
|V 1.5.0| Generating the doc as a html file | |
|
|
210
|
+
|V 1.6.0| Translation in differents languages | |
|
|
211
|
+
|V 1.?.0| Adding user configuration | |
|
|
212
|
+
|......|||
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
#/actual_version : 1.2.8
|
|
2
|
+
#/TODO Add language option support and improved CLI validation
|
|
3
|
+
#/file_intro
|
|
4
|
+
"""
|
|
5
|
+
This script is the CLI entry point for EasyDoc. It parses CLI options,
|
|
6
|
+
validates the requested path, and starts file or directory documentation generation.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from argparse import ArgumentParser
|
|
10
|
+
from importlib.metadata import version
|
|
11
|
+
|
|
12
|
+
from easydoc.core import (
|
|
13
|
+
TreatmentManager,
|
|
14
|
+
InteractiveManager,
|
|
15
|
+
is_valid_path,
|
|
16
|
+
TYPES,
|
|
17
|
+
FORMATS,
|
|
18
|
+
LANGUAGES
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
parser = ArgumentParser()
|
|
22
|
+
parser.add_argument("-v", "--version",
|
|
23
|
+
action="store_true",
|
|
24
|
+
help="show the version of EasyDocPy and exit")
|
|
25
|
+
parser.add_argument("type",
|
|
26
|
+
nargs="?",
|
|
27
|
+
choices= TYPES + ["interactive"],
|
|
28
|
+
help="the type of document to treat, either a single file or a whole directory, interactive mode allows to set the arguments interactively")
|
|
29
|
+
parser.add_argument("path",
|
|
30
|
+
nargs="?",
|
|
31
|
+
help="the path to the file or directory to document")
|
|
32
|
+
parser.add_argument("-f", "--format",
|
|
33
|
+
choices=FORMATS,
|
|
34
|
+
help="the format of the documentation to generate")
|
|
35
|
+
parser.add_argument("-l", "--language",
|
|
36
|
+
choices=LANGUAGES,
|
|
37
|
+
help="the language of the documentation to generate")
|
|
38
|
+
parser.add_argument("--debug",
|
|
39
|
+
default=False,
|
|
40
|
+
action="store_true",
|
|
41
|
+
help="enable debug mode")
|
|
42
|
+
args = parser.parse_args()
|
|
43
|
+
|
|
44
|
+
if args.version:
|
|
45
|
+
print("EasyDocPy", version("EasyDocPy"))
|
|
46
|
+
exit(0)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
match args.type :
|
|
51
|
+
case "file" | "dir":
|
|
52
|
+
if not is_valid_path(args.path):
|
|
53
|
+
raise ValueError(f"Invalid path: The path {args.path} doesn't point to a python file")
|
|
54
|
+
TreatmentManager(path = args.path, type = args.type, format = args.format, debug = args.debug)
|
|
55
|
+
case "interactive":
|
|
56
|
+
modif_args = InteractiveManager.run()
|
|
57
|
+
TreatmentManager(**modif_args, debug=args.debug)
|
|
58
|
+
case _ :
|
|
59
|
+
raise ValueError(f"Invalid value for type : {args.type}. The type of document to treat must be [{', '.join(TYPES)}] or 'interactive'")
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#/actual_version : 1.0.0
|
|
2
|
+
#/file_intro
|
|
3
|
+
"""
|
|
4
|
+
This package initializer exposes the parsed object and tree classes
|
|
5
|
+
needed by the EasyDoc core modules.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from .parsed_objects import *
|
|
9
|
+
from .exceptions import *
|
|
10
|
+
from .tree_objects import Node, Leaf
|
|
11
|
+
|
|
12
|
+
__all__ = [
|
|
13
|
+
"Parsed_file",
|
|
14
|
+
"Parsed_class",
|
|
15
|
+
"Parsed_function",
|
|
16
|
+
"Custom_comment",
|
|
17
|
+
"NotDeveloppedError",
|
|
18
|
+
"Node",
|
|
19
|
+
"Leaf"
|
|
20
|
+
]
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
#/actual_version : 1.2.0
|
|
2
|
+
#/TODO Update parsed object for decorators and nested classes
|
|
3
|
+
#/TODO Take in count the return type of the functions
|
|
4
|
+
#/file_intro
|
|
5
|
+
"""
|
|
6
|
+
This module declares the parsed object containers that represent file structure,
|
|
7
|
+
function and class metadata, and extracted custom comments.
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
import re
|
|
11
|
+
from typing import Union
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class Parsed_object:
|
|
15
|
+
|
|
16
|
+
def __init__(self, name : str, level : int = 0):
|
|
17
|
+
"""Initialize a parsed object.
|
|
18
|
+
|
|
19
|
+
Args:
|
|
20
|
+
name (str): The file name or file path.
|
|
21
|
+
content_list (list[Parsed_class, Parsed_function]): Parsed classes and functions.
|
|
22
|
+
file_data (list[Custom_comment]): Custom comments extracted from the file.
|
|
23
|
+
"""
|
|
24
|
+
self.name = name
|
|
25
|
+
self.content : list["Parsed_object"] = []
|
|
26
|
+
self.comments : list["Custom_comment"] = []
|
|
27
|
+
self.level = level
|
|
28
|
+
self.docstring : str = ""
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def add_content(self, content : Union["Parsed_object"]):
|
|
32
|
+
self.content.append(content)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def add_comment(self, data : "Custom_comment"):
|
|
36
|
+
self.comments.append(data)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
class Parsed_file(Parsed_object):
|
|
41
|
+
"""Represents a parsed Python file and its content."""
|
|
42
|
+
|
|
43
|
+
def __init__(self, name : str):
|
|
44
|
+
"""Initialize a parsed file container.
|
|
45
|
+
|
|
46
|
+
Args:
|
|
47
|
+
name (str): The file name or file path.
|
|
48
|
+
content_list (list[Parsed_class, Parsed_function]): Parsed classes and functions.
|
|
49
|
+
file_data (list[Custom_comment]): Custom comments extracted from the file.
|
|
50
|
+
"""
|
|
51
|
+
super().__init__(name, 0)
|
|
52
|
+
self.name = name
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
class Parsed_function(Parsed_object):
|
|
56
|
+
"""Represents a parsed function """
|
|
57
|
+
|
|
58
|
+
def __init__(self, declaration : str, type_ : str, level : int = 1):
|
|
59
|
+
"""Initialize a parsed function.
|
|
60
|
+
|
|
61
|
+
Args:
|
|
62
|
+
declaration (str): The declaration line or block containing the def.
|
|
63
|
+
docstring (str): The docstring content associated with the declaration.
|
|
64
|
+
"""
|
|
65
|
+
super().__init__("", level)
|
|
66
|
+
self.declaration : str = ""
|
|
67
|
+
self.set_declaration(declaration)
|
|
68
|
+
self.funct_type = type_
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
def set_declaration(self, declaration):
|
|
72
|
+
"""Extract the function name from the declaration.
|
|
73
|
+
|
|
74
|
+
Args:
|
|
75
|
+
declaration (str): The function declaration string.
|
|
76
|
+
"""
|
|
77
|
+
self.declaration = declaration
|
|
78
|
+
self.name = re.search(r"^\s*def\s+([a-zA-Z_]\w*)", declaration).group(1)
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
def __str__(self):
|
|
82
|
+
"""Return the parsed element name."""
|
|
83
|
+
return self.name
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
class Custom_comment:
|
|
88
|
+
"""Represents a custom comment block extracted from source files."""
|
|
89
|
+
|
|
90
|
+
def __init__(self, type_ : str, ref : str , title : str, is_list : bool, content : str):
|
|
91
|
+
"""Initialize a custom comment block.
|
|
92
|
+
|
|
93
|
+
Args:
|
|
94
|
+
type_ (str): The type of custom comment.
|
|
95
|
+
ref (str): The reference token used to replace custom comment placeholders.
|
|
96
|
+
title (str): The title of the custom comment.
|
|
97
|
+
is_list (bool): Whether the comment should be treated as a list.
|
|
98
|
+
content (str): The comment content.
|
|
99
|
+
"""
|
|
100
|
+
self.type_ : str = type_
|
|
101
|
+
self.title : str = title
|
|
102
|
+
self.ref : str = ref
|
|
103
|
+
self.is_list : bool = is_list
|
|
104
|
+
self.content : str = content
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
class Parsed_class(Parsed_object):
|
|
109
|
+
"""Represents a parsed class and its methods."""
|
|
110
|
+
|
|
111
|
+
def __init__(self, declaration, level : int = 1):
|
|
112
|
+
"""Initialize a parsed class.
|
|
113
|
+
|
|
114
|
+
Args:
|
|
115
|
+
declaration (str): The class declaration string.
|
|
116
|
+
docstring (str): The class docstring content.
|
|
117
|
+
"""
|
|
118
|
+
super().__init__("", level)
|
|
119
|
+
self.declaration : str = ""
|
|
120
|
+
self.set_declaration(declaration)
|
|
121
|
+
self.level = level
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
def set_declaration(self, declaration):
|
|
125
|
+
"""Extract the class name from the declaration.
|
|
126
|
+
|
|
127
|
+
Args:
|
|
128
|
+
declaration (str): The class declaration string.
|
|
129
|
+
"""
|
|
130
|
+
self.declaration = declaration
|
|
131
|
+
self.name = re.search(r"^\s*class\s+([a-zA-Z_]\w*)", declaration).group(1)
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
def __str__(self):
|
|
135
|
+
"""Return the class name."""
|
|
136
|
+
return self.name
|