Skip to content

Commit 431f4b2

Browse files
style: fix Python formatting for black 26.x (#4644)
## Summary Fix Python code formatting to comply with black 26.x which has new formatting rules. ## Changes - Reformatted 14 Python files to comply with black 26.x - Main changes involve multi-line function calls and textwrap.dedent() formatting ## Motivation This fixes the CI Python format check failures that are blocking all PRs, including #4625. The CI installs black 26.x which has stricter/different formatting rules than previous versions. These formatting issues exist in the main branch and are not introduced by any specific PR. ## Test - [x] Run `python3 -m black --check .` locally - passes - [x] Run `python3 -m isort --check .` locally - passes Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
1 parent 613a464 commit 431f4b2

14 files changed

Lines changed: 168 additions & 326 deletions

File tree

coordinator/gscoordinator/monitor.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#
1818

1919
"""Monitor coordinator by prometheus"""
20+
2021
import copy
2122
import functools
2223
import re

coordinator/gscoordinator/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1667,7 +1667,7 @@ def _codegen_app_info(attr, meta_file: str, java_class_path: str):
16671667
algo = attr[types_pb2.APP_ALGO].s.decode("utf-8", errors="ignore")
16681668
# for algo start with giraph:, we don't find info in meta
16691669
if algo.startswith("giraph:") or algo.startswith("java_pie:"):
1670-
(app_type, real_algo) = algo.split(":")
1670+
app_type, real_algo = algo.split(":")
16711671
logger.info("codegen app info for java app: %s", real_algo)
16721672
src_header, app_class, vd_type, java_app_template_str = _probe_for_java_app(
16731673
attr, java_class_path, real_algo

coordinator/setup.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -460,9 +460,7 @@ class _ReprableString(str):
460460
def __repr__(self) -> str: # pylint: disable=invalid-repr-returned
461461
return self
462462

463-
raise RuntimeError(
464-
_ReprableString(
465-
"""
463+
raise RuntimeError(_ReprableString("""
466464
====================================================================
467465
468466
GraphScope doesn't support Windows natively, please try to install graphscope in WSL
@@ -471,6 +469,4 @@ def __repr__(self) -> str: # pylint: disable=invalid-repr-returned
471469
472470
with pip.
473471
474-
===================================================================="""
475-
)
476-
)
472+
===================================================================="""))

python/graphscope/framework/dag.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
"""Classes and functions used to manage dags."""
2020

21-
2221
import queue
2322

2423
from graphscope.framework.operation import Operation

python/graphscope/learning/gs_graph_store.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def _get_edge_index(self, edge_attr: EdgeAttr) -> Optional[EdgeTensorType]:
6666
rows = []
6767
cols = []
6868
for server_id in range(num_servers):
69-
(row, col) = request_server(
69+
row, col = request_server(
7070
server_id, DistServer.get_edge_index, group_name, layout
7171
)
7272
rows.append(row)
@@ -91,7 +91,7 @@ def _get_edge_size(self, edge_attr: EdgeAttr) -> Tuple[int, int]:
9191
size(`tupple(int, int)`): The size of the subgraph.
9292
"""
9393
group_name, layout, is_sorted, _ = self.key(edge_attr)
94-
(row, col) = self._get_edge_index(edge_attr)
94+
row, col = self._get_edge_index(edge_attr)
9595
size = (int(row.max()) + 1, int(col.max()) + 1)
9696
new_edge_attr = EdgeAttr(group_name, layout, is_sorted, size)
9797
self.edge_attrs[(group_name, layout, is_sorted)] = new_edge_attr

python/graphscope/nx/algorithms/tests/builtin/test_attribute_assortativity.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"""
1818
Unit tests for attribute assortativity coefficient.
1919
"""
20+
2021
import pytest
2122

2223
from graphscope import nx

python/graphscope/nx/algorithms/tests/builtin/test_degree_assortativity.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"""
1818
Unit tests for degree assortativity coefficient.
1919
"""
20+
2021
import pytest
2122

2223
from graphscope import nx

python/graphscope/nx/algorithms/tests/builtin/test_degree_centrality.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"""
1818
Unit tests for degree centrality.
1919
"""
20+
2021
import pytest
2122

2223
from graphscope import nx

python/graphscope/nx/algorithms/tests/builtin/test_degree_connectivity.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"""
1818
Unit tests for average degree connectivity.
1919
"""
20+
2021
from itertools import permutations
2122

2223
import pytest

python/graphscope/nx/generators/joint_degree_seq.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
#
1818
"""Generate graphs with a given joint degree and directed joint degree"""
1919

20-
2120
import networkx.generators.joint_degree_seq
2221

2322
from graphscope.nx.utils.compat import import_as_graphscope_nx

0 commit comments

Comments
 (0)