Skip to content

Commit

Permalink
Update pre-commit hooks and ruff config
Browse files Browse the repository at this point in the history
  • Loading branch information
JWCook committed Apr 12, 2024
1 parent ae87dfd commit 3268276
Show file tree
Hide file tree
Showing 11 changed files with 21 additions and 6 deletions.
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v4.6.0
hooks:
- id: check-toml
- id: check-yaml
- id: end-of-file-fixer
- id: mixed-line-ending
- id: trailing-whitespace
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.2.1
rev: v0.3.7
hooks:
- id: ruff
args: [--fix]
- id: ruff-format
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.8.0
rev: v1.9.0
hooks:
- id: mypy
additional_dependencies: [attrs, aiohttp, types-aiofiles, types-redis]
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.1.0
rev: v4.0.0-alpha.8
hooks:
- id: prettier
10 changes: 8 additions & 2 deletions aiohttp_client_cache/backends/sqlite.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@

import aiosqlite

from aiohttp_client_cache.backends import BaseCache, CacheBackend, ResponseOrKey, get_valid_kwargs
from aiohttp_client_cache.backends import (
BaseCache,
CacheBackend,
ResponseOrKey,
get_valid_kwargs,
)

bulk_commit_var: ContextVar[bool] = ContextVar('bulk_commit', default=False)

Expand Down Expand Up @@ -163,7 +168,8 @@ async def bulk_delete(self, keys: set):
async with self.get_connection(commit=True) as db:
placeholders = ', '.join('?' for _ in keys)
await db.execute(
f'DELETE FROM `{self.table_name}` WHERE key IN ({placeholders})', tuple(keys)
f'DELETE FROM `{self.table_name}` WHERE key IN ({placeholders})',
tuple(keys),
)

async def delete(self, key: str):
Expand Down
1 change: 1 addition & 0 deletions aiohttp_client_cache/cache_control.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Utilities for determining cache expiration and other cache actions"""

from __future__ import annotations

import sys
Expand Down
1 change: 1 addition & 0 deletions aiohttp_client_cache/cache_keys.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Functions for creating keys used for cache requests"""

from __future__ import annotations

import hashlib
Expand Down
1 change: 1 addition & 0 deletions aiohttp_client_cache/session.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Core functions for cache configuration"""

from __future__ import annotations
from functools import lru_cache
import sys
Expand Down
1 change: 1 addition & 0 deletions aiohttp_client_cache/signatures.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
* Type annotations
* Argument docs
"""

from __future__ import annotations

import inspect
Expand Down
1 change: 1 addition & 0 deletions examples/log_requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"""
An example of testing the cache to prove that it's not making more requests than expected.
"""

import asyncio
from contextlib import asynccontextmanager
from logging import basicConfig, getLogger
Expand Down
1 change: 1 addition & 0 deletions examples/precache.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
Completed run in 0.436 seconds and cached 0.000 MB
```
"""

import asyncio
import re
import sys
Expand Down
1 change: 1 addition & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* 'lint' command: tools and environments are managed by pre-commit
* All other commands: the current environment will be used instead of creating new ones
"""

from os.path import join
from pathlib import Path
from shutil import rmtree
Expand Down
1 change: 1 addition & 0 deletions test/integration/base_backend_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Common tests to run for all backends"""

from __future__ import annotations
import asyncio
import pickle
Expand Down
1 change: 1 addition & 0 deletions test/unit/test_cache_keys.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""The cache_keys module is mostly covered indirectly via other tests.
This just contains tests for some extra edge cases not covered elsewhere.
"""

from __future__ import annotations

from copy import copy
Expand Down

0 comments on commit 3268276

Please sign in to comment.