reqstool-python-decorators 0.0.3__tar.gz → 0.0.5__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.
Files changed (28) hide show
  1. {reqstool_python_decorators-0.0.3 → reqstool_python_decorators-0.0.5}/.github/workflows/publish_gh_pages.yml +1 -1
  2. {reqstool_python_decorators-0.0.3 → reqstool_python_decorators-0.0.5}/PKG-INFO +12 -13
  3. {reqstool_python_decorators-0.0.3 → reqstool_python_decorators-0.0.5}/README.md +11 -12
  4. {reqstool_python_decorators-0.0.3 → reqstool_python_decorators-0.0.5}/docs/modules/ROOT/pages/usage.adoc +3 -3
  5. {reqstool_python_decorators-0.0.3 → reqstool_python_decorators-0.0.5}/src/reqstool_python_decorators/processors/decorator_processor.py +6 -3
  6. {reqstool_python_decorators-0.0.3 → reqstool_python_decorators-0.0.5}/tests/resources/test_decorators/requirements_decorators.py +7 -1
  7. {reqstool_python_decorators-0.0.3 → reqstool_python_decorators-0.0.5}/tests/unit/reqstool_decorators/processors/test_processors.py +4 -2
  8. {reqstool_python_decorators-0.0.3 → reqstool_python_decorators-0.0.5}/.github/dependabot.yml +0 -0
  9. {reqstool_python_decorators-0.0.3 → reqstool_python_decorators-0.0.5}/.github/workflows/build.yml +0 -0
  10. {reqstool_python_decorators-0.0.3 → reqstool_python_decorators-0.0.5}/.github/workflows/check_release.yml +0 -0
  11. {reqstool_python_decorators-0.0.3 → reqstool_python_decorators-0.0.5}/.github/workflows/lint.yml +0 -0
  12. {reqstool_python_decorators-0.0.3 → reqstool_python_decorators-0.0.5}/.github/workflows/publish_pypi_prod.yml +0 -0
  13. {reqstool_python_decorators-0.0.3 → reqstool_python_decorators-0.0.5}/.github/workflows/publish_pypi_test.yml +0 -0
  14. {reqstool_python_decorators-0.0.3 → reqstool_python_decorators-0.0.5}/.gitignore +0 -0
  15. {reqstool_python_decorators-0.0.3 → reqstool_python_decorators-0.0.5}/LICENSE +0 -0
  16. {reqstool_python_decorators-0.0.3 → reqstool_python_decorators-0.0.5}/docs/antora-playbook.yml +0 -0
  17. {reqstool_python_decorators-0.0.3 → reqstool_python_decorators-0.0.5}/docs/antora.yml +0 -0
  18. {reqstool_python_decorators-0.0.3 → reqstool_python_decorators-0.0.5}/docs/modules/ROOT/nav.adoc +0 -0
  19. {reqstool_python_decorators-0.0.3 → reqstool_python_decorators-0.0.5}/docs/modules/ROOT/pages/description.adoc +0 -0
  20. {reqstool_python_decorators-0.0.3 → reqstool_python_decorators-0.0.5}/docs/modules/ROOT/pages/index.adoc +0 -0
  21. {reqstool_python_decorators-0.0.3 → reqstool_python_decorators-0.0.5}/docs/modules/ROOT/pages/installation.adoc +0 -0
  22. {reqstool_python_decorators-0.0.3 → reqstool_python_decorators-0.0.5}/docs/modules/ROOT/pages/licence.adoc +0 -0
  23. {reqstool_python_decorators-0.0.3 → reqstool_python_decorators-0.0.5}/pyproject.toml +0 -0
  24. {reqstool_python_decorators-0.0.3 → reqstool_python_decorators-0.0.5}/src/reqstool_python_decorators/__init__.py +0 -0
  25. {reqstool_python_decorators-0.0.3 → reqstool_python_decorators-0.0.5}/src/reqstool_python_decorators/decorators/decorators.py +0 -0
  26. {reqstool_python_decorators-0.0.3 → reqstool_python_decorators-0.0.5}/src/reqstool_python_decorators/processors/__init__.py +0 -0
  27. {reqstool_python_decorators-0.0.3 → reqstool_python_decorators-0.0.5}/tests/resources/test_decorators/svc_decorators.py +0 -0
  28. {reqstool_python_decorators-0.0.3 → reqstool_python_decorators-0.0.5}/tests/unit/conftest.py +0 -0
@@ -25,7 +25,7 @@ jobs:
25
25
  - name: Checkout repository
26
26
  uses: actions/checkout@v4
27
27
  - name: Configure Pages
28
- uses: actions/configure-pages@v4
28
+ uses: actions/configure-pages@v5
29
29
  - name: Install Node.js
30
30
  uses: actions/setup-node@v4
31
31
  with:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: reqstool-python-decorators
3
- Version: 0.0.3
3
+ Version: 0.0.5
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>
@@ -28,15 +28,15 @@ This provides decorators and collecting of decorated code, formatting it and wri
28
28
 
29
29
  ## Installation
30
30
 
31
- The package name is `reqstool-decorators`.
31
+ The package name is `reqstool-python-decorators`.
32
32
 
33
33
  * Using pip install:
34
34
 
35
35
  ```
36
- $pip install reqstool-decorators
36
+ $pip install reqstool-python-decorators
37
37
  ```
38
38
 
39
- ## Using
39
+ ## Usage
40
40
 
41
41
  ### pyproject.toml
42
42
 
@@ -44,7 +44,7 @@ $pip install reqstool-decorators
44
44
 
45
45
  ```
46
46
  dependencies = [
47
- "reqstool-decorators == <version>"
47
+ "reqstool-python-decorators == <version>"
48
48
  ]
49
49
  ```
50
50
 
@@ -52,7 +52,7 @@ dependencies = [
52
52
 
53
53
  ```
54
54
  [tool.poetry.dependencies]
55
- reqstool-decorators = "<version>"
55
+ reqstool-python-decorators = "<version>"
56
56
  ```
57
57
 
58
58
  ### Decorators
@@ -66,12 +66,12 @@ from reqstool-decorators.decorators.decorators import Requirements, SVCs
66
66
  Example usage of the decorators:
67
67
 
68
68
  ```
69
- @Requirements(REQ_111, REQ_222)
69
+ @Requirements("REQ_111", "REQ_222")
70
70
  def somefunction():
71
71
  ```
72
72
 
73
73
  ```
74
- @SVCs(SVC_111, SVC_222)
74
+ @SVCs("SVC_111", "SVC_222")
75
75
  def test_somefunction():
76
76
  ```
77
77
 
@@ -80,20 +80,19 @@ def test_somefunction():
80
80
  Import processor:
81
81
 
82
82
  ```
83
- from reqstool.processors.decorator_processor import ProcessDecorator
83
+ from reqstool.processors.decorator_processor import DecoratorProcessor
84
84
  ```
85
85
 
86
86
  Main function to collect decorators data and generate yaml file:
87
87
 
88
88
  ```
89
- process_decorated_data(path_to_python_files)
89
+ process_decorated_data(path_to_python_files, output_file)
90
90
  ```
91
91
 
92
- Here `path_to_python_files` is the directories to search through to find decorated code.
92
+ `path_to_python_files` is the directories to search through to find decorated code.
93
93
 
94
- *Note:*
94
+ (Optional) `output_file` is output file(path) the yaml file is stored to. Default is `/build/reqstool/annotations.yml`.
95
95
 
96
- Yaml file is saved into the `/dist` folder, make sure the folder exists before running the `process_decorated_data` function.
97
96
 
98
97
  ## License
99
98
 
@@ -13,15 +13,15 @@ This provides decorators and collecting of decorated code, formatting it and wri
13
13
 
14
14
  ## Installation
15
15
 
16
- The package name is `reqstool-decorators`.
16
+ The package name is `reqstool-python-decorators`.
17
17
 
18
18
  * Using pip install:
19
19
 
20
20
  ```
21
- $pip install reqstool-decorators
21
+ $pip install reqstool-python-decorators
22
22
  ```
23
23
 
24
- ## Using
24
+ ## Usage
25
25
 
26
26
  ### pyproject.toml
27
27
 
@@ -29,7 +29,7 @@ $pip install reqstool-decorators
29
29
 
30
30
  ```
31
31
  dependencies = [
32
- "reqstool-decorators == <version>"
32
+ "reqstool-python-decorators == <version>"
33
33
  ]
34
34
  ```
35
35
 
@@ -37,7 +37,7 @@ dependencies = [
37
37
 
38
38
  ```
39
39
  [tool.poetry.dependencies]
40
- reqstool-decorators = "<version>"
40
+ reqstool-python-decorators = "<version>"
41
41
  ```
42
42
 
43
43
  ### Decorators
@@ -51,12 +51,12 @@ from reqstool-decorators.decorators.decorators import Requirements, SVCs
51
51
  Example usage of the decorators:
52
52
 
53
53
  ```
54
- @Requirements(REQ_111, REQ_222)
54
+ @Requirements("REQ_111", "REQ_222")
55
55
  def somefunction():
56
56
  ```
57
57
 
58
58
  ```
59
- @SVCs(SVC_111, SVC_222)
59
+ @SVCs("SVC_111", "SVC_222")
60
60
  def test_somefunction():
61
61
  ```
62
62
 
@@ -65,20 +65,19 @@ def test_somefunction():
65
65
  Import processor:
66
66
 
67
67
  ```
68
- from reqstool.processors.decorator_processor import ProcessDecorator
68
+ from reqstool.processors.decorator_processor import DecoratorProcessor
69
69
  ```
70
70
 
71
71
  Main function to collect decorators data and generate yaml file:
72
72
 
73
73
  ```
74
- process_decorated_data(path_to_python_files)
74
+ process_decorated_data(path_to_python_files, output_file)
75
75
  ```
76
76
 
77
- Here `path_to_python_files` is the directories to search through to find decorated code.
77
+ `path_to_python_files` is the directories to search through to find decorated code.
78
78
 
79
- *Note:*
79
+ (Optional) `output_file` is output file(path) the yaml file is stored to. Default is `/build/reqstool/annotations.yml`.
80
80
 
81
- Yaml file is saved into the `/dist` folder, make sure the folder exists before running the `process_decorated_data` function.
82
81
 
83
82
  ## License
84
83
 
@@ -28,12 +28,12 @@ from reqstool_python_decorators.decorators.decorators import Requirements, SVCs
28
28
  Example usage of the decorators:
29
29
 
30
30
  ```python
31
- @Requirements(REQ_111, REQ_222)
31
+ @Requirements("REQ_111", "REQ_222")
32
32
  def somefunction():
33
33
  ```
34
34
 
35
35
  ```python
36
- @SVCs(SVC_111, SVC_222)
36
+ @SVCs("SVC_111", "SVC_222")
37
37
  def test_somefunction():
38
38
  ```
39
39
 
@@ -53,5 +53,5 @@ process_decorated_data(path_to_python_files, output_file)
53
53
 
54
54
  `path_to_python_files` is the directories to search through to find decorated code.
55
55
 
56
- `output_file` is output file(path) the yaml file is stored to
56
+ (Optional) `output_file` is output file(path) the yaml file is stored to. Default is `/build/reqstool/annotations.yml`.
57
57
 
@@ -9,6 +9,7 @@ import ast
9
9
  @unique
10
10
  class DECORATOR_TYPES(Enum):
11
11
  FUNCTION = ("FUNCTION", "METHOD")
12
+ ASYNCFUNCTION = ("ASYNCFUNCTION", "METHOD")
12
13
 
13
14
  def __init__(self, from_value, to_value):
14
15
  self.from_value = from_value
@@ -98,7 +99,7 @@ class DecoratorProcessor:
98
99
  if any(decorator_info["name"] in decorator_names for decorator_info in decorators_info):
99
100
  self.req_svc_results.append(
100
101
  {
101
- "fullyQualifiedName": file_path,
102
+ "fullyQualifiedName": str(file_path).replace("/", "."),
102
103
  "elementKind": str(type(node)).split(".")[-1][:-5].upper(),
103
104
  "name": node.name,
104
105
  "decorators": decorators_info,
@@ -173,7 +174,7 @@ class DecoratorProcessor:
173
174
 
174
175
  return formatted_data
175
176
 
176
- def create_dir_from_path(self, filepath: str):
177
+ def create_dir_from_path(self, filepath: str) -> None:
177
178
  """
178
179
  Creates directory of provided filepath if it does not exists
179
180
 
@@ -184,7 +185,9 @@ class DecoratorProcessor:
184
185
  if not os.path.exists(directory):
185
186
  os.makedirs(directory)
186
187
 
187
- def process_decorated_data(self, path_to_python_files, output_file="build/reqstool/annotations.yml"):
188
+ def process_decorated_data(
189
+ self, path_to_python_files: str, output_file: str = "build/reqstool/annotations.yml"
190
+ ) -> None:
188
191
  """
189
192
  "Main" function, runs all functions resulting in a yaml file containing decorated data.
190
193
 
@@ -7,6 +7,12 @@ class RequirementsClass:
7
7
 
8
8
 
9
9
  @Requirements("REQ_333")
10
- def requirements_function():
10
+ def requirements_function() -> None:
11
11
  # Test function for Requirements decorator
12
12
  pass
13
+
14
+
15
+ @Requirements("REQ_444")
16
+ async def asyncrequirements_function() -> None:
17
+ # Test async function for Requirements decorator
18
+ pass
@@ -25,8 +25,10 @@ def test_get_functions_and_classes(process_decorator_instance: DecoratorProcesso
25
25
 
26
26
 
27
27
  def test_map_type_known_type(process_decorator_instance: DecoratorProcessor):
28
- result = process_decorator_instance.map_type("FUNCTION")
29
- assert result == "METHOD"
28
+ map_funcion = process_decorator_instance.map_type("FUNCTION")
29
+ map_asyncfunction = process_decorator_instance.map_type("ASYNCFUNCTION")
30
+ assert map_funcion == "METHOD"
31
+ assert map_asyncfunction == "METHOD"
30
32
 
31
33
 
32
34
  def test_map_type_unknown_type(process_decorator_instance: DecoratorProcessor):