Skip to content

Commit 0ab8e76

Browse files
authored
Merge pull request #195 from hugovk/fix-3.10
2 parents fdef1cb + d2d06f3 commit 0ab8e76

3 files changed

Lines changed: 18 additions & 18 deletions

File tree

.pre-commit-config.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/asottile/pyupgrade
3-
rev: v2.7.4
3+
rev: v2.12.0
44
hooks:
55
- id: pyupgrade
66
args: ["--py36-plus"]
@@ -12,31 +12,31 @@ repos:
1212
args: ["--target-version", "py36"]
1313

1414
- repo: https://github.com/PyCQA/isort
15-
rev: 5.6.4
15+
rev: 5.8.0
1616
hooks:
1717
- id: isort
1818

1919
- repo: https://gitlab.com/pycqa/flake8
20-
rev: 3.8.4
20+
rev: 3.9.0
2121
hooks:
2222
- id: flake8
2323
additional_dependencies: [flake8-2020, flake8-implicit-str-concat]
2424

2525
- repo: https://github.com/pre-commit/pygrep-hooks
26-
rev: v1.7.0
26+
rev: v1.8.0
2727
hooks:
2828
- id: python-check-blanket-noqa
2929

3030
- repo: https://github.com/pre-commit/pre-commit-hooks
31-
rev: v3.3.0
31+
rev: v3.4.0
3232
hooks:
3333
- id: check-merge-conflict
3434
- id: check-toml
3535
- id: check-yaml
3636
- id: end-of-file-fixer
3737

3838
- repo: https://github.com/PyCQA/pydocstyle
39-
rev: 5.1.1
39+
rev: 6.0.0
4040
hooks:
4141
- id: pydocstyle
4242
args: ["--convention", "google"]
@@ -48,6 +48,6 @@ repos:
4848
- id: tox-ini-fmt
4949

5050
- repo: https://github.com/asottile/setup-cfg-fmt
51-
rev: v1.15.1
51+
rev: v1.17.0
5252
hooks:
5353
- id: setup-cfg-fmt

setup.cfg

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,15 @@ include_package_data = True
4040
package_dir = =src
4141
zip_safe = False
4242

43+
[options.packages.find]
44+
where = src
45+
4346
[options.extras_require]
4447
tests =
4548
freezegun
4649
pytest
4750
pytest-cov
4851

49-
[options.packages.find]
50-
where = src
51-
5252
[flake8]
5353
max_line_length = 88
5454

src/humanize/time.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -335,17 +335,17 @@ def _suitable_minimum_unit(min_unit, suppress):
335335
If not suppressed, return the same unit:
336336
337337
>>> from humanize.time import _suitable_minimum_unit, Unit
338-
>>> _suitable_minimum_unit(Unit.HOURS, [])
339-
<Unit.HOURS: 4>
338+
>>> _suitable_minimum_unit(Unit.HOURS, []).name
339+
'HOURS'
340340
341341
But if suppressed, find a unit greather than the original one that is not
342342
suppressed:
343343
344-
>>> _suitable_minimum_unit(Unit.HOURS, [Unit.HOURS])
345-
<Unit.DAYS: 5>
344+
>>> _suitable_minimum_unit(Unit.HOURS, [Unit.HOURS]).name
345+
'DAYS'
346346
347-
>>> _suitable_minimum_unit(Unit.HOURS, [Unit.HOURS, Unit.DAYS])
348-
<Unit.MONTHS: 6>
347+
>>> _suitable_minimum_unit(Unit.HOURS, [Unit.HOURS, Unit.DAYS]).name
348+
'MONTHS'
349349
"""
350350
if min_unit in suppress:
351351
for unit in Unit:
@@ -363,8 +363,8 @@ def _suppress_lower_units(min_unit, suppress):
363363
"""Extend suppressed units (if any) with all units lower than the minimum unit.
364364
365365
>>> from humanize.time import _suppress_lower_units, Unit
366-
>>> list(sorted(_suppress_lower_units(Unit.SECONDS, [Unit.DAYS])))
367-
[<Unit.MICROSECONDS: 0>, <Unit.MILLISECONDS: 1>, <Unit.DAYS: 5>]
366+
>>> [x.name for x in sorted(_suppress_lower_units(Unit.SECONDS, [Unit.DAYS]))]
367+
['MICROSECONDS', 'MILLISECONDS', 'DAYS']
368368
"""
369369
suppress = set(suppress)
370370
for u in Unit:

0 commit comments

Comments
 (0)