reqstool-python-decorators 0.0.1__py3-none-any.whl → 0.0.3__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.
- reqstool_python_decorators/processors/decorator_processor.py +19 -8
- {reqstool_python_decorators-0.0.1.dist-info → reqstool_python_decorators-0.0.3.dist-info}/METADATA +2 -2
- {reqstool_python_decorators-0.0.1.dist-info → reqstool_python_decorators-0.0.3.dist-info}/RECORD +5 -5
- {reqstool_python_decorators-0.0.1.dist-info → reqstool_python_decorators-0.0.3.dist-info}/WHEEL +1 -1
- {reqstool_python_decorators-0.0.1.dist-info → reqstool_python_decorators-0.0.3.dist-info}/licenses/LICENSE +0 -0
|
@@ -18,7 +18,7 @@ class DECORATOR_TYPES(Enum):
|
|
|
18
18
|
return f"from: {self.from_value}, to: {self.to_value}"
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
class
|
|
21
|
+
class DecoratorProcessor:
|
|
22
22
|
"""
|
|
23
23
|
A class for collecting and processing Requirements and SVCs annotations on functions and classes in a directory.
|
|
24
24
|
|
|
@@ -30,11 +30,8 @@ class ProcessDecorator:
|
|
|
30
30
|
"""
|
|
31
31
|
|
|
32
32
|
decorators_to_search = ["Requirements", "SVCs"]
|
|
33
|
-
reqsvc_yaml_path = "dist/all_annotations.yml"
|
|
34
33
|
|
|
35
|
-
yaml_language_server =
|
|
36
|
-
"# yaml-language-server: $schema=https://schemas.se/requirements-tool/v1/annotations.schema.json\n"
|
|
37
|
-
)
|
|
34
|
+
yaml_language_server = "# yaml-language-server: $schema=https://raw.githubusercontent.com/Luftfartsverket/reqstool-client/main/src/reqstool/resources/schemas/v1/annotations.schema.json\n" # noqa: E501
|
|
38
35
|
|
|
39
36
|
def __init__(self, *args, **kwargs):
|
|
40
37
|
"""
|
|
@@ -176,12 +173,24 @@ class ProcessDecorator:
|
|
|
176
173
|
|
|
177
174
|
return formatted_data
|
|
178
175
|
|
|
179
|
-
def
|
|
176
|
+
def create_dir_from_path(self, filepath: str):
|
|
177
|
+
"""
|
|
178
|
+
Creates directory of provided filepath if it does not exists
|
|
179
|
+
|
|
180
|
+
Parameters:
|
|
181
|
+
- `filepath` (str): Filepath to check and create directory from.
|
|
182
|
+
"""
|
|
183
|
+
directory = os.path.dirname(filepath)
|
|
184
|
+
if not os.path.exists(directory):
|
|
185
|
+
os.makedirs(directory)
|
|
186
|
+
|
|
187
|
+
def process_decorated_data(self, path_to_python_files, output_file="build/reqstool/annotations.yml"):
|
|
180
188
|
"""
|
|
181
189
|
"Main" function, runs all functions resulting in a yaml file containing decorated data.
|
|
182
190
|
|
|
183
191
|
Parameters:
|
|
184
192
|
- `path_to_python_files` (list): List of directories containing Python files.
|
|
193
|
+
- `output_file` (str): Set path for output file, defaults to build/annotations.yml
|
|
185
194
|
|
|
186
195
|
This method takes a list of directories containing Python files, collects decorated data from these files,
|
|
187
196
|
formats the collected data, and writes the formatted results to YAML file for Requirements and SVCs annotations.
|
|
@@ -191,6 +200,8 @@ class ProcessDecorator:
|
|
|
191
200
|
python_files = self.find_python_files(directory=path)
|
|
192
201
|
for file_path in python_files:
|
|
193
202
|
self.get_functions_and_classes(file_path=file_path, decorator_names=self.decorators_to_search)
|
|
203
|
+
|
|
194
204
|
formatted_reqsvc_data = self.format_results(results=self.req_svc_results)
|
|
195
|
-
|
|
196
|
-
self.
|
|
205
|
+
|
|
206
|
+
self.create_dir_from_path(output_file)
|
|
207
|
+
self.write_to_yaml(output_file=output_file, formatted_data=formatted_reqsvc_data)
|
{reqstool_python_decorators-0.0.1.dist-info → reqstool_python_decorators-0.0.3.dist-info}/METADATA
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
2
|
Name: reqstool-python-decorators
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.3
|
|
4
4
|
Summary: Reqstool Python Decorators
|
|
5
5
|
Project-URL: Source, https://github.com/Luftfartsverket/reqstool-python-decorators.git
|
|
6
6
|
Author-email: LFV SYSDEV <sysdev@lfv.com>
|
{reqstool_python_decorators-0.0.1.dist-info → reqstool_python_decorators-0.0.3.dist-info}/RECORD
RENAMED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
reqstool_python_decorators/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
2
|
reqstool_python_decorators/decorators/decorators.py,sha256=7TnBcVour2VSH76rM4FtwmCDi9JY9gxqOvAL6o1kI_g,282
|
|
3
3
|
reqstool_python_decorators/processors/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
|
-
reqstool_python_decorators/processors/decorator_processor.py,sha256=
|
|
5
|
-
reqstool_python_decorators-0.0.
|
|
6
|
-
reqstool_python_decorators-0.0.
|
|
7
|
-
reqstool_python_decorators-0.0.
|
|
8
|
-
reqstool_python_decorators-0.0.
|
|
4
|
+
reqstool_python_decorators/processors/decorator_processor.py,sha256=0xpfOv-6HDKtSOOXkN5MCRgUzLuuagQO_ujZS8qZBCg,8423
|
|
5
|
+
reqstool_python_decorators-0.0.3.dist-info/METADATA,sha256=qmDEujJ_a2ZNSMPCDh83DO6ljNg4HlwCrK-645c3jSg,2874
|
|
6
|
+
reqstool_python_decorators-0.0.3.dist-info/WHEEL,sha256=uNdcs2TADwSd5pVaP0Z_kcjcvvTUklh2S7bxZMF8Uj0,87
|
|
7
|
+
reqstool_python_decorators-0.0.3.dist-info/licenses/LICENSE,sha256=FVfPRmqjYUYTodYsh2C7Y70MWH64m0aWgTeIbqPj-P0,1060
|
|
8
|
+
reqstool_python_decorators-0.0.3.dist-info/RECORD,,
|
|
File without changes
|