Skip to content

Commit 32f39aa

Browse files
authored
Merge pull request #79 from azmeuk/pre-commit
pre-commit and linters configuration
2 parents aa13def + d64efb6 commit 32f39aa

File tree

15 files changed

+248
-174
lines changed

15 files changed

+248
-174
lines changed

.github/workflows/tests.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,9 @@ jobs:
4141
- run: make -C libfaketime/vendor/libfaketime
4242
if: runner.os == 'macOS'
4343
- run: tox -e ${{ matrix.python }}-${{ matrix.tz }} --recreate
44+
45+
style:
46+
runs-on: ubuntu-latest
47+
steps:
48+
- uses: actions/checkout@v4
49+
- uses: pre-commit/[email protected]

.pre-commit-config.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
repos:
3+
- repo: https://github.com/astral-sh/ruff-pre-commit
4+
rev: 'v0.4.3'
5+
hooks:
6+
- id: ruff
7+
args: [--fix, --exit-non-zero-on-fix]
8+
- id: ruff-format
9+
- repo: https://github.com/pre-commit/pre-commit-hooks
10+
rev: v4.6.0
11+
hooks:
12+
- id: fix-byte-order-marker
13+
- id: trailing-whitespace
14+
- id: end-of-file-fixer
15+
- id: check-toml
16+
- repo: https://github.com/PyCQA/docformatter
17+
rev: v1.7.5
18+
hooks:
19+
- id: docformatter

LICENSE

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,4 +337,3 @@ proprietary programs. If your program is a subroutine library, you may
337337
consider it more useful to permit linking proprietary applications with the
338338
library. If this is what you want to do, use the GNU Lesser General
339339
Public License instead of this License.
340-

benchmark.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22
import sys
33
import time
44

5+
from freezegun import freeze_time as freezegun_fake_time
6+
57
from libfaketime import fake_time as lft_fake_time
68
from libfaketime import reexec_if_needed
7-
from freezegun import freeze_time as freezegun_fake_time
89

910

1011
def sample(faker):
@@ -17,20 +18,20 @@ def sample(faker):
1718

1819
return time.perf_counter() - start
1920

20-
if __name__ == '__main__':
2121

22-
if len(sys.argv) > 1 and sys.argv[1] == 'freezegun':
22+
if __name__ == "__main__":
23+
if len(sys.argv) > 1 and sys.argv[1] == "freezegun":
2324
faker = freezegun_fake_time
2425
else:
2526
faker = lft_fake_time
2627
reexec_if_needed()
2728

2829
iterations = 1000
2930

30-
print("timing %s executions of %s" % (iterations, faker))
31+
print(f"timing {iterations} executions of {faker}")
3132

3233
sum = 0
3334
for _ in range(iterations):
3435
sum += sample(faker)
3536

36-
print(sum, 'seconds')
37+
print(sum, "seconds")

conftest.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import os
2+
23
import libfaketime
34

5+
46
def pytest_configure():
57
libfaketime.reexec_if_needed()
68
_, env_additions = libfaketime.get_reload_information()

0 commit comments

Comments
 (0)