Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Aug 26, 2024
1 parent c5b53cb commit 6fd1800
Show file tree
Hide file tree
Showing 16 changed files with 35 additions and 26 deletions.
1 change: 1 addition & 0 deletions alembic/versions/0647beeadb7d_add_org_name.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2022-05-12 19:35:03.484368
"""

import sqlalchemy as sa

from alembic import op
Expand Down
1 change: 1 addition & 0 deletions alembic/versions/18e02ee52b12_add_bake_name.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2021-04-29 17:50:30.689500
"""

import sqlalchemy as sa

from alembic import op
Expand Down
1 change: 1 addition & 0 deletions alembic/versions/ae504a8e5860_add_project_name_column.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2023-03-22 09:55:16.375384
"""

import sqlalchemy as sa

from alembic import op
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2021-04-26 08:51:55.571516
"""

import sqlalchemy as sa

from alembic import op
Expand Down
1 change: 1 addition & 0 deletions alembic/versions/dd6533a83f29_enable_cascade_removal.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2021-09-15 17:50:21.723475
"""

from typing import Any, Optional

from alembic import op
Expand Down
1 change: 1 addition & 0 deletions alembic/versions/f00badb90a87_create_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2021-02-24 18:08:13.764531
"""

import sqlalchemy as sa
import sqlalchemy.dialects.postgresql as sapg

Expand Down
1 change: 1 addition & 0 deletions alembic/versions/f2f6c4cf6930_add_bake_images.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2021-05-17 12:19:07.538465
"""

import sqlalchemy as sa
import sqlalchemy.dialects.postgresql as sapg

Expand Down
1 change: 1 addition & 0 deletions alembic/versions/f36b3465eb48_add_bake_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
Create Date: 2021-04-28 18:46:19.425340
"""

import sqlalchemy as sa
import sqlalchemy.dialects.postgresql as sapg

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2021-09-22 17:49:31.070060
"""

from typing import Any, Optional

from alembic import op
Expand Down
10 changes: 6 additions & 4 deletions platform_neuro_flow_api/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,12 @@ def _decorator(handler: F) -> F:
@functools.wraps(handler)
async def _wrapped(self: Any, request: aiohttp.web.Request) -> Any:
query_data = {
key: request.query.getall(key)
if len(request.query.getall(key)) > 1
or isinstance(schema.fields.get(key), fields.List)
else request.query[key]
key: (
request.query.getall(key)
if len(request.query.getall(key)) > 1
or isinstance(schema.fields.get(key), fields.List)
else request.query[key]
)
for key in request.query.keys()
}
validated = schema.load(query_data)
Expand Down
16 changes: 9 additions & 7 deletions platform_neuro_flow_api/storage/postgres.py
Original file line number Diff line number Diff line change
Expand Up @@ -519,13 +519,15 @@ def _to_values(self, item: Bake) -> dict[str, Any]:
graphs[_full_id2str(key)] = subgr
payload["graphs"] = graphs
payload["meta"] = {
"git_info": {
"sha": item.meta.git_info.sha,
"branch": item.meta.git_info.branch,
"tags": item.meta.git_info.tags,
}
if item.meta.git_info
else None,
"git_info": (
{
"sha": item.meta.git_info.sha,
"branch": item.meta.git_info.branch,
"tags": item.meta.git_info.tags,
}
if item.meta.git_info
else None
),
}
return {
"id": payload.pop("id"),
Expand Down
1 change: 0 additions & 1 deletion tests/integration/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
from yarl import URL

from platform_neuro_flow_api.config import PlatformApiConfig

from tests.integration.conftest import ApiAddress, create_local_app_server


Expand Down
1 change: 0 additions & 1 deletion tests/integration/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

from platform_neuro_flow_api.config import PlatformAuthConfig
from platform_neuro_flow_api.storage.base import Project

from tests.integration.conftest import random_name

logger = logging.getLogger(__name__)
Expand Down
18 changes: 9 additions & 9 deletions tests/integration/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,15 @@ def config_factory(
postgres_config: PostgresConfig,
) -> Callable[..., Config]:
def _f(**kwargs: Any) -> Config:
defaults = dict(
server=ServerConfig(host="0.0.0.0", port=8080),
platform_auth=auth_config,
platform_api=platform_api_config,
cors=CORSConfig(allowed_origins=["https://neu.ro"]),
postgres=postgres_config,
watchers=WatchersConfig(polling_interval_sec=1),
sentry=None,
)
defaults = {
"server": ServerConfig(host="0.0.0.0", port=8080),
"platform_auth": auth_config,
"platform_api": platform_api_config,
"cors": CORSConfig(allowed_origins=["https://neu.ro"]),
"postgres": postgres_config,
"watchers": WatchersConfig(polling_interval_sec=1),
"sentry": None,
}
kwargs = {**defaults, **kwargs}
return Config(**kwargs)

Expand Down
1 change: 0 additions & 1 deletion tests/integration/test_postgres_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
PostgresStorage,
_full_id2str,
)

from tests.unit.test_in_memory_storage import (
MockDataHelper,
TestAttemptStorage as _TestAttemptStorage,
Expand Down
5 changes: 2 additions & 3 deletions tests/unit/test_watchers.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from platform_neuro_flow_api.storage.base import AttemptStorage, TaskStatus
from platform_neuro_flow_api.storage.in_memory import InMemoryStorage
from platform_neuro_flow_api.watchers import ExecutorAliveWatcher

from tests.unit.test_in_memory_storage import MockDataHelper
from tests.utils import make_descr

Expand Down Expand Up @@ -48,7 +47,7 @@ async def test_no_running_attempts(
data = await self.helper.gen_attempt_data(result=TaskStatus.SUCCEEDED)
await storage.create(data)
await watcher.check()
assert all([it.result == TaskStatus.SUCCEEDED async for it in storage.list()])
assert all(it.result == TaskStatus.SUCCEEDED async for it in storage.list())

async def test_running_attempt_without_executor_unchanged(
self, watcher: ExecutorAliveWatcher, storage: AttemptStorage
Expand All @@ -60,7 +59,7 @@ async def test_running_attempt_without_executor_unchanged(
)
await storage.create(data)
await watcher.check()
assert all([it.result == TaskStatus.RUNNING async for it in storage.list()])
assert all(it.result == TaskStatus.RUNNING async for it in storage.list())

async def test_running_attempt_running_executor_not_marked(
self, client_mock: Mock, watcher: ExecutorAliveWatcher, storage: AttemptStorage
Expand Down

0 comments on commit 6fd1800

Please sign in to comment.