Skip to content

Commit

Permalink
fix pre-commit linter
Browse files Browse the repository at this point in the history
  • Loading branch information
agoscinski committed May 24, 2024
1 parent 5169197 commit a6ccf4e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 19 deletions.
4 changes: 0 additions & 4 deletions src/aiida/cmdline/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@
# AUTO-GENERATED

# fmt: off
import logging

CMDLINE_LOGGER = logging.getLogger('verdi')

from .groups import *
from .params import *
Expand Down Expand Up @@ -60,7 +57,6 @@
'is_verbose',
'only_if_daemon_running',
'with_dbenv',
'CMDLINE_LOGGER',
)

# fmt: on
10 changes: 5 additions & 5 deletions src/aiida/cmdline/commands/cmd_computer.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,14 @@
###########################################################################
"""`verdi computer` command."""

import pathlib
import traceback
from copy import deepcopy
from functools import partial
from math import isclose
import pathlib

import click

from aiida.cmdline import CMDLINE_LOGGER
from aiida.cmdline.commands.cmd_verdi import VerdiCommandGroup, verdi
from aiida.cmdline.params import arguments, options
from aiida.cmdline.params.options.commands import computer as options_computer
Expand Down Expand Up @@ -769,7 +768,7 @@ def computer_export_setup(computer, output_file):
echo.echo_success(f"Computer<{computer.pk}> {computer.label} setup exported to file '{output_file}'.")
except Exception as e:
error_traceback = traceback.format_exc()
CMDLINE_LOGGER.debug(error_traceback)
echo.CMDLINE_LOGGER.debug(error_traceback)
echo.echo_critical(
f'Unexpected error while exporting setup for Computer<{computer.pk}> {computer.label}:\n ({e!s}).'
)
Expand Down Expand Up @@ -805,7 +804,8 @@ def computer_export_config(computer, user, output_file):
)
except Exception as e:
error_traceback = traceback.format_exc()
CMDLINE_LOGGER.debug(error_traceback)
echo.CMDLINE_LOGGER.debug(error_traceback)
echo.echo_critical(
f'Unexpected error while exporting configuration for Computer<{computer.pk}> {computer.label} and User<{user.pk}> {user.email}: {e!s}.'
f'Unexpected error while exporting configuration for Computer<{computer.pk}> {computer.label}'
f' and User<{user.pk}> {user.email}: {e!s}.'
)
3 changes: 2 additions & 1 deletion src/aiida/cmdline/utils/echo.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@
import collections
import enum
import json
import logging
import sys
from typing import Any, Optional

import click

from aiida.cmdline import CMDLINE_LOGGER
CMDLINE_LOGGER = logging.getLogger('verdi')

__all__ = (
'echo_report',
Expand Down
12 changes: 3 additions & 9 deletions tests/cmdline/commands/test_computer.py
Original file line number Diff line number Diff line change
Expand Up @@ -524,12 +524,8 @@ def test_computer_export_setup(self, tmp_path):
exported_setup_filename = tmp_path / 'computer-setup.yml'
result = self.cli_runner(computer_export_setup, [comp.label, exported_setup_filename])
assert 'Success' in result.output, 'Command should have run successfull.'
assert (
f'{exported_setup_filename}' in result.output
), 'Filename should be in terminal output but was not found.'
assert os.path.exists(
exported_setup_filename
), f"'{exported_setup_filename}' was not created during export."
assert f'{exported_setup_filename}' in result.output, 'Filename should be in terminal output but was not found.'
assert os.path.exists(exported_setup_filename), f"'{exported_setup_filename}' was not created during export."

# verifying correctness by comparing internal and loaded yml object
with open(exported_setup_filename, 'r', encoding='utf-8') as yfhandle:
Expand All @@ -556,9 +552,7 @@ def test_computer_export_config(self, tmp_path):
assert (
f'{exported_config_filename}' in result.output
), 'Filename should be in terminal output but was not found.'
assert os.path.exists(
exported_config_filename
), f"'{exported_config_filename}' was not created during export."
assert os.path.exists(exported_config_filename), f"'{exported_config_filename}' was not created during export."

# verifying correctness by comparing internal and loaded yml object
with open(exported_config_filename, 'r', encoding='utf-8') as yfhandle:
Expand Down

0 comments on commit a6ccf4e

Please sign in to comment.