Skip to content

Commit

Permalink
Merge branch 'master' into upgrade-deps
Browse files Browse the repository at this point in the history
  • Loading branch information
krisfremen committed Oct 19, 2022
2 parents 9fcdd6f + 356035a commit 0d7fc53
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ repos:
- id: flake8
additional_dependencies: [flake8-bugbear,flake8-annotations]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: 'v0.950'
rev: v0.982
hooks:
- id: mypy
additional_dependencies: [types-python-dateutil]
4 changes: 2 additions & 2 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ After 8 years we're pleased to announce Arrow v1.0. Thanks to the entire Python
- [FIX] Consolidated and simplified German locales.
- [INTERNAL] Moved testing suite from nosetest/Chai to pytest/pytest-mock.
- [INTERNAL] Converted xunit-style setup and teardown functions in tests to pytest fixtures.
- [INTERNAL] Setup Github Actions for CI alongside Travis.
- [INTERNAL] Setup GitHub Actions for CI alongside Travis.
- [INTERNAL] Help support Arrow's future development by donating to the project on `Open Collective <https://opencollective.com/arrow>`_.

0.15.5 (2020-01-03)
Expand Down Expand Up @@ -659,7 +659,7 @@ The following will work in v0.15.0:
- [NEW] Brazilian locale (Augusto2112)
- [NEW] Dutch locale (OrangeTux)
- [NEW] Italian locale (Pertux)
- [NEW] Austrain locale (LeChewbacca)
- [NEW] Austrian locale (LeChewbacca)
- [NEW] Tagalog locale (Marksteve)
- [FIX] Corrected spelling and day numbers in German locale (LeChewbacca)
- [FIX] Factory ``get`` method should now handle unicode strings correctly (Bwells)
Expand Down
10 changes: 5 additions & 5 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 Expand Up @@ -1314,7 +1314,7 @@ def gather_timeframes(_delta: float, _frame: TimeFrameLiteral) -> float:

def dehumanize(self, input_string: str, locale: str = "en_us") -> "Arrow":
"""Returns a new :class:`Arrow <arrow.arrow.Arrow>` object, that represents
the time difference relative to the attrbiutes of the
the time difference relative to the attributes of the
:class:`Arrow <arrow.arrow.Arrow>` object.
:param timestring: a ``str`` representing a humanized relative time.
Expand Down Expand Up @@ -1419,7 +1419,7 @@ def dehumanize(self, input_string: str, locale: str = "en_us") -> "Arrow":
# Assert error if string does not modify any units
if not any([True for k, v in unit_visited.items() if v]):
raise ValueError(
"Input string not valid. Note: Some locales do not support the week granulairty in Arrow. "
"Input string not valid. Note: Some locales do not support the week granularity in Arrow. "
"If you are attempting to use the week granularity on an unsupported locale, this could be the cause of this error."
)

Expand Down
1 change: 1 addition & 0 deletions arrow/locales.py
Original file line number Diff line number Diff line change
Expand Up @@ -4121,6 +4121,7 @@ def _ordinal_number(self, n: int) -> str:
return f"{n}র্থ"
if n == 6:
return f"{n}ষ্ঠ"
return ""


class RomanshLocale(Locale):
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
4 changes: 2 additions & 2 deletions tests/test_arrow.py
Original file line number Diff line number Diff line change
Expand Up @@ -2295,8 +2295,8 @@ def test_empty_granularity_list(self):
arw.humanize(later, granularity=[])

# Bulgarian is an example of a language that overrides _format_timeframe
# Applicabale to all locales. Note: Contributors need to make sure
# that if they override describe or describe_mutli, that delta
# Applicable to all locales. Note: Contributors need to make sure
# that if they override describe or describe_multi, that delta
# is truncated on call

def test_no_floats(self):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_locales.py
Original file line number Diff line number Diff line change
Expand Up @@ -1394,7 +1394,7 @@ def test_ordinal_number(self):
assert self.locale._ordinal_number(10) == "10ম"
assert self.locale._ordinal_number(11) == "11তম"
assert self.locale._ordinal_number(42) == "42তম"
assert self.locale._ordinal_number(-1) is None
assert self.locale._ordinal_number(-1) == ""


@pytest.mark.usefixtures("lang_locale")
Expand Down
4 changes: 2 additions & 2 deletions tests/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -917,9 +917,9 @@ def test_timestamp_milli(self):

def test_time(self):
time_re = parser.DateTimeParser._TIME_RE
time_seperators = [":", ""]
time_separators = [":", ""]

for sep in time_seperators:
for sep in time_separators:
assert time_re.findall("12") == [("12", "", "", "", "")]
assert time_re.findall(f"12{sep}35") == [("12", "35", "", "", "")]
assert time_re.findall("12{sep}35{sep}46".format(sep=sep)) == [
Expand Down

0 comments on commit 0d7fc53

Please sign in to comment.