Skip to content

Commit 9ef49c9

Browse files
committed
mypy checks for unused ignores
1 parent 84c6b9b commit 9ef49c9

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

ecs_logging/_stdlib.py

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@
3232

3333
from typing import Any, Callable, Dict, Optional, Sequence, Union
3434

35-
try:
36-
from typing import Literal # type: ignore
37-
except ImportError:
38-
from typing_extensions import Literal # type: ignore
35+
if sys.version_info >= (3, 8):
36+
from typing import Literal
37+
else:
38+
from typing_extensions import Literal
3939

4040

4141
# Load the attributes of a LogRecord so if some are
@@ -105,13 +105,15 @@ def __init__(
105105
106106
exclude_keys=["error"]
107107
"""
108-
_kwargs = {}
109-
if validate is not None:
110-
# validate was introduced in py3.8 so we need to only provide it if the user provided it
111-
_kwargs["validate"] = validate
112-
super().__init__( # type: ignore[call-arg]
113-
fmt=fmt, datefmt=datefmt, style=style, **_kwargs # type: ignore[arg-type]
114-
)
108+
# validate was introduced in py3.8 so we need to only provide it if the user provided it
109+
if sys.version_info >= (3, 8) and validate is not None:
110+
super().__init__(
111+
fmt=fmt, datefmt=datefmt, style=style, validate=validate,
112+
)
113+
else:
114+
super().__init__(
115+
fmt=fmt, datefmt=datefmt, style=style,
116+
)
115117

116118
if stack_trace_limit is not None:
117119
if not isinstance(stack_trace_limit, int):

noxfile.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,5 @@ def lint(session):
5858
"mypy",
5959
"--strict",
6060
"--show-error-codes",
61-
"--no-warn-unused-ignores",
6261
"ecs_logging/",
6362
)

0 commit comments

Comments
 (0)