Skip to content

Commit 6216503

Browse files
author
Matthias Koeppe
committed
src/sage/combinat/root_system/cartan_matrix.py: Modularization fixes for imports
1 parent 2463947 commit 6216503

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

src/sage/combinat/root_system/cartan_matrix.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,21 +28,29 @@
2828

2929
from sage.misc.cachefunc import cached_method
3030
from sage.matrix.constructor import matrix
31+
from sage.misc.lazy_import import lazy_import
3132
from sage.structure.element import is_Matrix
3233
from sage.matrix.matrix_space import MatrixSpace
3334
from sage.misc.inherit_comparison import InheritComparisonClasscallMetaclass
3435
from sage.misc.classcall_metaclass import typecall
3536
from sage.combinat.subset import powerset
36-
from sage.matrix.matrix_integer_sparse import Matrix_integer_sparse
3737
from sage.rings.integer_ring import ZZ
3838
from sage.combinat.root_system.cartan_type import CartanType, CartanType_abstract
3939
from sage.combinat.root_system.root_system import RootSystem
4040
from sage.sets.family import Family
41-
from sage.graphs.digraph import DiGraph
4241

42+
lazy_import('sage.graphs.digraph', 'DiGraph')
43+
lazy_import('sage.combinat.root_system.dynkin_diagram', 'DynkinDiagram_class')
4344

44-
class CartanMatrix(Matrix_integer_sparse, CartanType_abstract,
45-
metaclass=InheritComparisonClasscallMetaclass):
45+
46+
try:
47+
from sage.matrix.matrix_integer_sparse import Matrix_integer_sparse as Base
48+
except ImportError:
49+
from sage.matrix.matrix_generic_sparse import Matrix_generic_sparse as Base
50+
51+
52+
class CartanMatrix(Base, CartanType_abstract,
53+
metaclass=InheritComparisonClasscallMetaclass):
4654
r"""
4755
A (generalized) Cartan matrix.
4856
@@ -274,7 +282,6 @@ def __classcall_private__(cls, data=None, index_set=None,
274282
dynkin_diagram = None
275283
subdivisions = None
276284

277-
from sage.combinat.root_system.dynkin_diagram import DynkinDiagram_class
278285
if isinstance(data, DynkinDiagram_class):
279286
dynkin_diagram = data
280287
cartan_type = data._cartan_type

0 commit comments

Comments
 (0)