Skip to content

Commit 12ea25c

Browse files
committed
Merge pull request #695 from zwimer/fix/694-pre-commit
Fix/694 pre commit
2 parents 34fb04e + 696ea0a commit 12ea25c

20 files changed

+81
-63
lines changed

.pre-commit-config.yaml

+38-57
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,47 @@
11
repos:
2-
- repo: local
2+
# Modifiers
3+
- repo: https://github.com/psf/black
4+
rev: 24.10.0
35
hooks:
4-
- id: bandit
5-
name: bandit
6-
entry: bandit
7-
language: system
8-
types: [python]
9-
require_serial: true
10-
args: ["-c", "bandit.yml"]
116
- id: black
12-
name: black
13-
entry: black
14-
language: system
15-
types: [python]
16-
require_serial: true
7+
8+
- repo: https://github.com/pre-commit/mirrors-prettier
9+
rev: v4.0.0-alpha.8
10+
hooks:
11+
- id: prettier
12+
13+
- repo: https://github.com/asottile/pyupgrade
14+
rev: v3.19.0
15+
hooks:
16+
- id: pyupgrade
17+
args: [--py38-plus]
18+
19+
- repo: https://github.com/pycqa/isort
20+
rev: 5.13.2
21+
hooks:
22+
- id: isort
23+
args: ["--filter-files"]
24+
25+
- repo: https://github.com/pre-commit/pre-commit-hooks
26+
rev: v5.0.0
27+
hooks:
28+
# Modifiers
29+
- id: trailing-whitespace
30+
# Static Checkers
1731
- id: check-added-large-files
18-
name: Check for added large files
19-
entry: check-added-large-files
20-
language: system
2132
- id: check-toml
22-
name: Check Toml
23-
entry: check-toml
24-
language: system
25-
types: [toml]
2633
- id: check-yaml
27-
name: Check Yaml
28-
entry: check-yaml
29-
language: system
30-
types: [yaml]
3134
- id: end-of-file-fixer
32-
name: Fix End of Files
33-
entry: end-of-file-fixer
34-
language: system
35-
types: [text]
36-
stages: [commit, push, manual]
35+
36+
- repo: https://github.com/pycqa/flake8
37+
rev: 7.1.1
38+
hooks:
3739
- id: flake8
38-
name: flake8
39-
entry: flake8
40-
language: system
41-
types: [python]
42-
require_serial: true
43-
- id: isort
44-
name: isort
45-
entry: isort
46-
require_serial: true
47-
language: system
48-
types_or: [cython, pyi, python]
49-
args: ["--filter-files"]
50-
- id: pyupgrade
51-
name: pyupgrade
52-
description: Automatically upgrade syntax for newer versions.
53-
entry: pyupgrade
54-
language: system
55-
types: [python]
56-
args: [--py38-plus]
57-
- id: trailing-whitespace
58-
name: Trim Trailing Whitespace
59-
entry: trailing-whitespace-fixer
60-
language: system
61-
types: [text]
62-
stages: [commit, push, manual]
63-
- repo: https://github.com/pre-commit/mirrors-prettier
64-
rev: v2.1.2
40+
41+
# Static Checkers
42+
- repo: https://github.com/PyCQA/bandit
43+
rev: 1.7.10
6544
hooks:
66-
- id: prettier
45+
- id: bandit
46+
additional_dependencies: [".[toml]"]
47+
args: ["-c", "bandit.yml"]

docs/conf.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Sphinx configuration."""
2+
23
from datetime import datetime
34

45

src/human_readable/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Human Readable."""
2+
23
from human_readable.files import file_size
34
from human_readable.i18n import activate
45
from human_readable.i18n import deactivate

src/human_readable/i18n.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Activate, get and deactivate translations."""
2+
23
from __future__ import annotations
34

45
import gettext as gettext_module

src/human_readable/lists.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Tests for lists humanization."""
2+
23
from __future__ import annotations
34

45

src/human_readable/numbers.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Humanizing functions for numbers."""
2+
23
from __future__ import annotations
34

45
import fractions

src/human_readable/times.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Time humanizing functions."""
2+
23
from __future__ import annotations
34

45
import datetime as dt

tests/functional/conftest.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Fixtures for functional tests."""
2+
23
import pytest
34
from pytest_mock import MockerFixture
45

tests/functional/en_ABBR/test_numbers.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Tests for ru_RU numbers humanizing."""
2+
23
from pytest_mock import MockerFixture
34

45
import human_readable

tests/functional/en_ABBR/test_times.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Tests for time humanizing."""
2+
23
import datetime as dt
34

45
import pytest

tests/functional/fr_FR/test_numbers.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Tests for fr_FR numbers humanizing."""
2+
23
from pytest_mock import MockerFixture
34

45
import human_readable.numbers as numbers

tests/functional/pt_BR/test_numbers.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Tests for pt_BR numbers humanizing."""
2+
23
import pytest
34
from pytest_mock import MockerFixture
45

tests/functional/pt_BR/test_times.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Tests for pt_BR time humanizing."""
2+
23
from __future__ import annotations
34

45
import datetime as dt

tests/functional/ru_RU/test_numbers.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Tests for ru_RU numbers humanizing."""
2+
23
from pytest_mock import MockerFixture
34

45
import human_readable.numbers as numbers

tests/functional/ru_RU/test_times.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Tests for time humanizing."""
2+
23
import datetime as dt
34

45
from pytest_mock import MockerFixture

tests/unit/test_files.py

+25-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Tests for file size humanization."""
2+
23
from __future__ import annotations
34

45
import pytest
@@ -55,12 +56,30 @@ def test_file_size_gnu(params: tuple[int, bool, bool], expected: str) -> None:
5556
"params, expected",
5657
[
5758
((1, False, True, ".3f", ".1f"), "1.0B"), # unit number (small formatting)
58-
((999, False, False, ".3f", ".1f"), "999.0 Bytes"), # hundreds number (small formatting)
59-
((1000, False, False, ".3f", ".1f"), "1.000 KB"), # hundreds number (small formatting boundary)
60-
((1023, False, True, ".3f", ".1f"), "1023.0B"), # hundreds number (small formatting boundary)
61-
((1024, False, True, ".3f", ".1f"), "1.000K"), # hundreds number (small formatting boundary)
62-
((1023, True, False, ".3f", ".1f"), "1023.0 Bytes"), # hundreds number (small formatting boundary)
63-
((1024, True, False, ".3f", ".1f"), "1.000 KiB"), # hundreds number (small formatting boundary)
59+
(
60+
(999, False, False, ".3f", ".1f"),
61+
"999.0 Bytes",
62+
), # hundreds number (small formatting)
63+
(
64+
(1000, False, False, ".3f", ".1f"),
65+
"1.000 KB",
66+
), # hundreds number (small formatting boundary)
67+
(
68+
(1023, False, True, ".3f", ".1f"),
69+
"1023.0B",
70+
), # hundreds number (small formatting boundary)
71+
(
72+
(1024, False, True, ".3f", ".1f"),
73+
"1.000K",
74+
), # hundreds number (small formatting boundary)
75+
(
76+
(1023, True, False, ".3f", ".1f"),
77+
"1023.0 Bytes",
78+
), # hundreds number (small formatting boundary)
79+
(
80+
(1024, True, False, ".3f", ".1f"),
81+
"1.000 KiB",
82+
), # hundreds number (small formatting boundary)
6483
((2900000, False, True, ".3f"), "2.766M"), # millions number (large formatting)
6584
(
6685
(2000000000, True, False, ".3f"),

tests/unit/test_i18n.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Tests for i18n."""
2+
23
import pytest
34

45
import human_readable.i18n as i18n

tests/unit/test_lists.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Tests for listing humanization."""
2+
23
from __future__ import annotations
34

45
import pytest

tests/unit/test_numbers.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Tests for numbers humanizing."""
2+
23
from __future__ import annotations
34

45
import pytest

tests/unit/test_times.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Tests for time humanizing."""
2+
23
from __future__ import annotations
34

45
import datetime as dt

0 commit comments

Comments
 (0)