Skip to content

Commit 3095f51

Browse files
author
Release Manager
committed
Trac #34952: sage.graphs: Replace imports from sage.*.all for namespace packages
Using `./sage -fiximports` from #34945. Also remove trailing whitespace in the affected files. Part of Meta-ticket #32414 URL: https://trac.sagemath.org/34952 Reported by: mkoeppe Ticket author(s): Alex Chandler Reviewer(s): David Coudert
2 parents 67eab0a + 180c16b commit 3095f51

File tree

7 files changed

+23
-21
lines changed

7 files changed

+23
-21
lines changed

src/sage/graphs/digraph.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3472,7 +3472,7 @@ def period(self):
34723472
34733473
:meth:`is_aperiodic`
34743474
"""
3475-
from sage.arith.all import gcd
3475+
from sage.arith.misc import GCD as gcd
34763476

34773477
g = 0
34783478

src/sage/graphs/digraph_generators.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ def Paley(self, q):
393393
"""
394394
from sage.rings.finite_rings.integer_mod import mod
395395
from sage.rings.finite_rings.finite_field_constructor import FiniteField
396-
from sage.arith.all import is_prime_power
396+
from sage.arith.misc import is_prime_power
397397
if not is_prime_power(q):
398398
raise ValueError("parameter q must be a prime power")
399399
if not mod(q, 4) == 3:

src/sage/graphs/edge_connectivity.pyx

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,14 @@ cdef class GabowEdgeConnectivity:
6161
....: D = DiGraph(graphs.RandomRegular(6, 50))
6262
sage: GabowEdgeConnectivity(D).edge_connectivity()
6363
6
64-
64+
6565
A complete digraph with `n` vertices is `n-1`-edge-connected::
6666
6767
sage: from sage.graphs.edge_connectivity import GabowEdgeConnectivity
6868
sage: D = DiGraph(digraphs.Complete(10))
6969
sage: GabowEdgeConnectivity(D, use_rec = True).edge_connectivity()
7070
9
71-
71+
7272
Check that we get the same result when with and without the DFS-based
7373
speed-up initialization proposed in [GKLP2021]_::
7474
@@ -79,7 +79,7 @@ cdef class GabowEdgeConnectivity:
7979
sage: ec3 = GabowEdgeConnectivity(D, dfs_preprocessing=True, use_rec=True).edge_connectivity()
8080
sage: ec1 == ec2 and ec2 == ec3
8181
True
82-
82+
8383
TESTS:
8484
8585
:trac:`32169`::
@@ -158,9 +158,9 @@ cdef class GabowEdgeConnectivity:
158158
cdef int augmenting_root
159159
cdef bint* tree_flag # indicate whether a tree Ti has been touched
160160
cdef int* root # current root vertex of f_tree i
161-
cdef int* L_roots # L_roots of the trees
161+
cdef int* L_roots # L_roots of the trees
162162
cdef bint* forests # indicate whether the f_tree is active or inactive
163-
cdef bint** labeled #
163+
cdef bint** labeled #
164164

165165
cdef int** parent_1 # parent of v in tree/forest Ti
166166
cdef int** parent_2 # parent of v in tree/forest Ti
@@ -176,7 +176,7 @@ cdef class GabowEdgeConnectivity:
176176
cdef vector[int] A_path
177177
cdef vector[int] left_traverse
178178
cdef vector[int] right_traverse
179-
179+
180180
cdef bint* seen # for method re_init
181181
cdef int* stack # stack of vertices for DFS in re_init
182182
cdef vector[vector[int]] tree_edges # used to organise the edges of the trees
@@ -243,7 +243,7 @@ cdef class GabowEdgeConnectivity:
243243
self.n = G.order()
244244
self.m = G.size()
245245
self.mem = MemoryAllocator()
246-
246+
247247
# Build compact graph data structure with out and in adjacencies.
248248
# Loops are removed from the graph.
249249
self.build_graph_data_structure()
@@ -420,7 +420,7 @@ cdef class GabowEdgeConnectivity:
420420
if self.dfs_preprocessing and self.num_start_f_trees < self.n - 1:
421421
self.re_init(tree)
422422

423-
# There are n f-trees, and we try to join them
423+
# There are n f-trees, and we try to join them
424424
while njoins < self.num_start_f_trees-1:
425425
# Get the root of an active subtree or INT_MAX if none exists
426426
z = self.choose_root()
@@ -469,7 +469,7 @@ cdef class GabowEdgeConnectivity:
469469
self.my_depth[tree] = <int*>self.mem.calloc(self.n, sizeof(int))
470470
if not self.my_parent_edge_id[tree]:
471471
self.my_parent_edge_id[tree] = <int*>self.mem.calloc(self.n, sizeof(int))
472-
472+
473473
cdef int j
474474
for j in range(self.n):
475475
self.my_parent[tree][j] = 0
@@ -478,9 +478,9 @@ cdef class GabowEdgeConnectivity:
478478
self.labeled[tree][j] = False
479479
self.root[j] = j
480480
self.forests[j] = True
481-
481+
482482
self.num_joins = 0
483-
483+
484484
# Initialize T_k to be a DFS spanning forest of G \ T
485485
if self.dfs_preprocessing:
486486
self.compute_dfs_tree()
@@ -490,7 +490,7 @@ cdef class GabowEdgeConnectivity:
490490

491491
self.L_roots[tree] = self.UNUSED
492492
self.tree_flag[tree] = False
493-
493+
494494
cdef void compute_dfs_tree(self):
495495
r"""
496496
Find a DFS spanning forest of `G \backslash T`.
@@ -525,7 +525,7 @@ cdef class GabowEdgeConnectivity:
525525
self.find_dfs_tree(r)
526526
# Each call of find_dfs_tree creates an f-tree
527527
self.num_start_f_trees += 1
528-
528+
529529
cdef void find_dfs_tree(self, int r):
530530
r"""
531531
Find more vertices of the f-tree rooted at `r`.
@@ -604,7 +604,7 @@ cdef class GabowEdgeConnectivity:
604604
self.num_joins += 1
605605
# recursively find more vertices and grow the subtree rooted at r
606606
self.find_dfs_tree_rec(v, r)
607-
607+
608608
cdef int choose_root(self):
609609
"""
610610
Return the root of an active f_tree, or INT_MAX if none exists.

src/sage/graphs/generators/classical_geometries.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
# ****************************************************************************
2020

2121
from sage.graphs.graph import Graph
22-
from sage.arith.all import is_prime_power
22+
from sage.arith.misc import is_prime_power
2323
from sage.rings.finite_rings.finite_field_constructor import FiniteField
2424

2525

src/sage/graphs/generators/families.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2558,7 +2558,7 @@ def PaleyGraph(q):
25582558
"""
25592559
from sage.rings.finite_rings.integer_mod import mod
25602560
from sage.rings.finite_rings.finite_field_constructor import FiniteField
2561-
from sage.arith.all import is_prime_power
2561+
from sage.arith.misc import is_prime_power
25622562
if not is_prime_power(q):
25632563
raise ValueError("parameter q must be a prime power")
25642564
if not mod(q, 4) == 1:
@@ -3933,7 +3933,7 @@ def MathonPseudocyclicStronglyRegularGraph(t, G=None, L=None):
39333933
from sage.rings.integer_ring import ZZ
39343934
from sage.matrix.constructor import matrix, block_matrix, \
39353935
ones_matrix, identity_matrix
3936-
from sage.arith.all import two_squares
3936+
from sage.arith.misc import two_squares
39373937
p = 4*t + 1
39383938
try:
39393939
x = two_squares(p)

src/sage/graphs/hyperbolicity.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ from cysignals.signals cimport sig_on, sig_off
155155
from memory_allocator cimport MemoryAllocator
156156

157157
from sage.graphs.distances_all_pairs cimport c_distances_all_pairs
158-
from sage.arith.all import binomial
158+
from sage.arith.misc import binomial
159159
from sage.rings.integer_ring import ZZ
160160
from sage.rings.real_mpfr import RR
161161
from sage.data_structures.bitset import Bitset

src/sage/graphs/strongly_regular_db.pyx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ import os
3232

3333
from sage.categories.sets_cat import EmptySetError
3434
from sage.misc.unknown import Unknown
35-
from sage.arith.all import is_square, is_prime_power, divisors
35+
from sage.arith.misc import is_square
36+
from sage.arith.misc import is_prime_power
37+
from sage.arith.misc import divisors
3638
from sage.misc.cachefunc import cached_function
3739
from sage.combinat.designs.orthogonal_arrays import orthogonal_array
3840
from sage.combinat.designs.bibd import balanced_incomplete_block_design

0 commit comments

Comments
 (0)