Skip to content

Commit

Permalink
review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
glevco committed Dec 8, 2023
1 parent 9c984aa commit 1ac0f09
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions extras/custom_checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion hathor/cli/db_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion hathor/cli/db_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion hathor/cli/openapi_files/register.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]] = []

Expand Down
2 changes: 1 addition & 1 deletion hathor/cli/quick_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
4 changes: 2 additions & 2 deletions hathor/cli/run_node_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion hathor/cli/shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]:
Expand Down

0 comments on commit 1ac0f09

Please sign in to comment.