Skip to content

Commit b16a41b

Browse files
committed
ruffed
1 parent 16a08ea commit b16a41b

File tree

9 files changed

+39
-44
lines changed

9 files changed

+39
-44
lines changed

packages/postgres-database/src/simcore_postgres_database/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77

88
__all__: tuple[str, ...] = (
99
"metadata",
10-
"webserver_models",
1110
"storage_models",
11+
"webserver_models",
1212
)
1313

1414
# nopycln: file

packages/postgres-database/src/simcore_postgres_database/aiopg_errors.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@
4848

4949
__all__: tuple[str, ...] = (
5050
"CheckViolation",
51-
"DatabaseError",
52-
"DataError",
5351
"DBAPIError",
52+
"DataError",
53+
"DatabaseError",
5454
"ForeignKeyViolation",
5555
"IntegrityError",
5656
"InterfaceError",

packages/postgres-database/src/simcore_postgres_database/cli.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
""" command line interface for migration
2-
3-
"""
1+
"""command line interface for migration"""
42

53
# pylint: disable=wildcard-import
64
# pylint: disable=unused-wildcard-import
@@ -127,7 +125,7 @@ def _test_swarm() -> dict:
127125

128126
return cfg
129127

130-
except Exception as err: # pylint: disable=broad-except # noqa: PERF203
128+
except Exception as err: # pylint: disable=broad-except
131129
inline_msg = str(err).replace("\n", ". ")
132130
click.echo(f"<- {test.__name__} failed : {inline_msg}")
133131

packages/postgres-database/src/simcore_postgres_database/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@
77
]
88

99

10-
__all__ = ["target_metadatas", "build_url"]
10+
__all__ = ["build_url", "target_metadatas"]
Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
1-
""" Facade for sidecar service
1+
"""Facade for sidecar service
22
3-
Facade to direct access to models in the database by
4-
the sidecar service
3+
Facade to direct access to models in the database by
4+
the sidecar service
55
66
"""
7+
78
from .models.comp_pipeline import StateType, comp_pipeline
89
from .models.comp_tasks import comp_tasks
910

1011
__all__ = (
11-
"comp_tasks",
12+
"StateType",
1213
"comp_pipeline",
1314
"comp_pipeline",
14-
"StateType",
15+
"comp_tasks",
1516
)
1617
# nopycln: file
Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
""" Facade for storage service (tables manager)
1+
"""Facade for storage service (tables manager)
22
3-
- Facade to direct access to models in the database by
4-
the storage service
3+
- Facade to direct access to models in the database by
4+
the storage service
55
"""
6+
67
from .models.base import metadata
78
from .models.file_meta_data import file_meta_data
89
from .models.groups import groups, user_to_groups
@@ -11,12 +12,12 @@
1112
from .models.users import users
1213

1314
__all__ = [
14-
"tokens",
1515
"file_meta_data",
16+
"groups",
1617
"metadata",
1718
"projects",
18-
"users",
19-
"groups",
19+
"tokens",
2020
"user_to_groups",
21+
"users",
2122
]
2223
# nopycln: file

packages/postgres-database/src/simcore_postgres_database/utils_cli.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -57,17 +57,13 @@ def get_service_published_port(service_name: str) -> int:
5757
s for s in client.services.list() if service_name in getattr(s, "name", "")
5858
]
5959
if not services:
60-
raise RuntimeError(
61-
"Cannot find published port for service '%s'. Probably services still not up"
62-
% service_name
63-
)
60+
msg = f"Cannot find published port for service '{service_name}'. Probably services still not up"
61+
raise RuntimeError(msg)
6462
service_endpoint = services[0].attrs["Endpoint"]
6563

6664
if "Ports" not in service_endpoint or not service_endpoint["Ports"]:
67-
raise RuntimeError(
68-
"Cannot find published port for service '%s' in endpoint. Probably services still not up"
69-
% service_name
70-
)
65+
msg = f"Cannot find published port for service '{service_name}' in endpoint. Probably services still not up"
66+
raise RuntimeError(msg)
7167

7268
published_port = service_endpoint["Ports"][0]["PublishedPort"]
7369
return int(published_port)
@@ -87,7 +83,7 @@ def load_cache(*, raise_if_error=False) -> dict:
8783
def reset_cache():
8884
if os.path.exists(DISCOVERED_CACHE):
8985
os.remove(DISCOVERED_CACHE)
90-
click.echo("Removed %s" % DISCOVERED_CACHE)
86+
click.echo(f"Removed {DISCOVERED_CACHE}")
9187

9288

9389
def get_alembic_config_from_cache(

packages/postgres-database/src/simcore_postgres_database/utils_projects_metadata.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,7 @@ async def _project_has_any_child(
122122
get_stmt = sa.select(projects_metadata.c.project_uuid).where(
123123
projects_metadata.c.parent_project_uuid == f"{project_uuid}"
124124
)
125-
if await connection.scalar(get_stmt) is not None:
126-
return True
127-
return False
125+
return await connection.scalar(get_stmt) is not None
128126

129127

130128
async def _compute_root_parent_from_parent(
Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
""" Facade for webserver service
1+
"""Facade for webserver service
22
3-
Facade to direct access to models in the database by
4-
the webserver service
3+
Facade to direct access to models in the database by
4+
the webserver service
55
66
"""
7+
78
from .models.api_keys import api_keys
89
from .models.classifiers import group_classifiers
910
from .models.comp_pipeline import StateType, comp_pipeline
@@ -21,29 +22,29 @@
2122
from .models.users import UserRole, UserStatus, users
2223

2324
__all__ = (
25+
"DB_CHANNEL_NAME",
26+
"ConfirmationAction",
27+
"GroupType",
28+
"NodeClass",
29+
"ProjectType",
30+
"StateType",
31+
"UserRole",
32+
"UserStatus",
2433
"api_keys",
2534
"comp_pipeline",
2635
"comp_tasks",
27-
"ConfirmationAction",
2836
"confirmations",
29-
"DB_CHANNEL_NAME",
3037
"group_classifiers",
3138
"groups",
32-
"GroupType",
33-
"NodeClass",
3439
"products",
3540
"projects",
3641
"projects_nodes",
37-
"ProjectType",
38-
"scicrunch_resources",
39-
"StateType",
4042
"projects_tags",
43+
"projects_to_wallet",
44+
"scicrunch_resources",
4145
"tags",
4246
"tokens",
4347
"user_to_groups",
44-
"UserRole",
4548
"users",
46-
"UserStatus",
47-
"projects_to_wallet",
4849
)
4950
# nopycln: file

0 commit comments

Comments
 (0)