Skip to content

Commit 4113104

Browse files
authored
Require ruamel.yaml >= 0.18.5 (#3880)
1 parent 348c385 commit 4113104

File tree

8 files changed

+26
-27
lines changed

8 files changed

+26
-27
lines changed

.config/requirements-lock.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ black==23.10.1
1111
bracex==2.4
1212
certifi==2023.7.22
1313
cffi==1.16.0
14-
charset-normalizer==3.3.1
14+
charset-normalizer==3.3.2
1515
click==8.1.7
1616
cryptography==41.0.5
17-
filelock==3.13.0
17+
filelock==3.13.1
1818
idna==3.4
1919
importlib-resources==5.0.7
2020
jinja2==3.1.2
21-
jsonschema==4.19.1
21+
jsonschema==4.19.2
2222
jsonschema-specifications==2023.7.1
2323
markdown-it-py==3.0.0
2424
markupsafe==2.1.3
@@ -34,7 +34,7 @@ referencing==0.30.2
3434
requests==2.31.0
3535
rich==13.6.0
3636
rpds-py==0.10.6
37-
ruamel-yaml==0.18.3
37+
ruamel-yaml==0.18.5
3838
subprocess-tee==0.4.1
3939
tomli==2.0.1
4040
typing-extensions==4.8.0

.config/requirements.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ packaging>=21.3 # Apache-2.0,BSD-2-Clause
1010
pathspec>=0.10.3 # Mozilla Public License 2.0 (MPL 2.0)
1111
pyyaml>=5.4.1 # MIT (centos 9 has 5.3.1)
1212
rich>=12.0.0 # MIT
13-
ruamel.yaml>=0.17.0,!=0.17.29,!=0.17.30 # MIT
13+
ruamel.yaml>=0.18.5 # MIT
1414
requests>=2.31.0 # Apache-2.0 (indirect, but we want newer version for security reasons)
1515
subprocess-tee>=0.4.1 # MIT, used by ansible-compat
1616
yamllint >= 1.30.0 # GPLv3

.config/requirements.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ defusedxml==0.7.1
2929
dill==0.3.7
3030
exceptiongroup==1.1.3
3131
execnet==2.0.2
32-
filelock==3.13.0
32+
filelock==3.13.1
3333
ghp-import==2.1.0
3434
griffe==0.36.4
3535
htmlmin2==0.1.13
@@ -41,7 +41,7 @@ isort==5.12.0
4141
jinja2==3.1.2
4242
jmespath==1.0.1
4343
jsmin==3.0.1
44-
jsonschema==4.19.1
44+
jsonschema==4.19.2
4545
jsonschema-specifications==2023.7.1
4646
license-expression==30.1.1
4747
markdown==3.4.4
@@ -91,15 +91,15 @@ regex==2023.8.8
9191
requests==2.31.0
9292
rich==13.6.0
9393
rpds-py==0.10.6
94-
ruamel-yaml==0.18.3
94+
ruamel-yaml==0.18.5
9595
six==1.16.0
9696
soupsieve==2.5
9797
subprocess-tee==0.4.1
9898
text-unidecode==1.3
9999
tinycss2==1.2.1
100100
tomli==2.0.1
101-
tomlkit==0.12.1
102-
types-jsonschema==4.19.0.3
101+
tomlkit==0.12.2
102+
types-jsonschema==4.19.0.4
103103
types-pyyaml==6.0.12.12
104104
typing-extensions==4.8.0
105105
urllib3==2.0.5

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ repos:
7171
args: [--relative, --no-progress, --no-summary]
7272
name: Spell check with cspell
7373
- repo: https://github.com/python-jsonschema/check-jsonschema
74-
rev: 0.27.0
74+
rev: 0.27.1
7575
hooks:
7676
- id: check-github-workflows
7777
- repo: https://github.com/pre-commit/pre-commit-hooks.git

src/ansiblelint/yaml_utils.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
if TYPE_CHECKING:
3636
# noinspection PyProtectedMember
3737
from ruamel.yaml.comments import LineCol
38-
from ruamel.yaml.compat import StreamTextType, VersionType
38+
from ruamel.yaml.compat import StreamTextType
3939
from ruamel.yaml.nodes import ScalarNode
4040
from ruamel.yaml.representer import RoundTripRepresenter
4141
from ruamel.yaml.tokens import CommentToken
@@ -758,7 +758,7 @@ def __init__( # pylint: disable=too-many-arguments
758758
pure: bool = False,
759759
output: Any = None,
760760
plug_ins: list[str] | None = None,
761-
version: VersionType | None = None,
761+
version: tuple[int, int] | None = None,
762762
):
763763
"""Return a configured ``ruamel.yaml.YAML`` instance.
764764
@@ -822,8 +822,8 @@ def __init__( # pylint: disable=too-many-arguments
822822
if isinstance(version, str):
823823
x, y = version.split(".", maxsplit=1)
824824
version = (int(x), int(y))
825-
self._yaml_version_default: VersionType = version
826-
self._yaml_version: VersionType = self._yaml_version_default
825+
self._yaml_version_default: tuple[int, int] = version
826+
self._yaml_version: tuple[int, int] = self._yaml_version_default
827827
super().__init__(typ=typ, pure=pure, output=output, plug_ins=plug_ins)
828828

829829
# NB: We ignore some mypy issues because ruamel.yaml typehints are not great.
@@ -925,7 +925,7 @@ def _defaults_from_yamllint_config() -> dict[str, bool | int | str]:
925925
return cast(dict[str, Union[bool, int, str]], config)
926926

927927
@property
928-
def version(self) -> VersionType | None:
928+
def version(self) -> tuple[int, int] | None:
929929
"""Return the YAML version used to parse or dump.
930930
931931
Ansible uses PyYAML which only supports YAML 1.1. ruamel.yaml defaults to 1.2.
@@ -938,7 +938,7 @@ def version(self) -> VersionType | None:
938938
return None
939939

940940
@version.setter
941-
def version(self, value: str | tuple[int, int] | None) -> None:
941+
def version(self, value: tuple[int, int] | None) -> None:
942942
"""Ensure that yaml version uses our default value.
943943
944944
The yaml Reader updates this value based on the ``%YAML`` directive in files.

test/schemas/package-lock.json

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/schemas/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"@types/js-yaml": "^4.0.8",
1717
"@types/minimatch": "^5.1.2",
1818
"@types/mocha": "^10.0.3",
19-
"@types/node": "^20.8.9",
19+
"@types/node": "^20.8.10",
2020
"chai": "^4.3.10",
2121
"minimatch": "^9.0.3",
2222
"mocha": "^10.2.0",

test/test_yaml_utils.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515

1616
if TYPE_CHECKING:
1717
from ruamel.yaml.comments import CommentedMap, CommentedSeq
18-
from ruamel.yaml.compat import VersionType
1918
from ruamel.yaml.emitter import Emitter
2019

2120
fixtures_dir = Path(__file__).parent / "fixtures"
@@ -244,7 +243,7 @@ def load_yaml_formatting_fixtures(fixture_filename: str) -> tuple[str, str, str]
244243
pytest.param("---\nfoo: YES\n", "---\nfoo: YES\n", None, id="11"),
245244
),
246245
)
247-
def test_fmt(before: str, after: str, version: VersionType) -> None:
246+
def test_fmt(before: str, after: str, version: tuple[int, int] | None) -> None:
248247
"""Tests behavior of formatter in regards to different YAML versions, specified or not."""
249248
yaml = ansiblelint.yaml_utils.FormattedYAML(version=version)
250249
data = yaml.load(before)

0 commit comments

Comments
 (0)