reqstool-python-decorators 0.0.1__py3-none-any.whl → 0.0.2__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.
@@ -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 ProcessDecorator:
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 process_decorated_data(self, path_to_python_files):
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/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
- reqsvc_yaml_path = "dist/annotations.yml"
196
- self.write_to_yaml(output_file=reqsvc_yaml_path, formatted_data=formatted_reqsvc_data)
205
+
206
+ self.create_dir_from_path(output_file)
207
+ self.write_to_yaml(output_file=output_file, formatted_data=formatted_reqsvc_data)
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.3
2
2
  Name: reqstool-python-decorators
3
- Version: 0.0.1
3
+ Version: 0.0.2
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>
@@ -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=DdfcNYMx0QbOqtU1nHGLYsNY_I1ru-11eVbovt5MiN0,7915
5
- reqstool_python_decorators-0.0.1.dist-info/METADATA,sha256=UVim3J4DfyPOgVZqqLmcqXSN4wcie308kMHsTcP7rYE,2874
6
- reqstool_python_decorators-0.0.1.dist-info/WHEEL,sha256=TJPnKdtrSue7xZ_AVGkp9YXcvDrobsjBds1du3Nx6dc,87
7
- reqstool_python_decorators-0.0.1.dist-info/licenses/LICENSE,sha256=FVfPRmqjYUYTodYsh2C7Y70MWH64m0aWgTeIbqPj-P0,1060
8
- reqstool_python_decorators-0.0.1.dist-info/RECORD,,
4
+ reqstool_python_decorators/processors/decorator_processor.py,sha256=GcraEud4u4B77MY6G24fvDtf1IXkZ9r9yFF69KCEvvM,8414
5
+ reqstool_python_decorators-0.0.2.dist-info/METADATA,sha256=v62KC8D8FYCgWhP8Y6mfFqhrNU7Aww8xQbYd36h03w8,2874
6
+ reqstool_python_decorators-0.0.2.dist-info/WHEEL,sha256=uNdcs2TADwSd5pVaP0Z_kcjcvvTUklh2S7bxZMF8Uj0,87
7
+ reqstool_python_decorators-0.0.2.dist-info/licenses/LICENSE,sha256=FVfPRmqjYUYTodYsh2C7Y70MWH64m0aWgTeIbqPj-P0,1060
8
+ reqstool_python_decorators-0.0.2.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: hatchling 1.21.1
2
+ Generator: hatchling 1.22.4
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any