Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
87698f9
[Exchange Oracle] Add Ruff
Bobronium Aug 16, 2024
6de538f
[Exchange Oracle] Reformat code with Ruff
Bobronium Aug 16, 2024
430602c
[Exchange Oracle] Autofix ANN204: missing-return-type-special-method
Bobronium Aug 17, 2024
31f4f1e
[Exchange Oracle] Autofix E713: not-in-test
Bobronium Aug 17, 2024
3ab7776
[Exchange Oracle] Autofix F541: f-string-missing-placeholders
Bobronium Aug 17, 2024
072c9fa
[Exchange Oracle] Autofix F841: unused-variable
Bobronium Aug 17, 2024
52ffe89
[Exchange Oracle] Autofix RET501: unnecessary-return-none
Bobronium Aug 17, 2024
99f07fb
[Exchange Oracle] Autofix RET505: superfluous-else-return
Bobronium Aug 17, 2024
16b158f
[Exchange Oracle] Autofix RET506: superfluous-else-raise
Bobronium Aug 17, 2024
e34b403
[Exchange Oracle] Autofix RET507: superfluous-else-continue
Bobronium Aug 17, 2024
ca8bcab
[Exchange Oracle] Autofix SIM201: negate-equal-op
Bobronium Aug 17, 2024
5ef64a4
[Exchange Oracle] Autofix SIM910: dict-get-with-none-default
Bobronium Aug 17, 2024
5d421a9
[Exchange Oracle] Autofix UP005: deprecated-unittest-alias
Bobronium Aug 17, 2024
d97e6e7
[Exchange Oracle] Autofix UP006: non-pep585-annotation
Bobronium Aug 17, 2024
809a949
[Exchange Oracle] Autofix UP007: non-pep604-annotation
Bobronium Aug 17, 2024
b691dcd
[Exchange Oracle] Autofix UP032: f-string
Bobronium Aug 17, 2024
fb59e0b
[Exchange Oracle] Autofix UP035: deprecated-import
Bobronium Aug 17, 2024
19e66ef
[Exchange Oracle] Autofix UP037: quoted-annotation
Bobronium Aug 17, 2024
7bb3178
[Exchange Oracle] Unsafe autofix ANN204: missing-return-type-special-…
Bobronium Aug 17, 2024
fc17925
[Exchange Oracle] Unsafe autofix ANN205: missing-return-type-static-m…
Bobronium Aug 17, 2024
35029dc
[Exchange Oracle] Unsafe autofix ANN206: missing-return-type-class-me…
Bobronium Aug 17, 2024
4409a7f
[Exchange Oracle] Unsafe autofix B006: mutable-argument-default
Bobronium Aug 17, 2024
e655ec3
[Exchange Oracle] Unsafe autofix B007: unused-loop-control-variable
Bobronium Aug 17, 2024
f99c48b
[Exchange Oracle] Unsafe autofix B011: assert-false
Bobronium Aug 17, 2024
822954c
[Exchange Oracle] Unsafe autofix C400: unnecessary-generator-list
Bobronium Aug 17, 2024
e1a1df5
[Exchange Oracle] Unsafe autofix C401: unnecessary-generator-set
Bobronium Aug 17, 2024
ab0b890
[Exchange Oracle] Unsafe autofix C408: unnecessary-collection-call
Bobronium Aug 17, 2024
21a0f38
[Exchange Oracle] Unsafe autofix E731: lambda-assignment
Bobronium Aug 17, 2024
e0b704d
[Exchange Oracle] Unsafe autofix F841: unused-variable
Bobronium Aug 17, 2024
5dd9c05
[Exchange Oracle] Unsafe autofix FLY002: static-join-to-f-string
Bobronium Aug 17, 2024
d6348b4
[Exchange Oracle] Unsafe autofix PT009: pytest-unittest-assertion
Bobronium Aug 17, 2024
535ba96
[Exchange Oracle] Unsafe autofix PT018: pytest-composite-assertion
Bobronium Aug 17, 2024
1ffc29d
[Exchange Oracle] Unsafe autofix PT027: pytest-unittest-raises-assertion
Bobronium Aug 17, 2024
d3e11ee
[Exchange Oracle] Unsafe autofix RET503: implicit-return
Bobronium Aug 17, 2024
b32be09
[Exchange Oracle] Unsafe autofix RET504: unnecessary-assign
Bobronium Aug 17, 2024
a2eee86
[Exchange Oracle] Unsafe autofix RUF013: implicit-optional
Bobronium Aug 17, 2024
7d754d7
[Exchange Oracle] Unsafe autofix SIM101: duplicate-isinstance-call
Bobronium Aug 17, 2024
1874418
[Exchange Oracle] Unsafe autofix SIM102: collapsible-if
Bobronium Aug 17, 2024
b57d223
[Exchange Oracle] Unsafe autofix SIM103: needless-bool
Bobronium Aug 17, 2024
c46d719
[Exchange Oracle] Unsafe autofix SIM108: if-else-block-instead-of-if-exp
Bobronium Aug 17, 2024
c2486a1
[Exchange Oracle] Unsafe autofix TCH001: typing-only-first-party-import
Bobronium Aug 17, 2024
ae57360
[Exchange Oracle] Unsafe autofix TCH003: typing-only-standard-library…
Bobronium Aug 17, 2024
5919cd0
[Exchange Oracle] Unsafe autofix TRY201: verbose-raise
Bobronium Aug 17, 2024
e821c6f
[Exchange Oracle] Unsafe autofix TRY400: error-instead-of-exception
Bobronium Aug 17, 2024
93d8f47
[Exchange Oracle] Unsafe autofix UP031: printf-string-formatting
Bobronium Aug 17, 2024
272d783
[Exchange Oracle] Unsafe autofix SIM300: yoda-conditions
Bobronium Aug 17, 2024
ab8917e
[Exchange Oracle] Autofix UP032: f-string
Bobronium Aug 17, 2024
ed3d67d
[Exchange Oracle] Autofix UP038: non-pep604-isinstance
Bobronium Aug 17, 2024
39cea4f
[Exchange Oracle] Add missing __init__.py modules
Bobronium Aug 16, 2024
afbb801
[Exchange Oracle] Restore commented out test code and use xfail
Bobronium Aug 16, 2024
2b7d8f4
[Exchange Oracle] Use iterable unpacking instead of concatenation
Bobronium Aug 16, 2024
9acc8b6
[Exchange Oracle] Rewrite the last two self.assert*Equal
Bobronium Aug 16, 2024
127ab0d
[Exchange Oracle] Add missing __init__.py modules to tests
Bobronium Aug 16, 2024
4c1c3d3
[Exchange Oracle] Add __init__.py to alembic.versions
Bobronium Aug 16, 2024
f256f79
[Exchange Oracle] Use pytest.raises with match
Bobronium Aug 17, 2024
83b25d1
[Exchange Oracle] Fix/ignore remaining issues
Bobronium Aug 19, 2024
27c89ea
[Exchange Oracle] Change comments slightly
Bobronium Aug 22, 2024
158f9c4
[Exchange Oracle] Ignore all rules conflicting with `ruff format`
Bobronium Aug 22, 2024
b25b582
[Exchange Oracle] Use % formatting on string with `{` and `}` symbols
Bobronium Aug 22, 2024
5dc42d7
[Exchange Oracle] Fix removal of `LockNotAvailable` in `src.db.errors`
Bobronium Aug 22, 2024
ce819b2
[Exchange Oracle] Partially revert "Autofix UP032: f-string"
Bobronium Aug 22, 2024
c09f0f8
[Exchange Oracle] Enable E501 rule
Bobronium Aug 22, 2024
3473816
[Exchange Oracle] Ignore UP032
Bobronium Aug 22, 2024
8bb6d60
[Exchange Oracle] Visually separate if conditions
Bobronium Aug 22, 2024
c7fc560
[Exchange Oracle] Remove unnecessary line breaks in with statements
Bobronium Aug 22, 2024
3fc87a5
[Exchange Oracle] Fix tests
Bobronium Aug 22, 2024
abc9b4f
Revert "[Exchange Oracle] Unsafe autofix C401: unnecessary-generator-…
Bobronium Aug 26, 2024
6eb0704
Revert "[Exchange Oracle] Autofix RET505: superfluous-else-return"
Bobronium Aug 26, 2024
f726a4d
[Exchange Oracle] Ignore controversial rules
Bobronium Aug 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .github/workflows/ci-lint-cvat-exchange-oracle.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: CVAT Exchange Oracle Lint

on:
push:
paths:
- 'packages/examples/cvat/exchange-oracle/**'
- '.github/workflows/ci-lint-cvat-exchange-oracle.yaml'

env:
WORKING_DIR: ./packages/examples/cvat/exchange-oracle

defaults:
run:
working-directory: ./packages/examples/cvat/exchange-oracle

jobs:
cvat-exo-lint:
name: CVAT Exchange Oracle Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
cache: 'pip'
cache-dependency-path: ${{ env.WORKING_DIR }}/poetry.lock
- run: python -m pip install poetry
- uses: actions/setup-python@v5
with:
python-version: '3.10'
cache: 'poetry'
cache-dependency-path: ${{ env.WORKING_DIR }}/poetry.lock
- run: poetry install --no-root --only dev
- run: poetry run pre-commit run --all-files
24 changes: 15 additions & 9 deletions packages/examples/cvat/exchange-oracle/.pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
repos:
- repo: https://github.com/psf/black
rev: 22.6.0
- repo: local
hooks:
- id: black
language_version: python3.11
- repo: https://github.com/PyCQA/isort
rev: 5.12.0
hooks:
- id: isort
language_version: python3.11
- id: lint
name: lint
entry: ruff check --fix --unsafe-fixes --show-fixes
Comment thread
Bobronium marked this conversation as resolved.
language: system
require_serial: true
files: "^packages/examples/cvat/exchange-oracle/.*"
types: [python]
- id: format
name: format
entry: ruff format
require_serial: true
language: system
files: "^packages/examples/cvat/exchange-oracle/.*"
types: [python]
14 changes: 9 additions & 5 deletions packages/examples/cvat/exchange-oracle/alembic.ini
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,15 @@ sqlalchemy.url =
# on newly generated revision scripts. See the documentation for further
# detail and examples

# format using "black" - use the console_scripts runner, against the "black" entrypoint
# hooks = black
# black.type = console_scripts
# black.entrypoint = black
# black.options = -l 79 REVISION_SCRIPT_FILENAME
hooks=ruff, ruff_format, types_update

ruff.type = exec
ruff.executable = ruff
ruff.options = check --fix --unsafe-fixes REVISION_SCRIPT_FILENAME

ruff_format.type = exec
ruff_format.executable = ruff
ruff_format.options = format REVISION_SCRIPT_FILENAME

# Logging configuration
[loggers]
Expand Down
4 changes: 1 addition & 3 deletions packages/examples/cvat/exchange-oracle/alembic/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@
# from myapp import mymodel
# target_metadata = mymodel.Base.metadata

from src.db import Base
from src.models.cvat import Job, Task
from src.models.webhook import Webhook
from src.db import Base # noqa: E402

target_metadata = Base.metadata

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,37 +5,45 @@
Create Date: 2024-04-12 18:51:51.504971

"""
from alembic import op

import sqlalchemy as sa
import sqlalchemy_utils

from alembic import op

# revision identifiers, used by Alembic.
revision = '0f3fb7bfcbcf'
down_revision = 'c1e74c227cfe'
revision = "0f3fb7bfcbcf"
down_revision = "c1e74c227cfe"
branch_labels = None
depends_on = None


def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('escrow_creations',
sa.Column('id', sa.String(), nullable=False),
sa.Column('escrow_address', sa.String(length=42), nullable=False),
sa.Column('chain_id', sa.Integer(), nullable=False),
sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=True),
sa.Column('finished_at', sa.DateTime(timezone=True), nullable=True),
sa.Column('total_jobs', sa.Integer(), nullable=False),
sa.PrimaryKeyConstraint('id')
op.create_table(
"escrow_creations",
sa.Column("id", sa.String(), nullable=False),
sa.Column("escrow_address", sa.String(length=42), nullable=False),
sa.Column("chain_id", sa.Integer(), nullable=False),
sa.Column(
"created_at", sa.DateTime(timezone=True), server_default=sa.text("now()"), nullable=True
),
sa.Column("finished_at", sa.DateTime(timezone=True), nullable=True),
sa.Column("total_jobs", sa.Integer(), nullable=False),
sa.PrimaryKeyConstraint("id"),
)
op.create_index(
op.f("ix_escrow_creations_escrow_address"),
"escrow_creations",
["escrow_address"],
unique=False,
)
op.create_index(op.f('ix_escrow_creations_escrow_address'), 'escrow_creations', ['escrow_address'], unique=False)
op.create_index(op.f('ix_escrow_creations_id'), 'escrow_creations', ['id'], unique=False)
op.create_index(op.f("ix_escrow_creations_id"), "escrow_creations", ["id"], unique=False)
# ### end Alembic commands ###


def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.drop_index(op.f('ix_escrow_creations_id'), table_name='escrow_creations')
op.drop_index(op.f('ix_escrow_creations_escrow_address'), table_name='escrow_creations')
op.drop_table('escrow_creations')
op.drop_index(op.f("ix_escrow_creations_id"), table_name="escrow_creations")
op.drop_index(op.f("ix_escrow_creations_escrow_address"), table_name="escrow_creations")
op.drop_table("escrow_creations")
# ### end Alembic commands ###
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
"""init

Revision ID: 16ecc586d685
Revises:
Revises:
Create Date: 2023-10-05 13:56:16.966151

"""
from alembic import op

import sqlalchemy as sa
import sqlalchemy_utils

from alembic import op

# revision identifiers, used by Alembic.
revision = "16ecc586d685"
Expand Down
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,23 @@
Create Date: 2024-02-05 22:54:42.478270

"""
from alembic import op
import sqlalchemy as sa
import sqlalchemy_utils

from alembic import op

# revision identifiers, used by Alembic.
revision = 'c1e74c227cfe'
down_revision = '16ecc586d685'
revision = "c1e74c227cfe"
down_revision = "16ecc586d685"
branch_labels = None
depends_on = None


def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.drop_constraint('projects_escrow_address_key', 'projects', type_='unique')
op.drop_constraint("projects_escrow_address_key", "projects", type_="unique")
# ### end Alembic commands ###


def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.create_unique_constraint('projects_escrow_address_key', 'projects', ['escrow_address'])
op.create_unique_constraint("projects_escrow_address_key", "projects", ["escrow_address"])
# ### end Alembic commands ###
Loading