Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace imports from sage.graphs.all by more specific imports #33199

Closed
mkoeppe opened this issue Jan 17, 2022 · 19 comments
Closed

Replace imports from sage.graphs.all by more specific imports #33199

mkoeppe opened this issue Jan 17, 2022 · 19 comments

Comments

@mkoeppe
Copy link
Member

mkoeppe commented Jan 17, 2022

Depends on #32989
Depends on #32999
Depends on #33007

CC: @fchapoton @tobiasdiez @dcoudert

Component: refactoring

Author: Matthias Koeppe

Branch/Commit: 1dbef4d

Reviewer: David Coudert

Issue created by migration from https://trac.sagemath.org/ticket/33199

@mkoeppe mkoeppe added this to the sage-9.6 milestone Jan 17, 2022
@mkoeppe
Copy link
Member Author

mkoeppe commented Jan 17, 2022

Author: Matthias Koeppe

@mkoeppe
Copy link
Member Author

mkoeppe commented Jan 17, 2022

@mkoeppe
Copy link
Member Author

mkoeppe commented Jan 17, 2022

Last 10 new commits:

a9b7517git grep -l 'interfaces.all import' | xargs sed -E -i.bak 's/interfaces[.]all import ([a-z][a-z]*)/interfaces.\1 import \1/'
607316fRemove remaining imports from sage.interfaces.all
0e814dcMerge #32989
37789fdMerge tag '9.5.beta9' into t/33007/remove_imports_from_sage_interfaces_all
584d121src/sage/rings/polynomial/multi_polynomial_libsingular.pyx: Fix import
89e99f5Merge #33007
84a887eMerge #32999
0694b04git grep -l 'graphs.all.*import' | xargs sed -E -i.bak $'s/^( *)from sage.*all import Graph, DiGraph *$/\1from sage.graphs.graph import Graph\n\1from sage.graphs.digraph import Digraph/;s/from sage.*all import Graph/from sage.graphs.graph import Graph/;s/from sage.*all import DiGraph/from sage.graphs.digraph import DiGraph/;'
5ec356bgit grep -l 'graphs.all.*import' | xargs sed -E -i.bak 's/from sage.graphs.all import graphs/from sage.graphs.graph_generators import graphs/'
cfb1086src/sage/matroids/utilities.py: Replace imports from sage.graphs.all, sage.rings.all

@mkoeppe
Copy link
Member Author

mkoeppe commented Jan 17, 2022

Commit: cfb1086

@mkoeppe
Copy link
Member Author

mkoeppe commented Jan 17, 2022

Dependencies: #32989, #32999, #33007

@dcoudert
Copy link
Contributor

comment:5

in b/src/sage/sandpiles/sandpile.py the following change is not correct

-from sage.graphs.all import DiGraph, Graph
+from sage.graphs.digraph import DiGraph, Graph

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jan 17, 2022

Changed commit from cfb1086 to f12c46f

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jan 17, 2022

Branch pushed to git repo; I updated commit sha1. New commits:

f12c46fsrc/sage/sandpiles/sandpile.py: Fix up imports

@fchapoton
Copy link
Contributor

comment:7

hmmm

[2/2] Cythonizing sage/matroids/linear_matroid.pyx

Error compiling Cython file:
------------------------------------------------------------
...
    cdef int isdigraph

    from sage.graphs.graph import Graph
    from sage.graphs.digraph import Digraph

    if isinstance(G, DiGraph):

@dcoudert
Copy link
Contributor

comment:8

Right, Digraph instead of DiGraph

@dcoudert
Copy link
Contributor

comment:9

same issue several times in b/src/sage/graphs/generic_graph.py like

@@ -22848,7 +22849,8 @@ class GenericGraph(GenericGraph_pyx):
             G2 = other
             partition2 = other_vertices
         G_to = {u: i for i,u in enumerate(self_vertices)}
-        from sage.graphs.all import Graph, DiGraph
+        from sage.graphs.graph import Graph
+        from sage.graphs.digraph import Digraph

and also in b/src/sage/groups/perm_gps/partn_ref/refinement_graphs.pyx

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jan 18, 2022

Branch pushed to git repo; I updated commit sha1. New commits:

1dbef4dgit grep -l 'import Digraph' | xargs sed -i.bak 's/import Digraph/import DiGraph/'

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jan 18, 2022

Changed commit from f12c46f to 1dbef4d

@mkoeppe
Copy link
Member Author

mkoeppe commented Jan 18, 2022

comment:11

Sorry, typo'd in one of my substitution commands

@dcoudert
Copy link
Contributor

Reviewer: David Coudert

@dcoudert
Copy link
Contributor

comment:12

LGTM.

@mkoeppe
Copy link
Member Author

mkoeppe commented Jan 19, 2022

comment:13

Thanks!

@dcoudert
Copy link
Contributor

comment:14

For information, I have tested the ticket with 9.5.rc3.

@vbraun
Copy link
Member

vbraun commented Feb 13, 2022

mkoeppe added a commit to mkoeppe/sage that referenced this issue Feb 12, 2023
mkoeppe added a commit to mkoeppe/sage that referenced this issue Feb 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants