Skip to content

Commit 8829567

Browse files
committed
linting
1 parent c491626 commit 8829567

File tree

6 files changed

+19
-19
lines changed

6 files changed

+19
-19
lines changed

pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,8 @@ lint.ignore = [
148148
"E501", # Line too long, should be fixed by black.
149149
"B008", # Do not perform function calls in argument defaults.
150150
"UP007", # Do not complain about Optional[] (TODO: remove once typer is patched)
151+
"N803", # Argument name should be lowercase
152+
"N802", # Function name should be lowercase
151153
]
152154
lint.select = [
153155
"B", # flake8-bugbear - https://docs.astral.sh/ruff/rules/#flake8-bugbear-b

src/edge_containers_cli/__main__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import os
22
import sys
3-
from typing import Optional
43

54
import typer
65

@@ -36,7 +35,7 @@ def backend_callback(ctx: typer.Context, backend: ECBackends):
3635
@cli.callback()
3736
def _main(
3837
ctx: typer.Context,
39-
version: Optional[bool] = typer.Option(
38+
version: bool | None = typer.Option(
4039
None,
4140
"--version",
4241
callback=version_callback,

src/edge_containers_cli/cmds/demo_commands.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ def process_t(time_string) -> str:
4040
}
4141

4242
if NUM_SERVICES == 0:
43-
sample_ServicesDataFrame = polars.DataFrame(schema=ServicesSchema)
43+
SampleServicesDataFrame = polars.DataFrame(schema=ServicesSchema)
4444
else:
45-
sample_ServicesDataFrame = ServicesDataFrame(polars.from_dict(sample_data))
45+
SampleServicesDataFrame = ServicesDataFrame(polars.from_dict(sample_data))
4646

4747

4848
def demo_wrapper():
@@ -78,7 +78,7 @@ def __init__(
7878
):
7979
self._target = "Demo Beamline"
8080
self._target_valid = False
81-
self._stateDF = sample_ServicesDataFrame
81+
self._stateDF = SampleServicesDataFrame
8282

8383
self.lorem_min = 10
8484
self.lorem_max = 50

src/edge_containers_cli/cmds/helm.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from collections.abc import Callable
22
from pathlib import Path
3-
from typing import Optional
43

54
from ruamel.yaml import YAML
65

@@ -25,9 +24,9 @@ def __init__(
2524
namespace: str,
2625
service_name: str,
2726
args: str = "",
28-
version: Optional[str] = None,
27+
version: str | None = None,
2928
template: bool = False,
30-
repo: Optional[str] = None,
29+
repo: str | None = None,
3130
):
3231
"""
3332
Create a helm chart from a local or a remote repo

src/edge_containers_cli/cmds/monitor.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
from textual.worker import get_current_worker
3535

3636
from edge_containers_cli.cmds.commands import Commands
37-
from edge_containers_cli.definitions import ECLogLevels, emoji
37+
from edge_containers_cli.definitions import ECLogLevels, Emoji
3838
from edge_containers_cli.logging import log
3939

4040

@@ -239,7 +239,7 @@ def __init__(self, commands, running_only: bool) -> None:
239239
self._indicator_lock = threading.Lock()
240240
self._service_indicators = {
241241
"name": [""],
242-
emoji.exclaim: [""],
242+
Emoji.exclaim: [""],
243243
}
244244
iocs_df = self._get_services_df(self.running_only)
245245
self.columns = iocs_df.columns
@@ -289,8 +289,8 @@ def _get_services_df(self, running_only):
289289
services_df = self.commands._get_services(running_only) # noqa: SLF001
290290
services_df = services_df.with_columns(
291291
polars.when(polars.col("ready"))
292-
.then(polars.lit(emoji.check_mark))
293-
.otherwise(polars.lit(emoji.cross_mark))
292+
.then(polars.lit(Emoji.check_mark))
293+
.otherwise(polars.lit(Emoji.cross_mark))
294294
.alias("ready")
295295
)
296296
indicators_df = polars.DataFrame(self._service_indicators)
@@ -305,10 +305,10 @@ def update_indicator_threadsafe(self, name: str, indicator: str):
305305
with self._indicator_lock:
306306
if name in self._service_indicators["name"]:
307307
index = self._service_indicators["name"].index(name)
308-
self._service_indicators[emoji.exclaim][index] = indicator
308+
self._service_indicators[Emoji.exclaim][index] = indicator
309309
else:
310310
self._service_indicators["name"].append(name)
311-
self._service_indicators[emoji.exclaim].append(indicator)
311+
self._service_indicators[Emoji.exclaim].append(indicator)
312312

313313
def watch_sort_column_id(self, sort_column_id: str) -> None:
314314
"""Called when the sort_column_id attribute changes."""
@@ -479,9 +479,9 @@ def _do_confirmed_action(self, action: str, command: Callable):
479479

480480
def do_task(command, service_name):
481481
def _do_task():
482-
table.update_indicator_threadsafe(service_name, emoji.road_works)
482+
table.update_indicator_threadsafe(service_name, Emoji.road_works)
483483
command(service_name)
484-
table.update_indicator_threadsafe(service_name, emoji.none)
484+
table.update_indicator_threadsafe(service_name, Emoji.none)
485485
self.busy_services.remove(service_name)
486486

487487
return _do_task
@@ -496,7 +496,7 @@ def after_dismiss_callback(start: bool | None) -> None:
496496
log.info(f"Scheduled: {action} {service_name}")
497497
self.busy_services.add(service_name)
498498
table.update_indicator_threadsafe(
499-
service_name, emoji.hour_glass
499+
service_name, Emoji.hour_glass
500500
)
501501
self._queue.put(do_task(command, service_name))
502502

@@ -523,7 +523,7 @@ def action_ioc_logs(self) -> None:
523523
"""Display the logs of the IOC that is currently highlighted."""
524524
if service_name := self._get_service_name():
525525
# Convert to corresponding bool
526-
ready = self._get_highlighted_cell("ready") == emoji.check_mark
526+
ready = self._get_highlighted_cell("ready") == Emoji.check_mark
527527

528528
if ready:
529529
command = self.commands._get_logs # noqa: SLF001

src/edge_containers_cli/definitions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class ECContext:
3434
log_url: str = ""
3535

3636

37-
class emoji(str, Enum):
37+
class Emoji(str, Enum):
3838
none = ""
3939
road_works = "\U0001f6a7"
4040
exclaim = "\U00002755"

0 commit comments

Comments
 (0)