mirror of
https://github.com/TheAlgorithms/Python.git
synced 2026-03-13 09:50:19 +08:00
pre-commit: Upgrade psf/black for stable style 2023 (#8110)
* pre-commit: Upgrade psf/black for stable style 2023 Updating https://github.com/psf/black ... updating 22.12.0 -> 23.1.0 for their `2023 stable style`. * https://github.com/psf/black/blob/main/CHANGES.md#2310 > This is the first [psf/black] release of 2023, and following our stability policy, it comes with a number of improvements to our stable style… Also, add https://github.com/tox-dev/pyproject-fmt and https://github.com/abravalheri/validate-pyproject to pre-commit. I only modified `.pre-commit-config.yaml` and all other files were modified by pre-commit.ci and psf/black. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
@@ -16,7 +16,6 @@ def search(
|
||||
cost: int,
|
||||
heuristic: list[list[int]],
|
||||
) -> tuple[list[list[int]], list[list[int]]]:
|
||||
|
||||
closed = [
|
||||
[0 for col in range(len(grid[0]))] for row in range(len(grid))
|
||||
] # the reference grid
|
||||
|
||||
@@ -20,7 +20,6 @@ def check_bipartite(graph):
|
||||
visited[u] = True
|
||||
|
||||
for neighbour in graph[u]:
|
||||
|
||||
if neighbour == u:
|
||||
return False
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@ class Graph:
|
||||
self.graph[v - 1][u - 1] = 1
|
||||
|
||||
def show(self):
|
||||
|
||||
for i in self.graph:
|
||||
for j in i:
|
||||
print(j, end=" ")
|
||||
|
||||
@@ -47,7 +47,6 @@ def partition_graph(graph: dict[str, list[str]]) -> set[tuple[str, str]]:
|
||||
graph_copy = {node: graph[node][:] for node in graph}
|
||||
|
||||
while len(graph_copy) > 2:
|
||||
|
||||
# Choose a random edge.
|
||||
u = random.choice(list(graph_copy.keys()))
|
||||
v = random.choice(graph_copy[u])
|
||||
|
||||
@@ -4,7 +4,6 @@ class Graph:
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
|
||||
self.num_vertices = 0
|
||||
self.num_edges = 0
|
||||
self.adjacency = {}
|
||||
|
||||
@@ -33,7 +33,7 @@ class PriorityQueue:
|
||||
temp.append((pri, x))
|
||||
(pri, x) = heapq.heappop(self.elements)
|
||||
temp.append((priority, item))
|
||||
for (pro, xxx) in temp:
|
||||
for pro, xxx in temp:
|
||||
heapq.heappush(self.elements, (pro, xxx))
|
||||
|
||||
def remove_element(self, item):
|
||||
@@ -44,7 +44,7 @@ class PriorityQueue:
|
||||
while x != item:
|
||||
temp.append((pro, x))
|
||||
(pro, x) = heapq.heappop(self.elements)
|
||||
for (prito, yyy) in temp:
|
||||
for prito, yyy in temp:
|
||||
heapq.heappush(self.elements, (prito, yyy))
|
||||
|
||||
def top_show(self):
|
||||
|
||||
Reference in New Issue
Block a user