mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-24 08:42:41 +08:00
Various ruff fixes (#12821)
This commit is contained in:
@ -10,7 +10,7 @@ connection from the tree to another vertex.
|
||||
from __future__ import annotations
|
||||
|
||||
from sys import maxsize
|
||||
from typing import Generic, TypeVar
|
||||
from typing import TypeVar
|
||||
|
||||
T = TypeVar("T")
|
||||
|
||||
@ -47,7 +47,7 @@ def get_child_right_position(position: int) -> int:
|
||||
return (2 * position) + 2
|
||||
|
||||
|
||||
class MinPriorityQueue(Generic[T]):
|
||||
class MinPriorityQueue[T]:
|
||||
"""
|
||||
Minimum Priority Queue Class
|
||||
|
||||
@ -184,7 +184,7 @@ class MinPriorityQueue(Generic[T]):
|
||||
self.position_map[node2_elem] = node1_pos
|
||||
|
||||
|
||||
class GraphUndirectedWeighted(Generic[T]):
|
||||
class GraphUndirectedWeighted[T]:
|
||||
"""
|
||||
Graph Undirected Weighted Class
|
||||
|
||||
@ -217,7 +217,7 @@ class GraphUndirectedWeighted(Generic[T]):
|
||||
self.connections[node2][node1] = weight
|
||||
|
||||
|
||||
def prims_algo(
|
||||
def prims_algo[T](
|
||||
graph: GraphUndirectedWeighted[T],
|
||||
) -> tuple[dict[T, int], dict[T, T | None]]:
|
||||
"""
|
||||
|
Reference in New Issue
Block a user