Skip to content

Commit d14f242

Browse files
authored
fix: Update mypy python version to 3.12 (#4846)
1 parent 43e758b commit d14f242

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

.config/dictionary.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ taskshandlers
9393
testinfra
9494
timesyncd
9595
tmpfs
96+
tombi
9697
tomlsort
9798
typehints
9899
uncook

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# cspell: ignore FURB xunit
2+
#:tombi schema.strict = false
23

34
[project]
45
name = "ansible-lint"
@@ -166,7 +167,7 @@ exclude_gitignore = true
166167
follow_untyped_imports = true
167168
incremental = false
168169
no_implicit_optional = true
169-
python_version = "3.10"
170+
python_version = "3.12"
170171
show_error_code_links = true
171172
strict = true
172173
warn_redundant_casts = true

src/ansiblelint/utils.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,10 @@
5151
try:
5252
from ansible.module_utils.common.text.converters import to_bytes
5353
except ImportError: # pragma: no branch
54-
from ansible.module_utils._text import to_bytes
54+
from ansible.module_utils._text import ( # type: ignore[no-redef,unused-ignore]
55+
to_bytes,
56+
)
57+
5558
from ansible.module_utils.parsing.convert_bool import boolean
5659
from ansible.parsing.dataloader import DataLoader
5760
from ansible.parsing.mod_args import ModuleArgsParser
@@ -119,7 +122,7 @@
119122

120123
def parse_yaml_from_file(filepath: str) -> AnsibleJSON:
121124
"""Extract a decrypted YAML object from file."""
122-
dataloader = DataLoader() # type: ignore[no-untyped-call]
125+
dataloader = DataLoader() # type: ignore[no-untyped-call,unused-ignore]
123126
if hasattr(dataloader, "set_vault_secrets"):
124127
dataloader.set_vault_secrets([
125128
("default", PromptVaultSecret(_bytes=to_bytes(DEFAULT_VAULT_PASSWORD))) # type: ignore[no-untyped-call]
@@ -136,7 +139,7 @@ def parse_yaml_from_file(filepath: str) -> AnsibleJSON:
136139

137140
def path_dwim(basedir: str, given: str) -> str:
138141
"""Convert a given path do-what-I-mean style."""
139-
dataloader = DataLoader() # type: ignore[no-untyped-call]
142+
dataloader = DataLoader() # type: ignore[no-untyped-call,unused-ignore]
140143
dataloader.set_basedir(basedir)
141144
return str(dataloader.path_dwim(given))
142145

@@ -151,7 +154,7 @@ def ansible_templar(basedir: Path, templatevars: Any) -> Templar:
151154
if basedir.name == "tasks":
152155
basedir = basedir.parent
153156

154-
dataloader = DataLoader() # type: ignore[no-untyped-call]
157+
dataloader = DataLoader() # type: ignore[no-untyped-call,unused-ignore]
155158
dataloader.set_basedir(str(basedir))
156159
templar = Templar(dataloader, variables=templatevars)
157160
return templar

0 commit comments

Comments
 (0)