reqstool-python-decorators 1.0.0__py3-none-any.whl → 1.0.1__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.
@@ -2,6 +2,7 @@
2
2
 
3
3
  from enum import Enum, unique
4
4
  import os
5
+ from pathlib import Path, PurePath
5
6
  from typing import ReadOnly, TypedDict
6
7
  from ruamel.yaml import YAML
7
8
  import ast
@@ -115,8 +116,9 @@ class DecoratorProcessor:
115
116
  - `name` (str): The name of the function or class.
116
117
  - `decorators` (list): List of dictionaries with decorator info including name and arguments e.g. "REQ_001".
117
118
  """
118
- with open(file_path, "r") as file:
119
- tree = ast.parse(file.read(), filename=str(file_path))
119
+ # Hand ast.parse the raw bytes so it decodes per PEP 263 (UTF-8 unless the file declares otherwise),
120
+ # instead of the platform locale encoding (cp1252 on Windows), which rejects valid UTF-8 sources.
121
+ tree = ast.parse(Path(file_path).read_bytes(), filename=str(file_path))
120
122
 
121
123
  for node in ast.walk(tree):
122
124
  if isinstance(node, (ast.FunctionDef, ast.AsyncFunctionDef, ast.ClassDef)):
@@ -130,7 +132,7 @@ class DecoratorProcessor:
130
132
  if any(decorator_info["name"] in decorator_names for decorator_info in decorators_info):
131
133
  self.req_svc_results.append(
132
134
  {
133
- "fullyQualifiedName": str(file_path).replace("/", "."),
135
+ "fullyQualifiedName": PurePath(file_path).as_posix().replace("/", "."),
134
136
  "elementKind": node.__class__.__name__.removesuffix("Def").upper(),
135
137
  "name": node.name,
136
138
  "decorators": decorators_info,
@@ -157,7 +159,7 @@ class DecoratorProcessor:
157
159
  instance.write_to_yaml("output_file.yml", data)
158
160
  ```
159
161
  """
160
- with open(output_file, "w") as yaml_file:
162
+ with open(output_file, "w", encoding="utf-8") as yaml_file:
161
163
  yaml = YAML()
162
164
  yaml.default_flow_style = False
163
165
  yaml_file.write(self.yaml_language_server)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: reqstool-python-decorators
3
- Version: 1.0.0
3
+ Version: 1.0.1
4
4
  Summary: Reqstool Python Decorators
5
5
  Project-URL: Homepage, https://reqstool.github.io
6
6
  Project-URL: Source, https://github.com/reqstool/reqstool-python-decorators.git
@@ -11,6 +11,9 @@ Classifier: Development Status :: 4 - Beta
11
11
  Classifier: License :: OSI Approved :: MIT License
12
12
  Classifier: Operating System :: OS Independent
13
13
  Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.13
15
+ Classifier: Programming Language :: Python :: 3.14
16
+ Classifier: Programming Language :: Python :: 3.15
14
17
  Requires-Python: >=3.13
15
18
  Requires-Dist: ruamel-yaml==0.19.1
16
19
  Description-Content-Type: text/markdown
@@ -2,8 +2,8 @@ reqstool_python_decorators/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJ
2
2
  reqstool_python_decorators/decorators/__init__.py,sha256=9xL1ExocYj8K05rdGyEKT9CLX7bgWbOG3hsvDhWWnFc,19
3
3
  reqstool_python_decorators/decorators/decorators.py,sha256=UtlQmqt2QdnCYHu8s4C54gMjvNrp5zlzZYWF6haTYe8,876
4
4
  reqstool_python_decorators/processors/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
- reqstool_python_decorators/processors/decorator_processor.py,sha256=UlBMMGP6eE2x7BL9TBZGciL2b7q2gkB0u4qAXtyWeh4,9759
6
- reqstool_python_decorators-1.0.0.dist-info/METADATA,sha256=uCA98lWDueDoNCMDjtDFsLZ8gE3iFvSwEgtJ6kL_9ig,2805
7
- reqstool_python_decorators-1.0.0.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
8
- reqstool_python_decorators-1.0.0.dist-info/licenses/LICENSE,sha256=FVfPRmqjYUYTodYsh2C7Y70MWH64m0aWgTeIbqPj-P0,1060
9
- reqstool_python_decorators-1.0.0.dist-info/RECORD,,
5
+ reqstool_python_decorators/processors/decorator_processor.py,sha256=NCK_somfT1u3zZcKmZkdfMEs47l2kv5Z7Tj0kqHOIe0,10013
6
+ reqstool_python_decorators-1.0.1.dist-info/METADATA,sha256=3obq34HO24aGSjOvjlXdB-meKQ40PofkKkZVkGWfrgw,2958
7
+ reqstool_python_decorators-1.0.1.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
8
+ reqstool_python_decorators-1.0.1.dist-info/licenses/LICENSE,sha256=FVfPRmqjYUYTodYsh2C7Y70MWH64m0aWgTeIbqPj-P0,1060
9
+ reqstool_python_decorators-1.0.1.dist-info/RECORD,,