Skip to content

Commit

Permalink
chore: Run black and flake8 on project
Browse files Browse the repository at this point in the history
  • Loading branch information
KIRA009 committed Apr 18, 2024
1 parent f56c93b commit c4e36c5
Show file tree
Hide file tree
Showing 36 changed files with 380 additions and 270 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ jobs:
- name: Build executables
run: |
poetry run python -m openadapt.build
zip -r OpenAdapt.app.zip dist/OpenAdapt.app
cd dist
zip -r ../OpenAdapt.app.zip OpenAdapt.app
cd ..
- name: Upload executables
uses: actions/upload-artifact@v3
with:
Expand Down Expand Up @@ -59,7 +61,9 @@ jobs:
- name: Build executables
run: |
poetry run python -m openadapt.build
7z a -tzip OpenAdapt.zip dist/OpenAdapt
cd dist
7z a -tzip ../OpenAdapt.zip OpenAdapt
cd ..
- name: Upload executables
uses: actions/upload-artifact@v3
with:
Expand Down
3 changes: 1 addition & 2 deletions openadapt/adapters/ultralytics.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
See https://docs.ultralytics.com/models/fast-sam/#predict-usage for details.
"""

from tempfile import TemporaryDirectory
from pathlib import Path
from tempfile import TemporaryDirectory
import os

from loguru import logger
Expand All @@ -16,7 +16,6 @@

from openadapt import cache


MODEL_NAMES = (
"FastSAM-x.pt",
"FastSAM-s.pt",
Expand Down
3 changes: 2 additions & 1 deletion openadapt/alembic/context_loader.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import pathlib

from alembic import command
from alembic.config import Config

from alembic import command


def load_context():
ALEMBIC_INI = pathlib.Path(__file__).parent.parent / "alembic.ini"
Expand Down
25 changes: 13 additions & 12 deletions openadapt/alembic/versions/104d4a614d95_add_performancestat.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,33 @@
Create Date: 2023-05-27 02:59:14.032373
"""
from alembic import op
import sqlalchemy as sa

from alembic import op

# revision identifiers, used by Alembic.
revision = '104d4a614d95'
down_revision = 'b2dc41850120'
revision = "104d4a614d95"
down_revision = "b2dc41850120"
branch_labels = None
depends_on = None


def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('performance_stat',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('recording_timestamp', sa.Integer(), nullable=True),
sa.Column('event_type', sa.String(), nullable=True),
sa.Column('start_time', sa.Integer(), nullable=True),
sa.Column('end_time', sa.Integer(), nullable=True),
sa.Column('window_id', sa.String(), nullable=True),
sa.PrimaryKeyConstraint('id', name=op.f('pk_performance_stat'))
op.create_table(
"performance_stat",
sa.Column("id", sa.Integer(), nullable=False),
sa.Column("recording_timestamp", sa.Integer(), nullable=True),
sa.Column("event_type", sa.String(), nullable=True),
sa.Column("start_time", sa.Integer(), nullable=True),
sa.Column("end_time", sa.Integer(), nullable=True),
sa.Column("window_id", sa.String(), nullable=True),
sa.PrimaryKeyConstraint("id", name=op.f("pk_performance_stat")),
)
# ### end Alembic commands ###


def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table('performance_stat')
op.drop_table("performance_stat")
# ### end Alembic commands ###
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@
Create Date: 2023-05-10 11:22:37.266810
"""
from alembic import op
import sqlalchemy as sa

from alembic import op

# revision identifiers, used by Alembic.
revision = '20f9c2afb42c'
down_revision = '5139d7df38f6'
revision = "20f9c2afb42c"
down_revision = "5139d7df38f6"
branch_labels = None
depends_on = None


def upgrade() -> None:
op.rename_table('input_event', 'action_event')
op.rename_table("input_event", "action_event")


def downgrade() -> None:
op.rename_table('action_event', 'input_event')
op.rename_table("action_event", "input_event")
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,34 @@
Create Date: 2024-04-05 12:02:57.843244
"""
from alembic import op
import sqlalchemy as sa

from alembic import op

# revision identifiers, used by Alembic.
revision = '30a5ba9d6453'
down_revision = '530f0663324e'
revision = "30a5ba9d6453"
down_revision = "530f0663324e"
branch_labels = None
depends_on = None


def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('action_event', schema=None) as batch_op:
batch_op.add_column(sa.Column('active_segment_description', sa.String(), nullable=True))
batch_op.add_column(sa.Column('available_segment_descriptions', sa.String(), nullable=True))
with op.batch_alter_table("action_event", schema=None) as batch_op:
batch_op.add_column(
sa.Column("active_segment_description", sa.String(), nullable=True)
)
batch_op.add_column(
sa.Column("available_segment_descriptions", sa.String(), nullable=True)
)

# ### end Alembic commands ###


def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('action_event', schema=None) as batch_op:
batch_op.drop_column('available_segment_descriptions')
batch_op.drop_column('active_segment_description')
with op.batch_alter_table("action_event", schema=None) as batch_op:
batch_op.drop_column("available_segment_descriptions")
batch_op.drop_column("active_segment_description")

# ### end Alembic commands ###
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,28 @@
Create Date: 2023-04-17 13:28:07.525123
"""
from alembic import op
import sqlalchemy as sa

from alembic import op

# revision identifiers, used by Alembic.
revision = '5139d7df38f6'
down_revision = 'b206c80f7640'
revision = "5139d7df38f6"
down_revision = "b206c80f7640"
branch_labels = None
depends_on = None


def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('recording', schema=None) as batch_op:
batch_op.add_column(sa.Column('task_description', sa.String(), nullable=True))
with op.batch_alter_table("recording", schema=None) as batch_op:
batch_op.add_column(sa.Column("task_description", sa.String(), nullable=True))

# ### end Alembic commands ###


def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('recording', schema=None) as batch_op:
batch_op.drop_column('task_description')
with op.batch_alter_table("recording", schema=None) as batch_op:
batch_op.drop_column("task_description")

# ### end Alembic commands ###
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,35 @@
Create Date: 2024-02-16 10:31:05.020772
"""
from alembic import op
import sqlalchemy as sa

from alembic import op
from openadapt.models import ForceFloat


# revision identifiers, used by Alembic.
revision = '530f0663324e'
down_revision = '8713b142f5de'
revision = "530f0663324e"
down_revision = "8713b142f5de"
branch_labels = None
depends_on = None


def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('recording', schema=None) as batch_op:
batch_op.add_column(sa.Column('video_start_time', ForceFloat(precision=10, scale=2, asdecimal=False), nullable=True))
with op.batch_alter_table("recording", schema=None) as batch_op:
batch_op.add_column(
sa.Column(
"video_start_time",
ForceFloat(precision=10, scale=2, asdecimal=False),
nullable=True,
)
)

# ### end Alembic commands ###


def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('recording', schema=None) as batch_op:
batch_op.drop_column('video_start_time')
with op.batch_alter_table("recording", schema=None) as batch_op:
batch_op.drop_column("video_start_time")

# ### end Alembic commands ###
14 changes: 7 additions & 7 deletions openadapt/alembic/versions/57d78d23087a_add_windowevent_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,28 @@
Create Date: 2023-05-14 18:32:57.473479
"""
from alembic import op
import sqlalchemy as sa

from alembic import op

# revision identifiers, used by Alembic.
revision = '57d78d23087a'
down_revision = '20f9c2afb42c'
revision = "57d78d23087a"
down_revision = "20f9c2afb42c"
branch_labels = None
depends_on = None


def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('window_event', schema=None) as batch_op:
batch_op.add_column(sa.Column('state', sa.JSON(), nullable=True))
with op.batch_alter_table("window_event", schema=None) as batch_op:
batch_op.add_column(sa.Column("state", sa.JSON(), nullable=True))

# ### end Alembic commands ###


def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('window_event', schema=None) as batch_op:
batch_op.drop_column('state')
with op.batch_alter_table("window_event", schema=None) as batch_op:
batch_op.drop_column("state")

# ### end Alembic commands ###
31 changes: 20 additions & 11 deletions openadapt/alembic/versions/607d1380b5ae_add_memorystat.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,40 @@
Create Date: 2023-06-28 11:54:36.749072
"""
from alembic import op
import sqlalchemy as sa
from openadapt.models import ForceFloat

from alembic import op
from openadapt.models import ForceFloat

# revision identifiers, used by Alembic.
revision = '607d1380b5ae'
down_revision = '104d4a614d95'
revision = "607d1380b5ae"
down_revision = "104d4a614d95"
branch_labels = None
depends_on = None


def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('memory_stat',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('recording_timestamp', sa.Integer(), nullable=True),
sa.Column('memory_usage_bytes', ForceFloat(precision=10, scale=2, asdecimal=False), nullable=True),
sa.Column('timestamp', ForceFloat(precision=10, scale=2, asdecimal=False), nullable=True),
sa.PrimaryKeyConstraint('id', name=op.f('pk_memory_stat'))
op.create_table(
"memory_stat",
sa.Column("id", sa.Integer(), nullable=False),
sa.Column("recording_timestamp", sa.Integer(), nullable=True),
sa.Column(
"memory_usage_bytes",
ForceFloat(precision=10, scale=2, asdecimal=False),
nullable=True,
),
sa.Column(
"timestamp",
ForceFloat(precision=10, scale=2, asdecimal=False),
nullable=True,
),
sa.PrimaryKeyConstraint("id", name=op.f("pk_memory_stat")),
)
# ### end Alembic commands ###


def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table('memory_stat')
op.drop_table("memory_stat")
# ### end Alembic commands ###
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,27 @@
from alembic import op

# revision identifiers, used by Alembic.
revision = '8713b142f5de'
down_revision = '607d1380b5ae'
revision = "8713b142f5de"
down_revision = "607d1380b5ae"
branch_labels = None
depends_on = None


def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('screenshot', schema=None) as batch_op:
batch_op.add_column(sa.Column('png_diff_data', sa.LargeBinary(), nullable=True))
batch_op.add_column(sa.Column('png_diff_mask_data', sa.LargeBinary(), nullable=True))
with op.batch_alter_table("screenshot", schema=None) as batch_op:
batch_op.add_column(sa.Column("png_diff_data", sa.LargeBinary(), nullable=True))
batch_op.add_column(
sa.Column("png_diff_mask_data", sa.LargeBinary(), nullable=True)
)

# ### end Alembic commands ###


def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('screenshot', schema=None) as batch_op:
batch_op.drop_column('png_diff_mask_data')
batch_op.drop_column('png_diff_data')
with op.batch_alter_table("screenshot", schema=None) as batch_op:
batch_op.drop_column("png_diff_mask_data")
batch_op.drop_column("png_diff_data")

# ### end Alembic commands ###
Loading

0 comments on commit c4e36c5

Please sign in to comment.