Skip to content

Commit 9db0462

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent c3ae27e commit 9db0462

5 files changed

Lines changed: 34 additions & 32 deletions

File tree

pyproject.toml

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@ dependencies = [
4848
"watchdog>=2.3.1",
4949
]
5050
urls.Source = "https://github.com/python-cachier/cachier"
51-
scripts.cachier = "cachier.__main__:cli"
52-
5351
# --- setuptools ---
5452

53+
scripts.cachier = "cachier.__main__:cli"
54+
5555
[tool.setuptools]
5656
include-package-data = true
5757

@@ -67,13 +67,13 @@ include = [
6767
] # package names should match these glob patterns (["*"] by default)
6868
namespaces = false # to disable scanning PEP 420 namespaces (true by default)
6969

70-
7170
# === Linting & Formatting ===
7271

7372
[tool.black]
7473
line-length = 79
7574

7675
# --- ruff ---
76+
7777
[tool.ruff]
7878
target-version = "py38"
7979
line-length = 79
@@ -130,6 +130,7 @@ lint.unfixable = [
130130
"F401",
131131
]
132132

133+
# --- pylint ---
133134
#[tool.ruff.pydocstyle]
134135
## Use Google-style docstrings.
135136
#convention = "google"
@@ -138,23 +139,8 @@ lint.unfixable = [
138139
# Unlike Flake8, default to a complexity level of 10.
139140
lint.mccabe.max-complexity = 10
140141

141-
# --- pylint ---
142-
[tool.pylint.'MAIN']
143-
ignore = ["CVS"]
144-
load-plugins = ["pylint.extensions.docparams"]
145-
146-
[tool.pylint.'FORMAT']
147-
good-names = ["x", "y", "X", "inter_X", "inter_y", "post_X", "post_y"]
148-
149-
[tool.pylint.'DESIGN']
150-
exclude-too-few-public-methods = [".+"]
151-
152-
[tool.pylint.'MESSAGES CONTROL']
153-
disable = ["R0911", "R0913", "R0903"]
154-
155-
# --- flake8 ---
156142
[tool.flake8]
157-
ignore = ["C901", "E203", "W503"]
143+
ignore = [ "C901", "E203", "W503" ]
158144
exclude = [
159145
".git",
160146
".github",
@@ -176,17 +162,33 @@ max-complexity = 10
176162
max-line-length = 100
177163

178164
# --- docformatter ---
165+
166+
[tool.pylint.'MAIN']
167+
ignore = [ "CVS" ]
168+
load-plugins = [ "pylint.extensions.docparams" ]
169+
170+
[tool.pylint.'FORMAT']
171+
good-names = [ "x", "y", "X", "inter_X", "inter_y", "post_X", "post_y" ]
172+
173+
[tool.pylint.'DESIGN']
174+
exclude-too-few-public-methods = [ ".+" ]
175+
176+
[tool.pylint.'MESSAGES CONTROL']
177+
disable = [ "R0911", "R0913", "R0903" ]
178+
179+
# --- flake8 ---
180+
179181
[tool.docformatter]
180182
recursive = true
181183
# some docstring start with r"""
182184
wrap-summaries = 79
183185
wrap-descriptions = 79
184186
blank = true
185187

186-
187188
# === Testing ===
188189

189190
# --- pytest ---
191+
190192
[tool.pytest.ini_options]
191193
testpaths = [
192194
"cachier",
@@ -211,6 +213,7 @@ markers = [
211213
]
212214

213215
# --- coverage ---
216+
214217
[tool.coverage.run]
215218
branch = true
216219
# dynamic_context = "test_function"

src/cachier/_version.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@
1818
def _get_git_sha() -> str:
1919
from subprocess import DEVNULL, check_output
2020

21-
out = check_output(
22-
["git", "rev-parse", "--short", "HEAD"], stderr=DEVNULL
23-
) # noqa: S603, S607
21+
out = check_output(["git", "rev-parse", "--short", "HEAD"], stderr=DEVNULL) # noqa: S603, S607
2422
return out.decode("utf-8").strip()
2523

2624

src/cachier/cores/mongo.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,7 @@ def get_entry_by_key(self, key: str) -> Tuple[str, Optional[CacheEntry]]:
7575
)
7676
if not res:
7777
return key, None
78-
val = (
79-
pickle.loads(res["value"]) if "value" in res else None
80-
) # noqa: S301
78+
val = pickle.loads(res["value"]) if "value" in res else None # noqa: S301
8179
entry = CacheEntry(
8280
value=val,
8381
time=res.get("time", None),

tests/test_general.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -485,9 +485,9 @@ def fn_minus(a, b=2):
485485
assert cachier_(dummy_)(1) == expected, f"for {fn.__name__} wrapped"
486486

487487
dummy_ = functools.partial(fn, b=2)
488-
assert (
489-
cachier_(dummy_)(1, b=2) == expected
490-
), f"for {fn.__name__} wrapped"
488+
assert cachier_(dummy_)(1, b=2) == expected, (
489+
f"for {fn.__name__} wrapped"
490+
)
491491

492492
assert cachier_(fn)(1, 2) == expected, f"for {fn.__name__} inline"
493493
assert cachier_(fn)(a=1, b=2) == expected, f"for {fn.__name__} inline"

tests/test_sql_core.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1+
import os
12
import queue
3+
import sys
24
import threading
35
from datetime import timedelta
46
from random import random
57
from time import sleep
6-
import sys
7-
import os
88

99
import pytest
1010

@@ -167,14 +167,17 @@ def fail_set_entry(self, key, func_res):
167167
def test_import_cachier_without_sqlalchemy(monkeypatch):
168168
"""Test that importing cachier works when SQLAlchemy is missing.
169169
170-
This should work unless SQL core is used."""
170+
This should work unless SQL core is used.
171+
172+
"""
171173
# Simulate SQLAlchemy not installed
172174
modules_backup = sys.modules.copy()
173175
sys.modules["sqlalchemy"] = None
174176
sys.modules["sqlalchemy.orm"] = None
175177
sys.modules["sqlalchemy.engine"] = None
176178
try:
177179
import importlib # noqa: F401
180+
178181
import cachier # noqa: F401
179182

180183
# Should import fine

0 commit comments

Comments
 (0)