From 0cd36ce6d044fe5d0e200cf52a5dfc05a1e46ce6 Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Tue, 7 Oct 2025 10:11:48 +0200 Subject: [PATCH] Use strict_optional @ ansible.galaxy.dependency_resolution This patch drops unnecessary default for `CollectionDependencyProvider`'s `concrete_artifacts_manager` argument as it is always passed, in every place across the code base where the provider is constructed. It was also causing MyPy violations on calls to `_ComputedReqKindsMixin.from_requirement_dict()` in the "strict optional" mode which is now enforced for $sbj, while remaining disabled globally. It is a #85545 follow-up. --- lib/ansible/galaxy/dependency_resolution/providers.py | 2 +- test/sanity/code-smell/mypy/ansible-core.ini | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/ansible/galaxy/dependency_resolution/providers.py b/lib/ansible/galaxy/dependency_resolution/providers.py index 8d4252aeca4..8571c4bc917 100644 --- a/lib/ansible/galaxy/dependency_resolution/providers.py +++ b/lib/ansible/galaxy/dependency_resolution/providers.py @@ -51,7 +51,7 @@ class CollectionDependencyProvider(AbstractProvider): def __init__( self, apis: MultiGalaxyAPIProxy, - concrete_artifacts_manager: ConcreteArtifactsManager | None = None, + concrete_artifacts_manager: ConcreteArtifactsManager, preferred_candidates: _c.Iterable[Candidate] | None = None, with_deps: bool = True, with_pre_releases: bool = False, diff --git a/test/sanity/code-smell/mypy/ansible-core.ini b/test/sanity/code-smell/mypy/ansible-core.ini index 7fca8aeb02f..9e005acdbe8 100644 --- a/test/sanity/code-smell/mypy/ansible-core.ini +++ b/test/sanity/code-smell/mypy/ansible-core.ini @@ -23,6 +23,9 @@ ignore_missing_imports = True [mypy-ansible_test.*] ignore_missing_imports = True +[mypy-ansible.galaxy.dependency_resolution.*] +strict_optional = True + [mypy-ansible.module_utils.six.moves.*] ignore_missing_imports = True