From 1ac0f096bb9e39d44dddc541015fc472420a88f5 Mon Sep 17 00:00:00 2001 From: Gabriel Levcovitz Date: Fri, 8 Dec 2023 17:54:15 -0300 Subject: [PATCH] review changes --- extras/custom_checks.sh | 4 ++-- hathor/cli/db_export.py | 2 +- hathor/cli/db_import.py | 2 +- .../events_simulator/event_forwarding_websocket_factory.py | 2 +- .../events_simulator/event_forwarding_websocket_protocol.py | 2 +- hathor/cli/openapi_files/register.py | 2 +- hathor/cli/quick_test.py | 2 +- hathor/cli/run_node_args.py | 4 ++-- hathor/cli/shell.py | 2 +- 9 files changed, 11 insertions(+), 11 deletions(-) diff --git a/extras/custom_checks.sh b/extras/custom_checks.sh index 66b899636..40f6ee99c 100644 --- a/extras/custom_checks.sh +++ b/extras/custom_checks.sh @@ -92,10 +92,10 @@ function check_do_not_import_tests_in_hathor() { function check_do_not_import_from_hathor_in_entrypoints() { PATTERN='^import .*hathor.*\|^from .*hathor.* import' - if grep -R "$PATTERN" "hathor/cli" | grep -v '# no-custom-check'; then + if grep -R "$PATTERN" "hathor/cli" | grep -v 'from hathor.cli.run_node import RunNode' | grep -v '# skip-cli-import-custom-check'; then echo 'do not import from `hathor` in the module-level of a CLI entrypoint.' echo 'instead, import locally inside the function that uses the import.' - echo 'alternatively, comment `# no-custom-check` to exclude a line.' + echo 'alternatively, comment `# skip-cli-import-custom-check` to exclude a line.' return 1 fi return 0 diff --git a/hathor/cli/db_export.py b/hathor/cli/db_export.py index 081127826..1a13afd9e 100644 --- a/hathor/cli/db_export.py +++ b/hathor/cli/db_export.py @@ -17,7 +17,7 @@ from argparse import ArgumentParser, FileType from typing import TYPE_CHECKING, Iterator, Optional -from hathor.cli.run_node import RunNode # no-custom-check +from hathor.cli.run_node import RunNode if TYPE_CHECKING: from hathor.transaction import BaseTransaction diff --git a/hathor/cli/db_import.py b/hathor/cli/db_import.py index 7b3ca11a0..a43132c40 100644 --- a/hathor/cli/db_import.py +++ b/hathor/cli/db_import.py @@ -18,7 +18,7 @@ from argparse import ArgumentParser, FileType from typing import TYPE_CHECKING, Iterator -from hathor.cli.run_node import RunNode # no-custom-check +from hathor.cli.run_node import RunNode if TYPE_CHECKING: from hathor.transaction import BaseTransaction diff --git a/hathor/cli/events_simulator/event_forwarding_websocket_factory.py b/hathor/cli/events_simulator/event_forwarding_websocket_factory.py index 2af78d9b5..5b1dad9b3 100644 --- a/hathor/cli/events_simulator/event_forwarding_websocket_factory.py +++ b/hathor/cli/events_simulator/event_forwarding_websocket_factory.py @@ -16,7 +16,7 @@ from twisted.internet.interfaces import IAddress -from hathor.event.websocket import EventWebsocketFactory # no-custom-check +from hathor.event.websocket import EventWebsocketFactory # skip-cli-import-custom-check if TYPE_CHECKING: from hathor.cli.events_simulator.event_forwarding_websocket_protocol import EventForwardingWebsocketProtocol diff --git a/hathor/cli/events_simulator/event_forwarding_websocket_protocol.py b/hathor/cli/events_simulator/event_forwarding_websocket_protocol.py index 4f7c79022..cd6318a0b 100644 --- a/hathor/cli/events_simulator/event_forwarding_websocket_protocol.py +++ b/hathor/cli/events_simulator/event_forwarding_websocket_protocol.py @@ -16,7 +16,7 @@ from autobahn.websocket import ConnectionRequest -from hathor.event.websocket import EventWebsocketProtocol # no-custom-check +from hathor.event.websocket import EventWebsocketProtocol # skip-cli-import-custom-check if TYPE_CHECKING: from hathor.cli.events_simulator.event_forwarding_websocket_factory import EventForwardingWebsocketFactory diff --git a/hathor/cli/openapi_files/register.py b/hathor/cli/openapi_files/register.py index 527747002..aa389d574 100644 --- a/hathor/cli/openapi_files/register.py +++ b/hathor/cli/openapi_files/register.py @@ -14,7 +14,7 @@ from typing import TypeVar -from hathor.api_util import Resource # no-custom-check +from hathor.api_util import Resource # skip-cli-import-custom-check _registered_resources: list[type[Resource]] = [] diff --git a/hathor/cli/quick_test.py b/hathor/cli/quick_test.py index 11eca07ed..1c4fa056a 100644 --- a/hathor/cli/quick_test.py +++ b/hathor/cli/quick_test.py @@ -14,7 +14,7 @@ from argparse import ArgumentParser -from hathor.cli.run_node import RunNode # no-custom-check +from hathor.cli.run_node import RunNode class QuickTest(RunNode): diff --git a/hathor/cli/run_node_args.py b/hathor/cli/run_node_args.py index cedde578d..d6d993b0f 100644 --- a/hathor/cli/run_node_args.py +++ b/hathor/cli/run_node_args.py @@ -16,8 +16,8 @@ from pydantic import Extra -from hathor.feature_activation.feature import Feature # no-custom-check -from hathor.utils.pydantic import BaseModel # no-custom-check +from hathor.feature_activation.feature import Feature # skip-cli-import-custom-check +from hathor.utils.pydantic import BaseModel # skip-cli-import-custom-check class RunNodeArgs(BaseModel, extra=Extra.allow): diff --git a/hathor/cli/shell.py b/hathor/cli/shell.py index c51bd1537..0a1de97d8 100644 --- a/hathor/cli/shell.py +++ b/hathor/cli/shell.py @@ -15,7 +15,7 @@ from argparse import Namespace from typing import Any, Callable -from hathor.cli.run_node import RunNode # no-custom-check +from hathor.cli.run_node import RunNode def get_ipython(extra_args: list[Any], imported_objects: dict[str, Any]) -> Callable[[], None]: