Skip to content

Commit 15e53b0

Browse files
committed
Apply automated lint fixes
Apply automated fixes with `ruff check h bin tests --fix`.
1 parent f70eae2 commit 15e53b0

File tree

19 files changed

+20
-24
lines changed

19 files changed

+20
-24
lines changed

h/_version.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414

1515
def fetch_git_ref():
16-
return subprocess.check_output( # noqa: S603
16+
return subprocess.check_output(
1717
["git", "rev-parse", "--short", "HEAD"], # noqa: S607
1818
stderr=DEVNULL,
1919
).strip()
@@ -27,10 +27,10 @@ def fetch_git_date(ref):
2727
def fetch_git_dirty():
2828
# Ensure git index is up-to-date first. This usually isn't necessary, but
2929
# can be needed inside a docker container where the index is out of date.
30-
subprocess.call(["git", "update-index", "-q", "--refresh"]) # noqa: S603, S607
31-
dirty_tree = bool(subprocess.call(["git", "diff-files", "--quiet"])) # noqa: S603, S607
30+
subprocess.call(["git", "update-index", "-q", "--refresh"]) # noqa: S607
31+
dirty_tree = bool(subprocess.call(["git", "diff-files", "--quiet"])) # noqa: S607
3232
dirty_index = bool(
33-
subprocess.call(["git", "diff-index", "--quiet", "--cached", "HEAD"]) # noqa: S603, S607
33+
subprocess.call(["git", "diff-index", "--quiet", "--cached", "HEAD"]) # noqa: S607
3434
)
3535
return dirty_tree or dirty_index
3636

h/db/types.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""Custom SQLAlchemy types for use with the Annotations API database.""" # noqa: A005
1+
"""Custom SQLAlchemy types for use with the Annotations API database."""
22

33
import base64
44
import binascii

h/migrations/versions/58bb601c390f_fill_in_missing_denormalized_document_title.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def downgrade():
7171

7272

7373
def _document_title(document):
74-
for meta in document.meta_titles: # noqa: RET503
74+
for meta in document.meta_titles:
7575
if meta.value:
7676
return meta.value[0]
7777

h/migrations/versions/9f5e274b202c_update_all_document_web_uris.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class Document(Base):
3939

4040
def updated_web_uri(self):
4141
def first_http_url(type_=None):
42-
for document_uri in self.document_uris: # noqa: RET503
42+
for document_uri in self.document_uris:
4343
uri = document_uri.uri
4444
if type_ is not None and document_uri.type != type_:
4545
continue

h/migrations/versions/a44ef07b085a_fill_in_missing_denormalized_document_web_uri.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def downgrade():
6868

6969

7070
def _document_web_uri(document):
71-
for docuri in document.document_uris: # noqa: RET503
71+
for docuri in document.document_uris:
7272
uri = urlparse(docuri.uri)
7373
if uri.scheme in ["http", "https"]:
7474
return docuri.uri

h/models/document/_document.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def first_http_url(type_=None):
5656
If no type is given just return this document's first http(s)
5757
URL, or None.
5858
"""
59-
for document_uri in self.document_uris: # noqa: RET503
59+
for document_uri in self.document_uris:
6060
uri = document_uri.uri
6161
if type_ is not None and document_uri.type != type_:
6262
continue

h/models/token.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import datetime # noqa: A005
1+
import datetime
22
from typing import TYPE_CHECKING
33

44
import sqlalchemy

h/security/encryption.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def derive_key(key_material: str | bytes, salt: bytes, info: bytes) -> bytes:
4040
key_material = key_material.encode()
4141

4242
return cast(
43-
bytes,
43+
"bytes",
4444
HKDF(
4545
master=key_material,
4646
key_len=64,

h/services/email.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# noqa: A005
2-
31
import smtplib
42
from dataclasses import dataclass
53
from datetime import UTC, datetime, timedelta

h/services/flag.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ def flag_counts(self, annotation_ids):
128128

129129
flag_counts = {f.annotation_id: f.flag_count for f in query}
130130
missing_ids = set(annotation_ids) - set(flag_counts.keys())
131-
flag_counts.update({id_: 0 for id_ in missing_ids})
131+
flag_counts.update(dict.fromkeys(missing_ids, 0))
132132

133133
# Prime the cache for `flag_count()`
134134
self._flag_count_cache.update(flag_counts)

0 commit comments

Comments
 (0)