diff --git a/.config/requirements-lock.txt b/.config/requirements-lock.txt index 987183c9e1..112e73fb0f 100644 --- a/.config/requirements-lock.txt +++ b/.config/requirements-lock.txt @@ -11,14 +11,14 @@ black==23.10.1 bracex==2.4 certifi==2023.7.22 cffi==1.16.0 -charset-normalizer==3.3.1 +charset-normalizer==3.3.2 click==8.1.7 cryptography==41.0.5 -filelock==3.13.0 +filelock==3.13.1 idna==3.4 importlib-resources==5.0.7 jinja2==3.1.2 -jsonschema==4.19.1 +jsonschema==4.19.2 jsonschema-specifications==2023.7.1 markdown-it-py==3.0.0 markupsafe==2.1.3 @@ -34,7 +34,7 @@ referencing==0.30.2 requests==2.31.0 rich==13.6.0 rpds-py==0.10.6 -ruamel-yaml==0.18.3 +ruamel-yaml==0.18.5 subprocess-tee==0.4.1 tomli==2.0.1 typing-extensions==4.8.0 diff --git a/.config/requirements.in b/.config/requirements.in index 463d6873b9..b75ed2973f 100644 --- a/.config/requirements.in +++ b/.config/requirements.in @@ -10,7 +10,7 @@ packaging>=21.3 # Apache-2.0,BSD-2-Clause pathspec>=0.10.3 # Mozilla Public License 2.0 (MPL 2.0) pyyaml>=5.4.1 # MIT (centos 9 has 5.3.1) rich>=12.0.0 # MIT -ruamel.yaml>=0.17.0,!=0.17.29,!=0.17.30 # MIT +ruamel.yaml>=0.18.5 # MIT requests>=2.31.0 # Apache-2.0 (indirect, but we want newer version for security reasons) subprocess-tee>=0.4.1 # MIT, used by ansible-compat yamllint >= 1.30.0 # GPLv3 diff --git a/.config/requirements.txt b/.config/requirements.txt index ba563bc45e..ae93334f55 100644 --- a/.config/requirements.txt +++ b/.config/requirements.txt @@ -29,7 +29,7 @@ defusedxml==0.7.1 dill==0.3.7 exceptiongroup==1.1.3 execnet==2.0.2 -filelock==3.13.0 +filelock==3.13.1 ghp-import==2.1.0 griffe==0.36.4 htmlmin2==0.1.13 @@ -41,7 +41,7 @@ isort==5.12.0 jinja2==3.1.2 jmespath==1.0.1 jsmin==3.0.1 -jsonschema==4.19.1 +jsonschema==4.19.2 jsonschema-specifications==2023.7.1 license-expression==30.1.1 markdown==3.4.4 @@ -91,15 +91,15 @@ regex==2023.8.8 requests==2.31.0 rich==13.6.0 rpds-py==0.10.6 -ruamel-yaml==0.18.3 +ruamel-yaml==0.18.5 six==1.16.0 soupsieve==2.5 subprocess-tee==0.4.1 text-unidecode==1.3 tinycss2==1.2.1 tomli==2.0.1 -tomlkit==0.12.1 -types-jsonschema==4.19.0.3 +tomlkit==0.12.2 +types-jsonschema==4.19.0.4 types-pyyaml==6.0.12.12 typing-extensions==4.8.0 urllib3==2.0.5 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index eced67c3fa..520bb7f336 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -71,7 +71,7 @@ repos: args: [--relative, --no-progress, --no-summary] name: Spell check with cspell - repo: https://github.com/python-jsonschema/check-jsonschema - rev: 0.27.0 + rev: 0.27.1 hooks: - id: check-github-workflows - repo: https://github.com/pre-commit/pre-commit-hooks.git diff --git a/src/ansiblelint/yaml_utils.py b/src/ansiblelint/yaml_utils.py index e43112a6e6..a7065ef1ce 100644 --- a/src/ansiblelint/yaml_utils.py +++ b/src/ansiblelint/yaml_utils.py @@ -35,7 +35,7 @@ if TYPE_CHECKING: # noinspection PyProtectedMember from ruamel.yaml.comments import LineCol - from ruamel.yaml.compat import StreamTextType, VersionType + from ruamel.yaml.compat import StreamTextType from ruamel.yaml.nodes import ScalarNode from ruamel.yaml.representer import RoundTripRepresenter from ruamel.yaml.tokens import CommentToken @@ -758,7 +758,7 @@ def __init__( # pylint: disable=too-many-arguments pure: bool = False, output: Any = None, plug_ins: list[str] | None = None, - version: VersionType | None = None, + version: tuple[int, int] | None = None, ): """Return a configured ``ruamel.yaml.YAML`` instance. @@ -822,8 +822,8 @@ def __init__( # pylint: disable=too-many-arguments if isinstance(version, str): x, y = version.split(".", maxsplit=1) version = (int(x), int(y)) - self._yaml_version_default: VersionType = version - self._yaml_version: VersionType = self._yaml_version_default + self._yaml_version_default: tuple[int, int] = version + self._yaml_version: tuple[int, int] = self._yaml_version_default super().__init__(typ=typ, pure=pure, output=output, plug_ins=plug_ins) # 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]: return cast(dict[str, Union[bool, int, str]], config) @property - def version(self) -> VersionType | None: + def version(self) -> tuple[int, int] | None: """Return the YAML version used to parse or dump. Ansible uses PyYAML which only supports YAML 1.1. ruamel.yaml defaults to 1.2. @@ -938,7 +938,7 @@ def version(self) -> VersionType | None: return None @version.setter - def version(self, value: str | tuple[int, int] | None) -> None: + def version(self, value: tuple[int, int] | None) -> None: """Ensure that yaml version uses our default value. The yaml Reader updates this value based on the ``%YAML`` directive in files. diff --git a/test/schemas/package-lock.json b/test/schemas/package-lock.json index c9c83eea2d..6e2bde2bde 100644 --- a/test/schemas/package-lock.json +++ b/test/schemas/package-lock.json @@ -16,7 +16,7 @@ "@types/js-yaml": "^4.0.8", "@types/minimatch": "^5.1.2", "@types/mocha": "^10.0.3", - "@types/node": "^20.8.9", + "@types/node": "^20.8.10", "chai": "^4.3.10", "minimatch": "^9.0.3", "mocha": "^10.2.0", @@ -101,9 +101,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "20.8.9", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.8.9.tgz", - "integrity": "sha512-UzykFsT3FhHb1h7yD4CA4YhBHq545JC0YnEz41xkipN88eKQtL6rSgocL5tbAP6Ola9Izm/Aw4Ora8He4x0BHg==", + "version": "20.8.10", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.8.10.tgz", + "integrity": "sha512-TlgT8JntpcbmKUFzjhsyhGfP2fsiz1Mv56im6enJ905xG1DAYesxJaeSbGqQmAw8OWPdhyJGhGSQGKRNJ45u9w==", "dependencies": { "undici-types": "~5.26.4" } @@ -1415,9 +1415,9 @@ "dev": true }, "@types/node": { - "version": "20.8.9", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.8.9.tgz", - "integrity": "sha512-UzykFsT3FhHb1h7yD4CA4YhBHq545JC0YnEz41xkipN88eKQtL6rSgocL5tbAP6Ola9Izm/Aw4Ora8He4x0BHg==", + "version": "20.8.10", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.8.10.tgz", + "integrity": "sha512-TlgT8JntpcbmKUFzjhsyhGfP2fsiz1Mv56im6enJ905xG1DAYesxJaeSbGqQmAw8OWPdhyJGhGSQGKRNJ45u9w==", "requires": { "undici-types": "~5.26.4" } diff --git a/test/schemas/package.json b/test/schemas/package.json index 597a4a638c..b73bc20a67 100644 --- a/test/schemas/package.json +++ b/test/schemas/package.json @@ -16,7 +16,7 @@ "@types/js-yaml": "^4.0.8", "@types/minimatch": "^5.1.2", "@types/mocha": "^10.0.3", - "@types/node": "^20.8.9", + "@types/node": "^20.8.10", "chai": "^4.3.10", "minimatch": "^9.0.3", "mocha": "^10.2.0", diff --git a/test/test_yaml_utils.py b/test/test_yaml_utils.py index 3cf032a168..7ae75f37c9 100644 --- a/test/test_yaml_utils.py +++ b/test/test_yaml_utils.py @@ -15,7 +15,6 @@ if TYPE_CHECKING: from ruamel.yaml.comments import CommentedMap, CommentedSeq - from ruamel.yaml.compat import VersionType from ruamel.yaml.emitter import Emitter fixtures_dir = Path(__file__).parent / "fixtures" @@ -244,7 +243,7 @@ def load_yaml_formatting_fixtures(fixture_filename: str) -> tuple[str, str, str] pytest.param("---\nfoo: YES\n", "---\nfoo: YES\n", None, id="11"), ), ) -def test_fmt(before: str, after: str, version: VersionType) -> None: +def test_fmt(before: str, after: str, version: tuple[int, int] | None) -> None: """Tests behavior of formatter in regards to different YAML versions, specified or not.""" yaml = ansiblelint.yaml_utils.FormattedYAML(version=version) data = yaml.load(before)