Skip to content

Commit 6d5049a

Browse files
cclausswoodruffw
andauthored
GitHub Action to spellcheck and lint Python code (#333)
* GitHub Action to spellcheck and lint Python code * Update pyproject.toml Co-authored-by: William Woodruff <[email protected]> * $(VENV)/bin/ruff check --fix * exclude: python-version: "3.7" on os: "macos-latest" * Update tests.yml * Allow Python 3.7 on ARM to crash --------- Co-authored-by: William Woodruff <[email protected]>
1 parent 0e091c6 commit 6d5049a

17 files changed

+28
-19
lines changed

Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ bootstrap: $(VENV)/bin/pip
1313
$(VENV)/bin/pip install -e .[dev]
1414

1515
format:
16-
$(VENV)/bin/black .
16+
$(VENV)/bin/codespell
17+
$(VENV)/bin/ruff check --fix
18+
$(VENV)/bin/ruff format
1719

1820
doc: $(VENV)/bin/sphinx-build
1921
. $(ACTIVATE);

cachecontrol/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
77
Make it easy to import from cachecontrol without long namespaces.
88
"""
9+
910
__author__ = "Eric Larson"
1011
__email__ = "[email protected]"
1112
__version__ = "0.14.0"

cachecontrol/cache.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
The cache object API for implementing caches. The default is a thread
77
safe in-memory dictionary.
88
"""
9+
910
from __future__ import annotations
1011

1112
from threading import Lock

cachecontrol/caches/file_cache.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import hashlib
77
import os
88
from textwrap import dedent
9-
from typing import IO, TYPE_CHECKING, Union
9+
from typing import IO, TYPE_CHECKING
1010
from pathlib import Path
1111

1212
from cachecontrol.cache import BaseCache, SeparateBodyBaseCache

cachecontrol/controller.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"""
66
The httplib2 algorithms ported for use with requests.
77
"""
8+
89
from __future__ import annotations
910

1011
import calendar

cachecontrol/filewrapper.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ def __init__(
3838
self.__callback = callback
3939

4040
def __getattr__(self, name: str) -> Any:
41-
# The vaguaries of garbage collection means that self.__fp is
41+
# The vagaries of garbage collection means that self.__fp is
4242
# not always set. By using __getattribute__ and the private
4343
# name[0] allows looking up the attribute value and raising an
44-
# AttributeError when it doesn't exist. This stop thigns from
44+
# AttributeError when it doesn't exist. This stop things from
4545
# infinitely recursing calls to getattr in the case where
4646
# self.__fp hasn't been set.
4747
#

cachecontrol/heuristics.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,10 @@ def update_headers(self, response: HTTPResponse) -> dict[str, str]:
6868

6969
if "expires" not in response.headers:
7070
date = parsedate(response.headers["date"])
71-
expires = expire_after(timedelta(days=1), date=datetime(*date[:6], tzinfo=timezone.utc)) # type: ignore[index,misc]
71+
expires = expire_after(
72+
timedelta(days=1),
73+
date=datetime(*date[:6], tzinfo=timezone.utc), # type: ignore[index,misc]
74+
)
7275
headers["expires"] = datetime_to_header(expires)
7376
headers["cache-control"] = "public"
7477
return headers

docs/etags.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ expired.
1818
In CacheControl the default behavior when an ETag is sent by the
1919
server is to cache the response. We'll refer to this pattern as a
2020
**Equal Priority** cache as the decision to cache is either time base or
21-
due to the presense of an ETag.
21+
due to the presence of an ETag.
2222

2323
The spec is not explicit what takes priority when caching with both
2424
ETags and time based headers. Therefore, CacheControl supports the

docs/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ effort to faithfully port the tests from httplib2 to CacheControl, but
6666
there is a decent chance that I've missed something. Please file bugs
6767
if you find any issues!
6868

69-
With that in mind, CacheControl has been used sucessfully in
69+
With that in mind, CacheControl has been used successfully in
7070
production environments, replacing httplib2's usage.
7171

7272
If you give it a try, please let me know of any issues.

docs/tips.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ response.
4343

4444
With that in mind, you should be aware that if you try to cache a very
4545
large response on a network store, you still might have some latency
46-
tranferring the data from the network store to your
46+
transferring the data from the network store to your
4747
application. Another consideration is storing large responses in a
4848
`FileCache`. If you are caching using ETags and the server is
4949
extremely specific as to what constitutes an equivalent request, it

0 commit comments

Comments
 (0)