Skip to content

Commit

Permalink
Import ruamel.yaml 0.17.35 source.
Browse files Browse the repository at this point in the history
  • Loading branch information
gizmoguy committed Oct 10, 2023
1 parent 379a56f commit f59454c
Show file tree
Hide file tree
Showing 46 changed files with 514 additions and 356 deletions.
3 changes: 3 additions & 0 deletions .hgtags
Original file line number Diff line number Diff line change
Expand Up @@ -217,3 +217,6 @@ d522a02977979e5feef1d0f1b94b6b7f823c0bdd 0.17.28
41fd3925691106c999959771e54bd69cce70d1c8 0.17.29
0ed43732b9e309d397e9c9cfa74f115f40f51a6b 0.17.30
b01b2f5c1ff21d561193de37b7e843baa2b91c91 0.17.31
e2d9ee085ae698c4dca733b83a718b9e4a6ec8c0 0.17.32
c4b4f7766d1845b67606fba5dd7d753e614417ea 0.17.33
31cd820ffa1ae47947343603617be8294d8f1657 0.17.34
21 changes: 21 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
[0, 17, 35]: 2023-10-04
- support for loading dataclasses with ``InitVar`` variables (some
special coding was necessary to get the, unexecpected, default value
in the corresponding instance attribute ( example of usage in
`this question <https://stackoverflow.com/q/77228378/1307905>`__ )

[0, 17, 34]: 2023-10-03
- Python 3.12 also loads C version when using `typ='safe'`
- initial support for loading invoking `__post_init__()` on dataclasses that have that method
after loading a registered dataclass (`@yaml.register_class\n@dataclass\nclass ...`).
(Originally `asked <https://stackoverflow.com/q/51529458/1307905>`__ on Stackoverflow by
`nyanpasu64 <https://stackoverflow.com/users/2683842/nyanpasu64>`__ and as
`ticket <https://sourceforge.net/p/ruamel-yaml/tickets/355/>`__
by `Patrick Lehmann <https://sourceforge.net/u/paebbels/profile/>`__

[0, 17, 33]: 2023-09-28
- added `flow_seq_start`, `flow_seq_end`, `flow_seq_separator`, `flow_map_start`, `flow_map_end`,
`flow_map_separator` **class** attributes to the `Emitter` class so flow style output
can more easily be influenced (based on `this answer <https://stackoverflow.com/a/76547814/1307905>`__
on a StackOverflow question by `Huw Walters <https://stackoverflow.com/users/291033/huw-walters>`__).

[0, 17, 32]: 2023-06-17
- fix issue with scanner getting stuck in infinite loop

Expand Down
25 changes: 23 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ ruamel.yaml

``ruamel.yaml`` is a YAML 1.2 loader/dumper package for Python.

:version: 0.17.32
:updated: 2023-06-17
:version: 0.17.35
:updated: 2023-10-04
:documentation: http://yaml.readthedocs.io
:repository: https://sourceforge.net/projects/ruamel-yaml/
:pypi: https://pypi.org/project/ruamel.yaml/
Expand Down Expand Up @@ -61,6 +61,27 @@ ChangeLog

.. should insert NEXT: at the beginning of line for next key (with empty line)
0.17.35 (2023-10-04):
- support for loading dataclasses with ``InitVar`` variables (some
special coding was necessary to get the, unexecpected, default value
in the corresponding instance attribute ( example of usage in
`this question <https://stackoverflow.com/q/77228378/1307905>`__ )

0.17.34 (2023-10-03):
- Python 3.12 also loads C version when using ``typ='safe'``
- initial support for loading invoking `__post_init__()` on dataclasses that have that method
after loading a registered dataclass (`@yaml.register_class\n@dataclass\nclass ...`).
(Originally `asked <https://stackoverflow.com/q/51529458/1307905>`__ on Stackoverflow by
`nyanpasu64 <https://stackoverflow.com/users/2683842/nyanpasu64>`__ and as
`ticket <https://sourceforge.net/p/ruamel-yaml/tickets/355/>`__
by `Patrick Lehmann <https://sourceforge.net/u/paebbels/profile/>`__

0.17.33 (2023-09-28):
- added `flow_seq_start`, `flow_seq_end`, `flow_seq_separator`, `flow_map_start`, `flow_map_end`,
`flow_map_separator` **class** attributes to the `Emitter` class so flow style output
can more easily be influenced (based on `this answer <https://stackoverflow.com/a/76547814/1307905>`__
on a StackOverflow question by `Huw Walters <https://stackoverflow.com/users/291033/huw-walters>`__).

0.17.32 (2023-06-17):
- fix issue with scanner getting stuck in infinite loop

Expand Down
8 changes: 4 additions & 4 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@

_package_data = dict(
full_package_name='ruamel.yaml',
version_info=(0, 17, 32),
__version__='0.17.32',
version_timestamp='2023-06-17 07:55:58',
version_info=(0, 17, 35),
__version__='0.17.35',
version_timestamp='2023-10-04 11:45:09',
author='Anthon van der Neut',
author_email='[email protected]',
description='ruamel.yaml is a YAML parser/emitter that supports roundtrip preservation of comments, seq/map flow style, and map key order', # NOQA
entry_points=None,
since=2014,
extras_require={
':platform_python_implementation=="CPython" and python_version<"3.12"': ['ruamel.yaml.clib>=0.2.7'], # NOQA
':platform_python_implementation=="CPython" and python_version<"3.13"': ['ruamel.yaml.clib>=0.2.7'], # NOQA
'jinja2': ['ruamel.yaml.jinja2>=0.2'],
'docs': ['ryd'],
},
Expand Down
2 changes: 1 addition & 1 deletion _doc/_static/pypi.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions _doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ class ryd2rst:
'Python YAML package documentation',
'Anthon van der Neut',
'manual',
)
),
]

# The name of an image file (relative to this directory) to place at the top of
Expand Down Expand Up @@ -300,7 +300,7 @@ class ryd2rst:
'yaml',
'One line description of project.',
'Miscellaneous',
)
),
]

# Documents to append as an appendix to all manuals.
Expand Down
4 changes: 2 additions & 2 deletions _test/roundtrip.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def dedent(data: str) -> str:


def round_trip_load(
inp: Any, preserve_quotes: Optional[bool] = None, version: Optional[Any] = None
inp: Any, preserve_quotes: Optional[bool] = None, version: Optional[Any] = None,
) -> Any:
import ruamel.yaml # NOQA

Expand All @@ -39,7 +39,7 @@ def round_trip_load(


def round_trip_load_all(
inp: Any, preserve_quotes: Optional[bool] = None, version: Optional[Any] = None
inp: Any, preserve_quotes: Optional[bool] = None, version: Optional[Any] = None,
) -> Any:
import ruamel.yaml # NOQA

Expand Down
2 changes: 1 addition & 1 deletion _test/test_a_dedent.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@ def test_multiple_dedent(self) -> None:
x = dedent(
dedent("""
123
""")
"""),
)
assert x == '123\n'
2 changes: 1 addition & 1 deletion _test/test_add_xxx.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def test_yaml_obj_with_loader_and_dumper() -> None:
yaml = ruamel.yaml.YAML(typ='unsafe', pure=True)
ruamel.yaml.add_representer(Obj1, YAMLObj1.to_yaml, Dumper=ruamel.yaml.Dumper)
ruamel.yaml.add_multi_constructor(
YAMLObj1.yaml_tag, YAMLObj1.from_yaml, Loader=ruamel.yaml.Loader
YAMLObj1.yaml_tag, YAMLObj1.from_yaml, Loader=ruamel.yaml.Loader,
)
x = yaml.load('!obj:x.2\na: 1')
# x = ruamel.yaml.load('!obj:x.2\na: 1')
Expand Down
2 changes: 1 addition & 1 deletion _test/test_anchor.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def test_anchor_id_retained(self) -> None:
)

@pytest.mark.skipif( # type: ignore
platform.python_implementation() == 'Jython', reason='Jython throws RepresenterError'
platform.python_implementation() == 'Jython', reason='Jython throws RepresenterError',
)
def test_alias_before_anchor(self) -> None:
from ruamel.yaml.composer import ComposerError
Expand Down
4 changes: 2 additions & 2 deletions _test/test_api_change.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ def test_multi_document_load(self, tmpdir: Any) -> None:
---
- b
...
""")
"""),
)
yaml = YAML()
assert list(yaml.load_all(fn)) == [['a'], ['b']]
Expand All @@ -185,7 +185,7 @@ def test_dupl_set_00(self) -> None:
? b
? c
? a
""")
"""),
)


Expand Down
2 changes: 1 addition & 1 deletion _test/test_class_register.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def __init__(self, name: str, age: int) -> None:
@classmethod
def to_yaml(cls, representer: Any, node: Any) -> Any:
return representer.represent_scalar(
cls.yaml_tag, '{.name}-{.age}'.format(node, node)
cls.yaml_tag, '{.name}-{.age}'.format(node, node),
)

@classmethod
Expand Down
10 changes: 5 additions & 5 deletions _test/test_comment_manipulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ def test_map_set_comment_before_and_after_non_first_key_00(self) -> None:
test3: 3
""")
data.yaml_set_comment_before_after_key(
'test1', 'before test1 (top level)', after='before test2'
'test1', 'before test1 (top level)', after='before test2',
)
data['test1']['test2'].yaml_set_start_comment('after test2', indent=4)
exp = """
Expand Down Expand Up @@ -474,7 +474,7 @@ def Xtest_map_set_comment_before_and_after_non_first_key_01(self) -> None:
test3: 3
""")
data.yaml_set_comment_before_after_key(
'test1', 'before test1 (top level)', after='before test2\n\n'
'test1', 'before test1 (top level)', after='before test2\n\n',
)
data['test1']['test2'].yaml_set_start_comment('after test2', indent=4)
# EOL is needed here as dedenting gets rid of spaces (as well as does Emacs
Expand Down Expand Up @@ -506,7 +506,7 @@ def test_map_set_comment_before_and_after_non_first_key_01(self) -> None:
test3: 3
""")
data.yaml_set_comment_before_after_key(
'test1', 'before test1 (top level)', after='before test2\n\n'
'test1', 'before test1 (top level)', after='before test2\n\n',
)
data['test1']['test2'].yaml_set_start_comment('after test2', indent=4)
exp = """
Expand Down Expand Up @@ -535,7 +535,7 @@ def Xtest_map_set_comment_before_and_after_non_first_key_02(self) -> None:
test3: 3
""")
data.yaml_set_comment_before_after_key(
'test1', 'xyz\n\nbefore test1 (top level)', after='\nbefore test2', after_indent=4
'test1', 'xyz\n\nbefore test1 (top level)', after='\nbefore test2', after_indent=4,
)
data['test1']['test2'].yaml_set_start_comment('after test2', indent=4)
# EOL is needed here as dedenting gets rid of spaces (as well as does Emacs
Expand Down Expand Up @@ -567,7 +567,7 @@ def test_map_set_comment_before_and_after_non_first_key_02(self) -> None:
test3: 3
""")
data.yaml_set_comment_before_after_key(
'test1', 'xyz\n\nbefore test1 (top level)', after='\nbefore test2', after_indent=4
'test1', 'xyz\n\nbefore test1 (top level)', after='\nbefore test2', after_indent=4,
)
data['test1']['test2'].yaml_set_start_comment('after test2', indent=4)
exp = """
Expand Down
4 changes: 2 additions & 2 deletions _test/test_comments.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ def test_dump_utf8(self) -> None:
data = round_trip_load(x)
for utf in [True, False]:
y = round_trip_dump(
data, default_flow_style=False, allow_unicode=utf
data, default_flow_style=False, allow_unicode=utf,
)
assert y == x

Expand All @@ -289,7 +289,7 @@ def test_dump_unicode_utf8(self) -> None:
data = round_trip_load(x)
for utf in [True, False]:
y = round_trip_dump(
data, default_flow_style=False, allow_unicode=utf
data, default_flow_style=False, allow_unicode=utf,
)
assert y == x

Expand Down
6 changes: 3 additions & 3 deletions _test/test_cyaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

@pytest.mark.skipif( # type: ignore
platform.python_implementation() in ['Jython', 'PyPy'],
reason='Jython throws RepresenterError'
reason='Jython throws RepresenterError',
)
def test_load_cyaml() -> None:
print("???????????????????????", platform.python_implementation())
Expand Down Expand Up @@ -42,7 +42,7 @@ def test_dump_cyaml() -> None:


@pytest.mark.skipif( # type: ignore
platform.python_implementation() in ['Jython', 'PyPy'], reason='not avialable'
platform.python_implementation() in ['Jython', 'PyPy'], reason='not avialable',
)
def test_load_cyaml_1_2() -> None:
# issue 155
Expand All @@ -61,7 +61,7 @@ def test_load_cyaml_1_2() -> None:


@pytest.mark.skipif( # type: ignore
platform.python_implementation() in ['Jython', 'PyPy'], reason='not available'
platform.python_implementation() in ['Jython', 'PyPy'], reason='not available',
)
def test_dump_cyaml_1_2() -> None:
# issue 155
Expand Down
Loading

0 comments on commit f59454c

Please sign in to comment.