Skip to content

Commit 6de95e8

Browse files
ruff: enable isort (#194)
* ruff: enable `isort` * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 47440f2 commit 6de95e8

9 files changed

Lines changed: 21 additions & 23 deletions

File tree

cachier/__init__.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1+
from ._version import * # noqa: F403
12
from .core import (
23
cachier,
3-
set_default_params,
4-
get_default_params,
5-
enable_caching,
64
disable_caching,
5+
enable_caching,
6+
get_default_params,
7+
set_default_params,
78
)
89

9-
from ._version import * # noqa: F403
10-
1110
__all__ = [
1211
"cachier",
1312
"set_default_params",

cachier/_version.py

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

1717

1818
def _get_git_sha() -> str:
19-
from subprocess import check_output, DEVNULL
19+
from subprocess import DEVNULL, check_output
2020

2121
out = check_output(["git", "rev-parse", "--short", "HEAD"], stderr=DEVNULL) # noqa: S603, S607
2222
return out.decode("utf-8").strip()

cachier/cores/mongo.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,19 @@
77
# http://www.opensource.org/licenses/MIT-license
88
# Copyright (c) 2016, Shay Palachy <shaypal5@gmail.com>
99

10-
import sys # to make sure that pymongo was imported
1110
import pickle # for serialization of python objects
12-
from contextlib import suppress
13-
from datetime import datetime
11+
import sys # to make sure that pymongo was imported
1412
import time # to sleep when waiting on Mongo cache\
1513
import warnings # to warn if pymongo is missing
14+
from contextlib import suppress
15+
from datetime import datetime
1616

1717
with suppress(ImportError):
18-
from pymongo import IndexModel, ASCENDING
19-
from pymongo.errors import OperationFailure
2018
from bson.binary import Binary # to save binary data to mongodb
19+
from pymongo import ASCENDING, IndexModel
20+
from pymongo.errors import OperationFailure
2121

22-
from .base import _BaseCore, RecalculationNeeded
23-
22+
from .base import RecalculationNeeded, _BaseCore
2423

2524
MONGO_SLEEP_DURATION_IN_SEC = 1
2625

cachier/cores/pickle.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,15 @@
88
# Copyright (c) 2016, Shay Palachy <shaypal5@gmail.com>
99
import os
1010
import pickle # for local caching
11+
import threading
1112
from contextlib import suppress
1213
from datetime import datetime
13-
import threading
1414

1515
import portalocker # to lock on pickle cache IO
16-
from watchdog.observers import Observer
1716
from watchdog.events import PatternMatchingEventHandler
17+
from watchdog.observers import Observer
1818

1919
# Alternative: https://github.com/WoLpH/portalocker
20-
2120
from .base import _BaseCore
2221

2322

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ lint.select = [
4040
"E",
4141
"W", # see: https://pypi.org/project/pycodestyle
4242
"F", # see: https://pypi.org/project/pyflakes
43-
# "I", #see: https://pypi.org/project/isort/
43+
"I", #see: https://pypi.org/project/isort/
4444
# "D", # see: https://pypi.org/project/pydocstyle
4545
# "N", # see: https://pypi.org/project/pep8-naming
4646
"S", # see: https://pypi.org/project/flake8-bandit

setup.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@
99
# Copyright (c) 2024, Jirka Borovec <***@gmail.com>
1010

1111
import os.path
12-
from importlib.util import spec_from_file_location, module_from_spec
13-
from setuptools import setup, find_packages
12+
from importlib.util import module_from_spec, spec_from_file_location
13+
1414
from pkg_resources import parse_requirements
15+
from setuptools import find_packages, setup
1516

1617
_PATH_HERE = os.path.dirname(__file__)
1718

tests/standalone_script.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
import cachier
21
import time
32

3+
import cachier
4+
45

56
@cachier.cachier()
67
def _takes_3_seconds(label, value):

tests/test_memory_core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
from random import random
88
from time import sleep, time
99

10-
import pytest
1110
import pandas as pd
11+
import pytest
1212

1313
from cachier import cachier
1414

tests/test_mongo_core.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111
from time import sleep
1212
from urllib.parse import quote_plus
1313

14-
from birch import Birch # type: ignore[import-not-found]
1514
import pandas as pd
1615
import pymongo
1716
import pytest
17+
from birch import Birch # type: ignore[import-not-found]
1818
from pymongo.errors import OperationFailure
1919
from pymongo.mongo_client import MongoClient
2020
from pymongo_inmemory import MongoClient as InMemoryMongoClient
@@ -23,7 +23,6 @@
2323
from cachier.cores.base import RecalculationNeeded
2424
from cachier.cores.mongo import _MongoCore
2525

26-
2726
# === Enables testing vs a real MongoDB instance ===
2827

2928

0 commit comments

Comments
 (0)