Skip to content

Commit

Permalink
Add # noqa: comments to suppress lint warnings
Browse files Browse the repository at this point in the history
This commit is just the result of running `make noqa`.
  • Loading branch information
seanh committed Jan 23, 2025
1 parent 2faf001 commit ecf4bf5
Show file tree
Hide file tree
Showing 86 changed files with 137 additions and 137 deletions.
2 changes: 1 addition & 1 deletion h/activity/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@


class ActivityResults(
namedtuple("ActivityResults", ["total", "aggregations", "timeframes"])
namedtuple("ActivityResults", ["total", "aggregations", "timeframes"]) # noqa: PYI024
):
pass

Expand Down
10 changes: 5 additions & 5 deletions h/cli/commands/normalize_uris.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from h.util import uri


class Window(namedtuple("Window", ["start", "end"])):
class Window(namedtuple("Window", ["start", "end"])): # noqa: PYI024
pass


Expand Down Expand Up @@ -82,12 +82,12 @@ def _normalize_document_uris_window(session, window):
if existing.count() > 0:
session.delete(docuri)
else:
docuri._claimant_normalized = ( # pylint: disable=protected-access
docuri._claimant_normalized = ( # pylint: disable=protected-access # noqa: SLF001
uri.normalize(
docuri.claimant,
)
)
docuri._uri_normalized = uri.normalize( # pylint: disable=protected-access
docuri._uri_normalized = uri.normalize( # pylint: disable=protected-access # noqa: SLF001
docuri.uri,
)

Expand All @@ -111,7 +111,7 @@ def _normalize_document_meta_window(session, window):
if existing.count() > 0:
session.delete(docmeta)
else:
docmeta._claimant_normalized = ( # pylint: disable=protected-access
docmeta._claimant_normalized = ( # pylint: disable=protected-access # noqa: SLF001
uri.normalize(
docmeta.claimant,
)
Expand All @@ -131,7 +131,7 @@ def _normalize_annotations_window(session, window):
for annotation in query:
normalized = uri.normalize(annotation.target_uri)
if normalized != annotation.target_uri_normalized:
annotation._target_uri_normalized = ( # pylint: disable=protected-access
annotation._target_uri_normalized = ( # pylint: disable=protected-access # noqa: SLF001
normalized
)
ids.add(annotation.id)
Expand Down
2 changes: 1 addition & 1 deletion h/db/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from sqlalchemy.exc import DontWrapMixin


class InvalidUUID(Exception, DontWrapMixin):
class InvalidUUID(Exception, DontWrapMixin): # noqa: N818
pass


Expand Down
2 changes: 1 addition & 1 deletion h/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class InvalidUserId(Exception):
class InvalidUserId(Exception): # noqa: N818
"""The userid does not meet the expected pattern."""

def __init__(self, user_id):
Expand Down
2 changes: 1 addition & 1 deletion h/migrations/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from sqlalchemy import engine_from_config, pool

# Import all model modules here in order to populate the metadata
from h import db, models
from h import db, models # noqa: F401

# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def upgrade():

open_groups = db.scalars(
select(Group)
.where(Group.joinable_by == None)
.where(Group.joinable_by == None) # noqa: E711
.where(Group.readable_by == ReadableBy.world)
.where(Group.writeable_by == WriteableBy.authority)
)
Expand Down
2 changes: 1 addition & 1 deletion h/migrations/versions/21f87f395e26_add_group_name_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"""

import sqlalchemy as sa
import sqlalchemy as sa # noqa: F401
from alembic import op

# revision identifiers, used by Alembic.
Expand Down
2 changes: 1 addition & 1 deletion h/migrations/versions/2494fea98d2d_add_the_token_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@


def upgrade():
token_table = op.create_table(
token_table = op.create_table( # noqa: F841
"token",
sa.Column("created", sa.DateTime, server_default=sa.func.now(), nullable=False),
sa.Column("updated", sa.DateTime, server_default=sa.func.now(), nullable=False),
Expand Down
2 changes: 1 addition & 1 deletion h/migrations/versions/3081971a50fc_sub_uri_lower.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import sqlalchemy as sa
from alembic import op
from sqlalchemy.dialects import postgresql
from sqlalchemy.dialects import postgresql # noqa: F401

revision = "3081971a50fc"
down_revision = "0d101aa6b9a5"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Remove user last login date default values."""

import datetime
import datetime # noqa: F401

import sqlalchemy as sa
from alembic import op
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"""

import sqlalchemy as sa
import sqlalchemy as sa # noqa: F401
from alembic import op

# revision identifiers, used by Alembic.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
Create Date: 2017-07-26 10:47:38.895306
"""

import enum
import enum # noqa: F401

import sqlalchemy as sa
import sqlalchemy as sa # noqa: F401
from alembic import op

revision = "52a0b2e5a9c2"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
Session = sessionmaker()


class Window(namedtuple("Window", ["start", "end"])):
class Window(namedtuple("Window", ["start", "end"])): # noqa: PYI024
pass


Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Revert annotation_metadatai."""

from alembic import op
from sqlalchemy.dialects import postgresql
from sqlalchemy.dialects import postgresql # noqa: F401

revision = "5d1abac3c1a1"
down_revision = "6df1c8c3e423"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def generate():
This is the generate() function from h/pubid.py.
"""
ALPHABET = "123456789ABDEGJKLMNPQRVWXYZabdegijkmnopqrvwxyz"
ALPHABET = "123456789ABDEGJKLMNPQRVWXYZabdegijkmnopqrvwxyz" # noqa: N806
return "".join(random.SystemRandom().choice(ALPHABET) for _ in range(8))


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

def upgrade():
bind = op.get_bind()
session = Session(bind=bind)
session = Session(bind=bind) # noqa: F841
op.execute(user.update().values(sidebar_tutorial_dismissed=True))


Expand Down
2 changes: 1 addition & 1 deletion h/migrations/versions/77bc5b4f2205_revert_annotation_pk.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Revert creation of annotation.pk."""

from alembic import op
from sqlalchemy.schema import CreateSequence, DropSequence, Sequence
from sqlalchemy.schema import CreateSequence, DropSequence, Sequence # noqa: F401

revision = "77bc5b4f2205"
down_revision = "5d1abac3c1a1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"""

import sqlalchemy as sa
import sqlalchemy as sa # noqa: F401
from alembic import op

# revision identifiers, used by Alembic.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def upgrade():
).all()

op.execute(delete(Token).where(Token.userid.in_(userids)))
log.info(f"Deleted %d orphaned tokens", len(userids))
log.info(f"Deleted %d orphaned tokens", len(userids)) # noqa: F541


def downgrade():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"""

import sqlalchemy as sa
import sqlalchemy as sa # noqa: F401
from alembic import op

# revision identifiers, used by Alembic.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
def upgrade():
op.execute(
annotation.update()
.where(annotation.c.deleted == None)
.where(annotation.c.deleted == None) # noqa: E711
.values(deleted=False) # noqa: E711
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import sqlalchemy as sa
from alembic import op
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.ext.declarative import declarative_base # noqa: F401
from sqlalchemy.orm import sessionmaker

revision = "9e01b7287da2"
Expand Down
2 changes: 1 addition & 1 deletion h/migrations/versions/9e47da806421_remove_old_tokens.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def upgrade():

for deleted_token_id in deleted_token_ids:
count += 1
log.info(f"Deleted token (%d): %s", count, deleted_token_id)
log.info(f"Deleted token (%d): %s", count, deleted_token_id) # noqa: F541


def downgrade():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
log = logging.getLogger(__name__)


class Window(namedtuple("Window", ["start", "end"])):
class Window(namedtuple("Window", ["start", "end"])): # noqa: PYI024
pass


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
Session = sessionmaker()


class Window(namedtuple("Window", ["start", "end"])):
class Window(namedtuple("Window", ["start", "end"])): # noqa: PYI024
pass


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import sqlalchemy as sa
from alembic import op
from sqlalchemy.dialects import postgresql
from sqlalchemy.dialects import postgresql # noqa: F401

revision = "b0e1a12de5e8"
down_revision = "bdaa06b14557"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from alembic import op
from sqlalchemy.dialects import postgresql as pg
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.ext.mutable import MutableDict, MutableList
from sqlalchemy.ext.mutable import MutableDict, MutableList # noqa: F401
from sqlalchemy.orm import sessionmaker

from h.db import types
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import sqlalchemy as sa
from alembic import op
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker, subqueryload
from sqlalchemy.orm import sessionmaker, subqueryload # noqa: F401

from h.db import types
from h.util.uri import normalize as uri_normalize
Expand All @@ -26,7 +26,7 @@
Session = sessionmaker()


class Window(namedtuple("Window", ["start", "end"])):
class Window(namedtuple("Window", ["start", "end"])): # noqa: PYI024
pass


Expand Down Expand Up @@ -99,7 +99,7 @@ def upgrade():
uri_normalized = uri_normalize(uri)

doc = Document(created=ann.created, updated=ann.updated)
docuri = DocumentURI(
docuri = DocumentURI( # noqa: F841
created=ann.created,
updated=ann.updated,
claimant=uri,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker

from h.util import markdown_render
from h.util import markdown_render # noqa: F401

revision = "d536d9a342f3"
down_revision = "39b1935d9e7b"
Expand All @@ -23,7 +23,7 @@
Session = sessionmaker()


class Window(namedtuple("Window", ["start", "end"])):
class Window(namedtuple("Window", ["start", "end"])): # noqa: PYI024
pass


Expand Down Expand Up @@ -67,7 +67,7 @@ def _fill_annotation_window_text_rendered(session, window):
)

for a in query:
a.text_rendered = markdown.render(a.text)
a.text_rendered = markdown.render(a.text) # noqa: F821


def _fetch_windows(session, chunksize=100):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"""

from alembic import op
from sqlalchemy.dialects import postgresql
from sqlalchemy.dialects import postgresql # noqa: F401

revision = "dfb8b45674db"
down_revision = "dba81a22ea75"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"""

import sqlalchemy as sa
import sqlalchemy as sa # noqa: F401
from alembic import op

# revision identifiers, used by Alembic.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"""

import sqlalchemy as sa
import sqlalchemy as sa # noqa: F401
from alembic import op

# revision identifiers, used by Alembic.
Expand Down
2 changes: 1 addition & 1 deletion h/models/group.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ def __repr__(self):
return helpers.repr_(self, ["id"])


TypeFlags = namedtuple("TypeFlags", "joinable_by readable_by writeable_by")
TypeFlags = namedtuple("TypeFlags", "joinable_by readable_by writeable_by") # noqa: PYI024

GROUP_TYPE_FLAGS = {
"open": TypeFlags(
Expand Down
2 changes: 1 addition & 1 deletion h/models/token.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class Token(Base, mixins.Timestamps):
index=True,
nullable=False,
)
user: Mapped["User"] = sqlalchemy.orm.relationship(back_populates="tokens")
user: Mapped["User"] = sqlalchemy.orm.relationship(back_populates="tokens") # noqa: F821

#: The authclient which created the token.
#: A NULL value means it is a developer token.
Expand Down
Loading

0 comments on commit ecf4bf5

Please sign in to comment.