diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8fc444b..2b264af 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -34,12 +34,12 @@ repos: hooks: - id: isort - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.7.2 + rev: v0.8.1 hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix] - repo: https://github.com/pycqa/bandit - rev: 1.7.10 + rev: 1.8.0 hooks: - id: bandit args: [-c, pyproject.toml] diff --git a/nrw/algorithms/__init__.py b/nrw/algorithms/__init__.py index f2fc111..2cf8f44 100644 --- a/nrw/algorithms/__init__.py +++ b/nrw/algorithms/__init__.py @@ -3,18 +3,18 @@ from __future__ import annotations __all__: Final[list[str]] = [ - "linear_search", - "depth_first_search", "breadth_first_search", "bubble_sort", - "selection_sort", + "depth_first_search", + "inorder", "insertion_sort", + "levelorder", + "linear_search", "merge_sort", - "quick_sort", - "preorder", - "inorder", "postorder", - "levelorder", + "preorder", + "quick_sort", + "selection_sort", ] from typing import Final diff --git a/nrw/algorithms/__init__.pyi b/nrw/algorithms/__init__.pyi index d19b366..fc5345b 100644 --- a/nrw/algorithms/__init__.pyi +++ b/nrw/algorithms/__init__.pyi @@ -1,17 +1,17 @@ # pylint: skip-file __all__: Final[list[str]] = [ - "linear_search", - "depth_first_search", "breadth_first_search", "bubble_sort", - "selection_sort", + "depth_first_search", + "inorder", "insertion_sort", + "levelorder", + "linear_search", "merge_sort", - "quick_sort", - "preorder", - "inorder", "postorder", - "levelorder", + "preorder", + "quick_sort", + "selection_sort", ] from typing import Final, TypeVar, overload diff --git a/nrw/algorithms/_searching.py b/nrw/algorithms/_searching.py index 4371100..9a4eee6 100644 --- a/nrw/algorithms/_searching.py +++ b/nrw/algorithms/_searching.py @@ -3,9 +3,9 @@ from __future__ import annotations __all__: Final[list[str]] = [ - "linear_search", - "depth_first_search", "breadth_first_search", + "depth_first_search", + "linear_search", ] from typing import TYPE_CHECKING, Final, TypeVar diff --git a/nrw/algorithms/_sorting.py b/nrw/algorithms/_sorting.py index cc7c243..96c7415 100644 --- a/nrw/algorithms/_sorting.py +++ b/nrw/algorithms/_sorting.py @@ -4,10 +4,10 @@ __all__: Final[list[str]] = [ "bubble_sort", - "selection_sort", "insertion_sort", "merge_sort", "quick_sort", + "selection_sort", ] from typing import TYPE_CHECKING, Final diff --git a/nrw/algorithms/_traversal.py b/nrw/algorithms/_traversal.py index 9f43177..d897e24 100644 --- a/nrw/algorithms/_traversal.py +++ b/nrw/algorithms/_traversal.py @@ -3,10 +3,10 @@ from __future__ import annotations __all__: Final[list[str]] = [ - "preorder", "inorder", - "postorder", "levelorder", + "postorder", + "preorder", ] from typing import Final, TypeVar diff --git a/nrw/database/_query_result.py b/nrw/database/_query_result.py index e1d4ecb..023641f 100644 --- a/nrw/database/_query_result.py +++ b/nrw/database/_query_result.py @@ -15,7 +15,7 @@ class QueryResult: Die Klasse verfügt über keinen öffentlichen Konstruktor. """ - __slots__: Final[tuple[str, str, str]] = ("_data", "_column_names", "_column_types") + __slots__: Final[tuple[str, str, str]] = ("_column_names", "_column_types", "_data") def __init__( self, diff --git a/nrw/database/_query_result.pyi b/nrw/database/_query_result.pyi index 9e4df32..bdbbdd2 100644 --- a/nrw/database/_query_result.pyi +++ b/nrw/database/_query_result.pyi @@ -4,7 +4,7 @@ __all__: Final[list[str]] = ["QueryResult"] from typing import Any, Final class QueryResult: - __slots__: Final[tuple[str, str, str]] = ("_data", "_column_names", "_column_types") + __slots__: Final[tuple[str, str, str]] = ("_column_names", "_column_types", "_data") def __init__( self, data: list[tuple[Any, ...]], diff --git a/nrw/datastructures/__init__.py b/nrw/datastructures/__init__.py index a4d71ad..24ca90d 100644 --- a/nrw/datastructures/__init__.py +++ b/nrw/datastructures/__init__.py @@ -3,16 +3,16 @@ from __future__ import annotations __all__: Final[list[str]] = [ - "Stack", - "Queue", - "List", + "BinarySearchTree", "BinaryTree", "ComparableContent", "ComparableContentT", - "Vertex", "Edge", - "BinarySearchTree", "Graph", + "List", + "Queue", + "Stack", + "Vertex", ] diff --git a/nrw/datastructures/__init__.pyi b/nrw/datastructures/__init__.pyi index d162056..5067f5f 100644 --- a/nrw/datastructures/__init__.pyi +++ b/nrw/datastructures/__init__.pyi @@ -1,15 +1,15 @@ # pylint: skip-file __all__: Final[list[str]] = [ - "Stack", - "Queue", - "List", + "BinarySearchTree", "BinaryTree", "ComparableContent", "ComparableContentT", - "Vertex", "Edge", - "BinarySearchTree", "Graph", + "List", + "Queue", + "Stack", + "Vertex", ] from typing import Final, Generic, TypeVar, overload @@ -43,7 +43,7 @@ class Stack(Generic[_T]): def top(self) -> _T | None: ... class List(Generic[_T]): - __slots__: Final[tuple[str, str, str]] = ("_first", "_last", "_current") + __slots__: Final[tuple[str, str, str]] = ("_current", "_first", "_last") __hash__ = None # type: ignore[assignment] def __init__(self) -> None: ... @@ -131,7 +131,7 @@ class Vertex: def is_marked(self) -> bool: ... class Edge: - __slots__: Final[tuple[str, str, str]] = ("_vertices", "_weight", "_mark") + __slots__: Final[tuple[str, str, str]] = ("_mark", "_vertices", "_weight") __hash__ = None # type: ignore[assignment] def __init__(self, vertex: Vertex, another_vertex: Vertex, weight: int) -> None: ... @@ -149,7 +149,7 @@ class Edge: def is_marked(self) -> bool: ... class Graph: - __slots__: Final[tuple[str, str]] = ("_vertices", "_edges") + __slots__: Final[tuple[str, str]] = ("_edges", "_vertices") __hash__ = None # type: ignore[assignment] def __init__(self) -> None: ... diff --git a/nrw/datastructures/_edge.py b/nrw/datastructures/_edge.py index 07e5762..dec1d20 100644 --- a/nrw/datastructures/_edge.py +++ b/nrw/datastructures/_edge.py @@ -18,7 +18,7 @@ class Edge: und eine Markierung gesetzt und abgefragt werden. """ - __slots__: Final[tuple[str, str, str]] = ("_vertices", "_weight", "_mark") + __slots__: Final[tuple[str, str, str]] = ("_mark", "_vertices", "_weight") __hash__ = None # type: ignore[assignment] def __init__(self, vertex: Vertex, another_vertex: Vertex, weight: int) -> None: diff --git a/nrw/datastructures/_graph.py b/nrw/datastructures/_graph.py index 8306b3d..f542a4b 100644 --- a/nrw/datastructures/_graph.py +++ b/nrw/datastructures/_graph.py @@ -27,7 +27,7 @@ class Graph: Knotenobjekt zu einer bestimmten ID gehört und ob der Graph leer ist. """ - __slots__: Final[tuple[str, str]] = ("_vertices", "_edges") + __slots__: Final[tuple[str, str]] = ("_edges", "_vertices") __hash__ = None # type: ignore[assignment] def __init__(self) -> None: diff --git a/nrw/datastructures/_list.py b/nrw/datastructures/_list.py index 753d6aa..d83e053 100644 --- a/nrw/datastructures/_list.py +++ b/nrw/datastructures/_list.py @@ -61,7 +61,7 @@ class List(Generic[_T]): kann vor dem aktuellen Objekt ein Listenobjekt eingefügt werden. """ - __slots__: Final[tuple[str, str, str]] = ("_first", "_last", "_current") + __slots__: Final[tuple[str, str, str]] = ("_current", "_first", "_last") __hash__ = None # type: ignore[assignment] def __init__(self) -> None: diff --git a/nrw/network/__init__.py b/nrw/network/__init__.py index d911337..8ad51ae 100644 --- a/nrw/network/__init__.py +++ b/nrw/network/__init__.py @@ -2,7 +2,7 @@ from __future__ import annotations -__all__: Final[list[str]] = ["Connection", "Client", "Server"] +__all__: Final[list[str]] = ["Client", "Connection", "Server"] from typing import Final diff --git a/nrw/network/__init__.pyi b/nrw/network/__init__.pyi index a73817e..d35f98c 100644 --- a/nrw/network/__init__.pyi +++ b/nrw/network/__init__.pyi @@ -1,18 +1,18 @@ # pylint: skip-file -__all__: Final[list[str]] = ["Connection", "Client", "Server"] +__all__: Final[list[str]] = ["Client", "Connection", "Server"] from abc import ABC, abstractmethod from typing import Final class Connection: - __slots__: Final[tuple[str, str, str]] = ("_socket", "_to_server", "_from_server") + __slots__: Final[tuple[str, str, str]] = ("_from_server", "_socket", "_to_server") def __init__(self, server_ip: str, server_port: int) -> None: ... def receive(self) -> str | None: ... def send(self, message: str) -> None: ... def close(self) -> None: ... class Client(ABC): - __slots__: Final[tuple[str, str]] = ("_socket_wrapper", "_active") + __slots__: Final[tuple[str, str]] = ("_active", "_socket_wrapper") def __init__(self, server_ip: str, server_port: int) -> None: ... @property def is_connected(self) -> bool: ... @@ -25,8 +25,8 @@ class Server(ABC): __slots__: Final[tuple[str, str, str, str]] = ( "__weakref__", "_connection_handler", - "_message_handlers", "_lock", + "_message_handlers", ) def __init__(self, port: int) -> None: ... @property diff --git a/nrw/network/_client.py b/nrw/network/_client.py index f71a315..013b80e 100644 --- a/nrw/network/_client.py +++ b/nrw/network/_client.py @@ -15,7 +15,7 @@ class _SocketWrapper: - __slots__: Final[tuple[str, str, str]] = ("_socket", "_to_server", "_from_server") + __slots__: Final[tuple[str, str, str]] = ("_from_server", "_socket", "_to_server") def __init__(self, server_ip: str, server_port: int) -> None: try: @@ -73,7 +73,7 @@ class Client(ABC): Eine einmal unterbrochene oder getrennte Verbindung kann nicht reaktiviert werden. """ - __slots__: Final[tuple[str, str]] = ("_socket_wrapper", "_active") + __slots__: Final[tuple[str, str]] = ("_active", "_socket_wrapper") def __init__(self, server_ip: str, server_port: int) -> None: """Es wird eine Verbindung zum durch `server_ip` und `server_port` diff --git a/nrw/network/_connection.py b/nrw/network/_connection.py index 098056d..ef8ca0f 100644 --- a/nrw/network/_connection.py +++ b/nrw/network/_connection.py @@ -24,7 +24,7 @@ class Connection: reaktiviert werden. """ - __slots__: Final[tuple[str, str, str]] = ("_socket", "_to_server", "_from_server") + __slots__: Final[tuple[str, str, str]] = ("_from_server", "_socket", "_to_server") def __init__(self, server_ip: str, server_port: int) -> None: """Ein Objekt vom Typ `Connection` wird erstellt. Dadurch wird eine Verbindung diff --git a/nrw/network/_server.py b/nrw/network/_server.py index 1d1c8df..40102b1 100644 --- a/nrw/network/_server.py +++ b/nrw/network/_server.py @@ -24,7 +24,7 @@ class _NewConnectionHandler(threading.Thread): - __slots__: Final[tuple[str, str, str]] = ("_server", "_active", "_server_socket") + __slots__: Final[tuple[str, str, str]] = ("_active", "_server", "_server_socket") def __init__( self, @@ -74,8 +74,8 @@ def close(self) -> None: class _ClientSocketWrapper: __slots__: Final[tuple[str, str, str]] = ( "_client_socket", - "_to_client", "_from_client", + "_to_client", ) def __init__(self, client_socket: socket.socket | None) -> None: @@ -135,7 +135,7 @@ def close(self) -> None: class _ClientMessageHandler(threading.Thread): - __slots__: Final[tuple[str, str, str]] = ("_server", "_active", "_socket_wrapper") + __slots__: Final[tuple[str, str, str]] = ("_active", "_server", "_socket_wrapper") def __init__(self, client_socket: socket.socket | None, server: Server) -> None: super().__init__() @@ -210,9 +210,9 @@ class Server(ABC): __slots__: Final[tuple[str, str, str, str]] = ( "__weakref__", + "_connection_handler", "_lock", "_message_handlers", - "_connection_handler", ) def __init__(self, port: int) -> None: