Skip to content

Commit

Permalink
add error codes to type ignore comments
Browse files Browse the repository at this point in the history
  • Loading branch information
gruebel committed Oct 8, 2022
1 parent 054749e commit d2ceb53
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
6 changes: 3 additions & 3 deletions arrow/arrow.py
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ def range(
yield current

values = [getattr(current, f) for f in cls._ATTRS]
current = cls(*values, tzinfo=tzinfo).shift( # type: ignore
current = cls(*values, tzinfo=tzinfo).shift( # type: ignore[misc]
**{frame_relative: relative_steps}
)

Expand Down Expand Up @@ -578,7 +578,7 @@ def span(
for _ in range(3 - len(values)):
values.append(1)

floor = self.__class__(*values, tzinfo=self.tzinfo) # type: ignore
floor = self.__class__(*values, tzinfo=self.tzinfo) # type: ignore[misc]

if frame_absolute == "week":
# if week_start is greater than self.isoweekday() go back one week by setting delta = 7
Expand Down Expand Up @@ -1259,7 +1259,7 @@ def humanize(
)

if trunc(abs(delta)) != 1:
granularity += "s" # type: ignore
granularity += "s" # type: ignore[assignment]
return locale.describe(granularity, delta, only_distance=only_distance)

else:
Expand Down
6 changes: 3 additions & 3 deletions arrow/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ def __init__(self, locale: str = DEFAULT_LOCALE, cache_size: int = 0) -> None:
}
)
if cache_size > 0:
self._generate_pattern_re = lru_cache(maxsize=cache_size)( # type: ignore
self._generate_pattern_re = lru_cache(maxsize=cache_size)( # type: ignore[assignment]
self._generate_pattern_re
)

Expand Down Expand Up @@ -341,7 +341,7 @@ def parse(
f"Unable to find a match group for the specified token {token!r}."
)

self._parse_token(token, value, parts) # type: ignore
self._parse_token(token, value, parts) # type: ignore[arg-type]

return self._build_datetime(parts)

Expand Down Expand Up @@ -508,7 +508,7 @@ def _parse_token(

elif token in ["MMMM", "MMM"]:
# FIXME: month_number() is nullable
parts["month"] = self.locale.month_number(value.lower()) # type: ignore
parts["month"] = self.locale.month_number(value.lower()) # type: ignore[typeddict-item]

elif token in ["MM", "M"]:
parts["month"] = int(value)
Expand Down
3 changes: 3 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
[mypy]
python_version = 3.6

show_error_codes = True
pretty = True

allow_any_expr = True
allow_any_decorated = True
allow_any_explicit = True
Expand Down

0 comments on commit d2ceb53

Please sign in to comment.