Skip to content

Commit 5debf98

Browse files
fix code smells
1 parent aa6a73f commit 5debf98

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

packages/settings-library/src/settings_library/postgres.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class PostgresSettings(BaseCustomSettings):
4949
@field_validator("POSTGRES_MAXSIZE")
5050
@classmethod
5151
def _check_size(cls, v, info: ValidationInfo):
52-
if not (info.data["POSTGRES_MINSIZE"] <= v):
52+
if info.data["POSTGRES_MINSIZE"] > v:
5353
msg = f"assert POSTGRES_MINSIZE={info.data['POSTGRES_MINSIZE']} <= POSTGRES_MAXSIZE={v}"
5454
raise ValueError(msg)
5555
return v

packages/settings-library/src/settings_library/utils_cli.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,8 @@ def print_as_envfile(
6060
elif show_secrets and hasattr(value, "get_secret_value"):
6161
value = value.get_secret_value()
6262

63-
if verbose:
64-
if field.description:
65-
typer.echo(f"# {field.description}")
63+
if verbose and field.description:
64+
typer.echo(f"# {field.description}")
6665

6766
typer.echo(f"{name}={value}")
6867

packages/simcore-sdk/src/simcore_sdk/node_ports_v2/ports_mapping.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,8 @@
99

1010
class BasePortsMapping(RootModel[dict[ServicePortKey, Port]]):
1111
def __getitem__(self, key: int | ServicePortKey) -> Port:
12-
if isinstance(key, int):
13-
if key < len(self.root):
14-
key = list(self.root.keys())[key]
12+
if isinstance(key, int) and key < len(self.root):
13+
key = list(self.root.keys())[key]
1514
if key not in self.root:
1615
raise UnboundPortError(key)
1716
assert isinstance(key, str) # nosec

0 commit comments

Comments
 (0)