Skip to content

Commit 11b4488

Browse files
authored
Merge branch 'main' into support_oxford_comma
2 parents fca339d + 041c66b commit 11b4488

File tree

19 files changed

+254
-129
lines changed

19 files changed

+254
-129
lines changed

.flake8

Lines changed: 0 additions & 7 deletions
This file was deleted.

.github/workflows/constraints.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
pip==24.0
2-
virtualenv==20.28.0
1+
pip==24.3.1
2+
virtualenv==20.29.0

.github/workflows/tests.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,10 @@ jobs:
1818
- { python: "3.11", os: "ubuntu-latest", session: "mypy" }
1919
- { python: "3.10", os: "ubuntu-latest", session: "mypy" }
2020
- { python: "3.9", os: "ubuntu-latest", session: "mypy" }
21-
- { python: "3.8", os: "ubuntu-latest", session: "mypy" }
2221
- { python: "3.12", os: "ubuntu-latest", session: "tests" }
2322
- { python: "3.11", os: "ubuntu-latest", session: "tests" }
2423
- { python: "3.10", os: "ubuntu-latest", session: "tests" }
2524
- { python: "3.9", os: "ubuntu-latest", session: "tests" }
26-
- { python: "3.8", os: "ubuntu-latest", session: "tests" }
2725
- { python: "3.12", os: "windows-latest", session: "tests" }
2826
- { python: "3.12", os: "macos-latest", session: "tests" }
2927
- { python: "3.12", os: "ubuntu-latest", session: "typeguard" }
@@ -124,12 +122,11 @@ jobs:
124122
mv coverage-data-3.11-ubuntu-latest/* .
125123
mv coverage-data-3.10-ubuntu-latest/* .
126124
mv coverage-data-3.9-ubuntu-latest/* .
127-
mv coverage-data-3.8-ubuntu-latest/* .
128125
hatch run coverage:run
129126
130127
- name: Create coverage report
131128
run: |
132129
hatch run coverage:run-xml
133130
134131
- name: Upload coverage report
135-
uses: codecov/codecov-action@v4
132+
uses: codecov/codecov-action@v5

.pre-commit-config.yaml

Lines changed: 7 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,4 @@
11
repos:
2-
# Modifiers
3-
- repo: https://github.com/psf/black
4-
rev: 24.10.0
5-
hooks:
6-
- id: black
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-
252
- repo: https://github.com/pre-commit/pre-commit-hooks
263
rev: v5.0.0
274
hooks:
@@ -33,15 +10,11 @@ repos:
3310
- id: check-yaml
3411
- id: end-of-file-fixer
3512

36-
- repo: https://github.com/pycqa/flake8
37-
rev: 7.1.1
38-
hooks:
39-
- id: flake8
40-
41-
# Static Checkers
42-
- repo: https://github.com/PyCQA/bandit
43-
rev: 1.7.10
13+
- repo: https://github.com/astral-sh/ruff-pre-commit
14+
# Ruff version.
15+
rev: v0.9.1
4416
hooks:
45-
- id: bandit
46-
additional_dependencies: [".[toml]"]
47-
args: ["-c", "bandit.yml"]
17+
# Run the linter.
18+
- id: ruff
19+
# Run the formatter.
20+
- id: ruff-format

.readthedocs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ sphinx:
33
configuration: docs/conf.py
44
formats: all
55
python:
6-
version: 3.8
6+
version: 3.9
77
install:
88
- requirements: docs/requirements.txt
99
- path: .

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ Request features on the [Issue Tracker].
3737

3838
## How to set up your development environment
3939

40-
You need Python 3.8+ and the following tools:
40+
You need Python 3.9+ and the following tools:
4141

4242
- [Hatch]
4343

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555

5656
## Requirements
5757

58-
- It works in Python 3.8+.
58+
- It works in Python 3.9+.
5959

6060
## Installation
6161

bandit.yml

Lines changed: 0 additions & 2 deletions
This file was deleted.

pyproject.toml

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,12 @@ license = {text = "MIT"}
99
readme = "README.md"
1010
classifiers = [
1111
"Development Status :: 5 - Production/Stable",
12-
"Programming Language :: Python :: 3.8",
1312
"Programming Language :: Python :: 3.9",
1413
"Programming Language :: Python :: 3.10",
1514
"Programming Language :: Python :: 3.11",
1615
"Programming Language :: Python :: 3.12",
1716
]
18-
requires-python = ">=3.8"
17+
requires-python = ">=3.9"
1918
dependencies = []
2019

2120
[tool.hatch.version]
@@ -58,21 +57,15 @@ run-xdoctest = [ "hatch run xdoctest:run" ]
5857
run-docs-build = [ "hatch run docs-build:run" ]
5958

6059
[[tool.hatch.envs.sessions.matrix]]
61-
python = ["3.8", "3.9", "3.10", "3.11", "3.12"]
60+
python = ["3.9", "3.10", "3.11", "3.12"]
6261

6362
[tool.hatch.envs.pre-commit]
6463
dependencies = [
65-
"bandit",
66-
"black",
67-
"flake8",
68-
"flake8-bugbear == 22.*",
69-
"flake8-docstrings",
70-
"isort",
71-
"pep8-naming",
64+
"ruff",
7265
"pre-commit",
7366
"pre-commit-hooks",
74-
"pyupgrade",
7567
]
68+
7669
[tool.hatch.envs.pre-commit.scripts]
7770
run = [
7871
"pre-commit run --all-files --show-diff-on-failure",
@@ -93,6 +86,7 @@ dependencies = [
9386
"pytest",
9487
"freezegun",
9588
]
89+
9690
[tool.hatch.envs.mypy.scripts]
9791
run = [
9892
"mypy src/ tests/ docs/conf.py",
@@ -106,6 +100,7 @@ dependencies = [
106100
"pygments",
107101
"freezegun",
108102
]
103+
109104
[tool.hatch.envs.tests.scripts]
110105
run = [
111106
"coverage run --parallel -m pytest"
@@ -115,11 +110,13 @@ run = [
115110
dependencies = [
116111
"coverage[toml]",
117112
]
113+
118114
[tool.hatch.envs.coverage.scripts]
119115
run = [
120116
"- coverage combine",
121117
"coverage report",
122118
]
119+
123120
run-xml = [
124121
"coverage xml"
125122
]
@@ -132,6 +129,7 @@ dependencies = [
132129
"typeguard",
133130
"pygments",
134131
]
132+
135133
[tool.hatch.envs.typeguard.scripts]
136134
run = [
137135
"pytest --typeguard-packages=human_readable",
@@ -141,6 +139,7 @@ run = [
141139
dependencies = [
142140
"xdoctest[colors]",
143141
]
142+
144143
[tool.hatch.envs.xdoctest.scripts]
145144
run = [
146145
"python -m xdoctest human_readable all",
@@ -152,6 +151,7 @@ dependencies = [
152151
"furo",
153152
"myst-parser",
154153
]
154+
155155
[tool.hatch.envs.docs-build.scripts]
156156
run = [
157157
"rm -rf docs/_build",
@@ -165,6 +165,7 @@ dependencies = [
165165
"furo",
166166
"myst-parser",
167167
]
168+
168169
[tool.hatch.envs.docs.scripts]
169170
run = [
170171
"rm -rf docs/_build",
@@ -183,10 +184,20 @@ source = ["human_readable", "tests"]
183184
show_missing = true
184185
fail_under = 100
185186

186-
[tool.isort]
187-
profile = "black"
188-
force_single_line = true
189-
lines_after_imports = 2
187+
[tool.ruff]
188+
line-length = 80
189+
190+
[tool.ruff.lint]
191+
select = ["B", "B9", "C", "D", "E", "F", "N", "W"]
192+
ignore = ["E203", "E501", "B905"]
193+
per-file-ignores = { "times.py" = ["N806"] }
194+
195+
[tool.ruff.lint.mccabe]
196+
max-complexity = 10
197+
198+
[tool.ruff.lint.isort]
199+
force-single-line = true
200+
lines-after-imports = 2
190201

191202
[tool.mypy]
192203
strict = true
@@ -196,7 +207,6 @@ show_column_numbers = true
196207
show_error_codes = true
197208
show_error_context = true
198209

199-
200210
[[tool.mypy.overrides]]
201211
module = ["pytest_mock"]
202212
ignore_missing_imports = true

src/human_readable/files.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,21 @@ def file_size(
2929
3030
Returns:
3131
str: file size in natural language.
32+
3233
"""
3334
if gnu:
3435
suffixes = ("K", "M", "G", "T", "P", "E", "Z", "Y")
3536
elif binary:
36-
suffixes = (" KiB", " MiB", " GiB", " TiB", " PiB", " EiB", " ZiB", " YiB")
37+
suffixes = (
38+
" KiB",
39+
" MiB",
40+
" GiB",
41+
" TiB",
42+
" PiB",
43+
" EiB",
44+
" ZiB",
45+
" YiB",
46+
)
3747
else:
3848
suffixes = (" KB", " MB", " GB", " TB", " PB", " EB", " ZB", " YB")
3949

0 commit comments

Comments
 (0)