Mentions légales du service

Skip to content
Snippets Groups Projects
Verified Commit 912d579a authored by ANDREY Paul's avatar ANDREY Paul
Browse files

Silence mypy warnings to be fixed when dropping py38 support.

parent 4a4027aa
No related branches found
No related tags found
No related merge requests found
Pipeline #1100322 failed
......@@ -204,5 +204,7 @@ def _parameters_to_fields(
ftype = Dict[str, ftype] # type: ignore
field.default_factory = dict
# Append parsed information to the fields list.
fields.append((fname, ftype, field))
fields.append(
(fname, ftype, field) # type: ignore # update when py >=3.9
)
return fields
......@@ -139,7 +139,7 @@ def _instantiate_field(
origin = typing.get_origin(field.type)
# Case of a raw type.
if origin is None:
return _instantiate(field.type)
return _instantiate(field.type) # type: ignore # update when py >=3.9
# Case of a union of types (including optional).
if origin is Union:
for cls in typing.get_args(field.type):
......@@ -284,7 +284,9 @@ class TomlConfig:
Instantiated object that matches the field's specifications.
"""
# Case of valid inputs: return them as-is (including valid None).
if _isinstance_generic(inputs, field.type): # see function's notes
if _isinstance_generic(
inputs, field.type # type: ignore # update when py >=3.9
): # see function's notes
return inputs
# Case of None inputs: return default value if any, else raise.
if inputs is None:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment