From c29c27dae00cd9bd789b4c0d7a475d9ea7bcdc4b Mon Sep 17 00:00:00 2001 From: shouzy <82171453+realshouzy@users.noreply.github.com> Date: Fri, 10 May 2024 01:07:25 +0200 Subject: [PATCH] Fix `mypy` errors --- nrw/algorithms/__init__.pyi | 14 ++++++++------ tests/algorithms/searching_test.py | 6 +----- tests/algorithms/sorting_test.py | 2 +- tests/algorithms/traversal_test.py | 8 +------- tests/datastructures/binary_search_tree_test.py | 3 ++- tests/datastructures/binary_tree_test.py | 3 ++- tests/datastructures/edge_test.py | 3 +-- tests/datastructures/graph_test.py | 9 +-------- tests/datastructures/list_test.py | 3 ++- tests/datastructures/queue_test.py | 3 ++- tests/datastructures/stack_test.py | 3 ++- tests/datastructures/vertex_test.py | 2 +- 12 files changed, 24 insertions(+), 35 deletions(-) diff --git a/nrw/algorithms/__init__.pyi b/nrw/algorithms/__init__.pyi index a3f8096..cd970e8 100644 --- a/nrw/algorithms/__init__.pyi +++ b/nrw/algorithms/__init__.pyi @@ -16,12 +16,14 @@ __all__: Final[tuple[str, ...]] = ( from typing import Final, TypeVar, overload -from nrw.datastructures._binary_search_tree import BinarySearchTree -from nrw.datastructures._binary_tree import BinaryTree -from nrw.datastructures._comparable_content import ComparableContentT -from nrw.datastructures._graph import Graph -from nrw.datastructures._list import List -from nrw.datastructures._vertex import Vertex +from nrw.datastructures import ( + BinarySearchTree, + BinaryTree, + ComparableContentT, + Graph, + List, + Vertex, +) _T = TypeVar("_T") diff --git a/tests/algorithms/searching_test.py b/tests/algorithms/searching_test.py index a357eea..cfd40ea 100755 --- a/tests/algorithms/searching_test.py +++ b/tests/algorithms/searching_test.py @@ -6,11 +6,7 @@ import pytest -from nrw.algorithms._searching import ( - breadth_first_search, - depth_first_search, - linear_search, -) +from nrw.algorithms import breadth_first_search, depth_first_search, linear_search from nrw.datastructures import Edge, Graph, List, Vertex diff --git a/tests/algorithms/sorting_test.py b/tests/algorithms/sorting_test.py index 79ebd3d..03ce656 100755 --- a/tests/algorithms/sorting_test.py +++ b/tests/algorithms/sorting_test.py @@ -6,7 +6,7 @@ import pytest -from nrw.algorithms._sorting import ( +from nrw.algorithms import ( bubble_sort, insertion_sort, merge_sort, diff --git a/tests/algorithms/traversal_test.py b/tests/algorithms/traversal_test.py index 30256a4..9b24bff 100755 --- a/tests/algorithms/traversal_test.py +++ b/tests/algorithms/traversal_test.py @@ -6,13 +6,7 @@ import pytest -from nrw.algorithms._traversal import ( - inorder, - levelorder, - postorder, - preorder, - reverse_inorder, -) +from nrw.algorithms import inorder, levelorder, postorder, preorder, reverse_inorder from nrw.datastructures import BinarySearchTree, BinaryTree if TYPE_CHECKING: diff --git a/tests/datastructures/binary_search_tree_test.py b/tests/datastructures/binary_search_tree_test.py index c50f228..abe288a 100755 --- a/tests/datastructures/binary_search_tree_test.py +++ b/tests/datastructures/binary_search_tree_test.py @@ -4,7 +4,8 @@ import pytest -from nrw.datastructures._binary_search_tree import BinarySearchTree, _BSTNode +from nrw.datastructures import BinarySearchTree +from nrw.datastructures._binary_search_tree import _BSTNode @pytest.fixture() diff --git a/tests/datastructures/binary_tree_test.py b/tests/datastructures/binary_tree_test.py index 30b699d..4328b70 100755 --- a/tests/datastructures/binary_tree_test.py +++ b/tests/datastructures/binary_tree_test.py @@ -4,7 +4,8 @@ import pytest -from nrw.datastructures._binary_tree import BinaryTree, _BTNode +from nrw.datastructures import BinaryTree +from nrw.datastructures._binary_tree import _BTNode def test_slots_of_btnode() -> None: diff --git a/tests/datastructures/edge_test.py b/tests/datastructures/edge_test.py index df05294..d3d8d4e 100755 --- a/tests/datastructures/edge_test.py +++ b/tests/datastructures/edge_test.py @@ -4,8 +4,7 @@ import pytest -from nrw.datastructures._edge import Edge -from nrw.datastructures._vertex import Vertex +from nrw.datastructures import Edge, Vertex def test_slots_of_edge() -> None: diff --git a/tests/datastructures/graph_test.py b/tests/datastructures/graph_test.py index 28ce2ef..10b2efd 100755 --- a/tests/datastructures/graph_test.py +++ b/tests/datastructures/graph_test.py @@ -2,16 +2,9 @@ """Tests for `datastructures._graph`.""" from __future__ import annotations -from typing import TYPE_CHECKING - import pytest -from nrw.datastructures._edge import Edge -from nrw.datastructures._graph import Graph -from nrw.datastructures._vertex import Vertex - -if TYPE_CHECKING: - from nrw.datastructures._list import List +from nrw.datastructures import Edge, Graph, List, Vertex @pytest.fixture() diff --git a/tests/datastructures/list_test.py b/tests/datastructures/list_test.py index da9d0f8..356a747 100755 --- a/tests/datastructures/list_test.py +++ b/tests/datastructures/list_test.py @@ -4,7 +4,8 @@ import pytest -from nrw.datastructures._list import List, _ListNode +from nrw.datastructures import List +from nrw.datastructures._list import _ListNode @pytest.fixture() diff --git a/tests/datastructures/queue_test.py b/tests/datastructures/queue_test.py index 754e748..14ebb17 100755 --- a/tests/datastructures/queue_test.py +++ b/tests/datastructures/queue_test.py @@ -4,7 +4,8 @@ import pytest -from nrw.datastructures._queue import Queue, _QueueNode +from nrw.datastructures import Queue +from nrw.datastructures._queue import _QueueNode def test_slots_of_queue_node() -> None: diff --git a/tests/datastructures/stack_test.py b/tests/datastructures/stack_test.py index 2f0ee92..f6ec09a 100755 --- a/tests/datastructures/stack_test.py +++ b/tests/datastructures/stack_test.py @@ -4,7 +4,8 @@ import pytest -from nrw.datastructures._stack import Stack, _StackNode +from nrw.datastructures import Stack +from nrw.datastructures._stack import _StackNode def test_slots_of_stack_node() -> None: diff --git a/tests/datastructures/vertex_test.py b/tests/datastructures/vertex_test.py index bdd69f9..4136df2 100755 --- a/tests/datastructures/vertex_test.py +++ b/tests/datastructures/vertex_test.py @@ -4,7 +4,7 @@ import pytest -from nrw.datastructures._vertex import Vertex +from nrw.datastructures import Vertex def test_slots_of_vertex() -> None: