Skip to content

Commit 41ca590

Browse files
Improved generation of stub file, added subclassing from dict
1 parent f82084c commit 41ca590

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "pyya"
3-
version = "0.1.9"
3+
version = "0.1.10"
44
description = "Convert YAML configuration files to Python objects"
55
readme = "README.md"
66
requires-python = ">=3.8"

pyya.egg-info/PKG-INFO

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Metadata-Version: 2.1
22
Name: pyya
3-
Version: 0.1.9
3+
Version: 0.1.10
44
Summary: Convert YAML configuration files to Python objects
55
Author-email: shadowy-pycoder <[email protected]>
66
Project-URL: Homepage, https://github.com/shadowy-pycoder/pyya

pyya/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ def _model_and_stub_from_dict(
163163
if path is None:
164164
path = []
165165
class_name = ''.join(part.capitalize() if i > 0 else part for i, part in enumerate(path + [name]))
166-
stub_lines = [f'class {class_name}:']
166+
stub_lines = [f'class {class_name}(Dict[str, Any]):']
167167
nested_stubs = []
168168
py_type: Any
169169
for section, entry in data.items():
@@ -226,7 +226,7 @@ def _get_default_raw_data() -> ConfigType:
226226
_default_raw_data = _get_default_raw_data()
227227
_, stub = _model_and_stub_from_dict('Config', _default_raw_data)
228228
stub_full = (
229-
f'# {output_file} was autogenerated with pyya CLI tool, see `pyya -h`\nfrom typing import Any, List\n\n'
229+
f'# {output_file} was autogenerated with pyya CLI tool, see `pyya -h`\nfrom typing import Any, Dict, List\n\n'
230230
f'{stub}\n\n'
231231
'# for type hints to work the variable name created with pyya.init_config\n'
232232
'# should have the same name (e.g. config = pyya.init_config())\n'

0 commit comments

Comments
 (0)