Skip to content

Commit ea72271

Browse files
authored
Fix code quality problems (#502)
1 parent 9aaa140 commit ea72271

File tree

7 files changed

+24
-9
lines changed

7 files changed

+24
-9
lines changed

.idea/copilot.data.migration.ask.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/copilot.data.migration.ask2agent.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/ephys-link.iml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/ephys_link/front_end/gui.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from os import makedirs
1313
from os.path import exists, join
1414
from socket import gethostbyname, gethostname
15-
from sys import exit
15+
from sys import exit as sys_exit
1616
from tkinter import CENTER, RIGHT, BooleanVar, E, IntVar, StringVar, Tk, ttk
1717
from typing import final
1818

@@ -73,7 +73,7 @@ def get_options(self) -> EphysLinkOptions:
7373

7474
# Exit if the user did not submit options.
7575
if not self._submit:
76-
exit(1)
76+
sys_exit(1)
7777

7878
# Extract options from GUI.
7979
options = EphysLinkOptions(

src/ephys_link/utils/startup.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
from pkgutil import iter_modules
66

77
from packaging.version import parse
8-
from requests import ConnectionError, ConnectTimeout, get
8+
from requests import ConnectionError as RequestsConnectionError
9+
from requests import ConnectTimeout as RequestsConnectTimeout
10+
from requests import get
911
from vbl_aquarium.models.ephys_link import EphysLinkOptions
1012

1113
from ephys_link.__about__ import __version__
@@ -45,7 +47,7 @@ def check_for_updates(console: Console) -> None:
4547
if parse(latest_version) > parse(__version__):
4648
console.critical_print(f"Update available: {latest_version} (current: {__version__})")
4749
console.critical_print("Download at: https://github.com/VirtualBrainLab/ephys-link/releases/latest")
48-
except (ConnectionError, ConnectTimeout):
50+
except (RequestsConnectionError, RequestsConnectTimeout):
4951
console.error_print("UPDATE", UNABLE_TO_CHECK_FOR_UPDATES_ERROR)
5052

5153

tests/utils/test_startup.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33

44
import pytest
55
from pytest_mock import MockerFixture
6-
from requests import ConnectionError, ConnectTimeout
6+
from requests import ConnectionError as RequestsConnectionError
7+
from requests import ConnectTimeout as RequestsConnectTimeout
78
from vbl_aquarium.models.ephys_link import EphysLinkOptions
89

910
from ephys_link.__about__ import __version__
@@ -76,9 +77,9 @@ def test_check_for_updates_is_older(self, console: Console, mocker: MockerFixtur
7677
# Assert: critical_print should be called since an update is available.
7778
spied_critical_print.assert_called()
7879

79-
@pytest.mark.parametrize("exception", [ConnectionError, ConnectTimeout])
80+
@pytest.mark.parametrize("exception", [RequestsConnectionError, RequestsConnectTimeout])
8081
def test_check_for_updates_connection_errors(
81-
self, exception: ConnectionError | ConnectTimeout, console: Console, mocker: MockerFixture
82+
self, exception: RequestsConnectionError | RequestsConnectTimeout, console: Console, mocker: MockerFixture
8283
) -> None:
8384
"""Test the check_for_updates function with connection-related errors."""
8485
# Add mocks and spies.

0 commit comments

Comments
 (0)