Skip to content
This repository was archived by the owner on May 11, 2024. It is now read-only.

Fix some code quality issues #48

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .deepsource.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version = 1

test_patterns = ["*/tests/**"]

[[analyzers]]
name = "python"
enabled = true

[analyzers.meta]
runtime_version = "3.x.x"
2 changes: 1 addition & 1 deletion applications/cli/commands/experiment/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -716,7 +716,7 @@ def analyze_ps_parameters_list(list_of_params: Tuple[str, ...]):
try:
param_values = str.strip(param_set, "{}")
param_values_list = [l.strip() for l in param_values.split(",")]
param_tuple = tuple([l.replace(":", "=", 1) for l in param_values_list])
param_tuple = tuple(l.replace(":", "=", 1) for l in param_values_list)
ret_list.append(param_tuple)
except Exception as e:
log.exception(error_message)
Expand Down
12 changes: 4 additions & 8 deletions applications/cli/commands/experiment/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,17 +326,13 @@ def view(ctx: click.Context, experiment_name: str, tensorboard: bool,
click.echo()
top_cpu_users, top_mem_users = get_highest_usage()
click.echo(
Texts.TOP_CPU_CONSUMERS.format(consumers=", ".join([
res.user_name
Texts.TOP_CPU_CONSUMERS.format(consumers=", ".join(res.user_name
for res in top_cpu_users[0:3 if len(top_cpu_users) > 2
else len(top_cpu_users)]
])))
else len(top_cpu_users)])))
click.echo(
Texts.TOP_MEMORY_CONSUMERS.format(consumers=", ".join([
res.user_name
Texts.TOP_MEMORY_CONSUMERS.format(consumers=", ".join(res.user_name
for res in top_mem_users[0:3 if len(top_mem_users) > 2
else len(top_mem_users)]
])))
else len(top_mem_users)])))
except Exception:
click.echo(Texts.PROBLEMS_WHILE_GATHERING_USAGE_DATA)
logger.exception(
Expand Down
4 changes: 2 additions & 2 deletions applications/cli/commands/launch/launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ def tensorboard(ctx: click.Context, no_launch: bool, tensorboard_service_client_
try:
tb = tensorboard_service_client.create_tensorboard(requested_runs)
if tb.invalid_runs:
list_of_invalid_runs = ', '.join([f'{item.get("owner")}/{item.get("name")}'
for item in tb.invalid_runs])
list_of_invalid_runs = ', '.join(f'{item.get("owner")}/{item.get("name")}'
for item in tb.invalid_runs)
click.echo(Texts.TB_INVALID_RUNS_MSG.format(invalid_runs=list_of_invalid_runs))
except Exception as exe:
err_message = Texts.TB_CREATE_ERROR_MSG
Expand Down
2 changes: 1 addition & 1 deletion applications/cli/commands/launch/tests/test_launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,5 +311,5 @@ def test_tensorboard_command_many_experiments_some_nonexisting(mocker, launch_te
assert launch.sleep.call_count == 0
assert result.exit_code == 0
assert Texts.TB_INVALID_RUNS_MSG.format(
invalid_runs=", ".join([f'{item.get("owner")}/{item.get("name")}' for item in FAKE_INVALID_RUNS])
invalid_runs=", ".join(f'{item.get("owner")}/{item.get("name")}' for item in FAKE_INVALID_RUNS)
) in result.output
4 changes: 2 additions & 2 deletions applications/nauta-docs/app/tools/generate_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ def add_chapters_to_menu(local_chapters, file, menu):
if len(local_chapters) == 0:
return
local_chapters = deque(local_chapters)
while len(local_chapters):
while local_chapters:
new_chapter = Chapter(remove_hash(local_chapters.popleft()), file)
subchapters = list()
while len(local_chapters):
while local_chapters:
if local_chapters[0].startswith("##"):
subchapters.append(remove_hash(local_chapters.popleft()))
else:
Expand Down