Skip to content

Commit a672c24

Browse files
author
redjax
committed
lint, format: Run linter & formatter
1 parent 6c5fe65 commit a672c24

File tree

26 files changed

+24
-38
lines changed

26 files changed

+24
-38
lines changed

red_utils/__init__.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,13 @@
33
import pkgutil
44

55
## Import modules with only stdlib dependencies directly
6-
from .context_managers import DictProtect, ListProtect, SQLiteConnManager
7-
from .context_managers import async_benchmark, benchmark
6+
from .context_managers import (
7+
DictProtect,
8+
ListProtect,
9+
SQLiteConnManager,
10+
async_benchmark,
11+
benchmark,
12+
)
813
from .dict_utils import debug_dict, merge_dicts, update_dict, validate_dict
914
from .file_utils import crawl_dir, default_json_dir, export_json, ts
1015
from .hash_utils import get_hash_from_str
@@ -24,7 +29,6 @@
2429
trim_uuid,
2530
)
2631

27-
2832
## Use pkgutil to only load modules
2933
# if dependencies are met
3034
if pkgutil.find_loader("diskcache"):
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from __future__ import annotations
22

33
from .benchmarks import async_benchmark, benchmark
4+
from .database_managers.sqlite_managers import SQLiteConnManager
45
from .object_managers.protect import DictProtect, ListProtect
5-
from .database_managers.sqlite_managers import SQLiteConnManager

red_utils/context_managers/benchmarks/fn_benchmarks.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
from contextlib import asynccontextmanager, contextmanager
44
import time
55

6-
76
@contextmanager
87
def benchmark(description: str = "Unnamed function timer") -> None:
98
"""Time a function call.
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
from .sqlite_managers import SQLiteConnManager
1+
from __future__ import annotations
2+
3+
from .sqlite_managers import SQLiteConnManager

red_utils/context_managers/database_managers/sqlite_managers.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
"""
2-
Context manager utilities for interacting with SQLite databases, using
1+
"""Context manager utilities for interacting with SQLite databases, using
32
the stdlib sqlite3 library.
43
"""
54
from __future__ import annotations
@@ -11,14 +10,14 @@
1110

1211
class SQLiteConnManager:
1312
"""Handle interactions with a SQLite database.
14-
13+
1514
Uses built-in functions to query a database, execute SQL statements,
1615
and gracefully open/close the DB using context managers.
17-
16+
1817
Usage:
1918
Provide a path string to the SQLite database:
2019
sqlite_connection = SQLiteConnManager(path="/path/to/db.sqlite")
21-
20+
2221
Call sqlite3 functions, i.e. "get_tables()":
2322
tables = sqlite_conn.get_tables()
2423
"""

red_utils/context_managers/object_managers/protect.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import inspect
55
import json
66

7-
87
class ListProtect:
98
"""Protect a list during modification by modifying a copy instead of the original.
109

red_utils/dict_utils/operations.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
from .validators import validate_dict
66

7-
87
def debug_dict(in_dict: dict = None) -> None:
98
"""Debug print a dict by looping overkeys and printing.
109

red_utils/dict_utils/validators.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from __future__ import annotations
22

3-
43
def validate_dict(_dict: dict[str, str] = None) -> dict[str, str]:
54
if not _dict:
65
raise ValueError("Missing dict to evaluate")

red_utils/diskcache_utils/operations.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030

3131
from diskcache import Cache
3232

33-
3433
def convert_to_seconds(unit: str = None, amount: int = None) -> int:
3534
## Allowed strings for conversion
3635
valid_time_units: list[int] = ["seconds", "hours", "minutes", "days", "weeks"]

red_utils/diskcache_utils/validators.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
from diskcache import Cache
1111

12-
1312
def validate_key(key: valid_key_types = None, none_ok: bool = False) -> Union[str, int]:
1413
"""Validate input diskcache key.
1514

0 commit comments

Comments
 (0)