Skip to content
This repository was archived by the owner on Jan 30, 2023. It is now read-only.

Commit ce8fa70

Browse files
author
Matthias Koeppe
committed
sage.structure, sage.misc: Replace import of sage.categories.all by more specific imports
1 parent e2dcdee commit ce8fa70

File tree

7 files changed

+15
-15
lines changed

7 files changed

+15
-15
lines changed

src/sage/categories/action.pyx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ cdef inline category(x):
7171
try:
7272
return x.category()
7373
except AttributeError:
74-
import sage.categories.all
75-
return sage.categories.all.Objects()
74+
from sage.categories.objects import Objects
75+
return Objects()
7676

7777

7878
cdef class Action(Functor):

src/sage/misc/functional.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,8 @@ def category(x):
127127
try:
128128
return x.category()
129129
except AttributeError:
130-
import sage.categories.all
131-
return sage.categories.all.Objects()
130+
from sage.categories.objects import Objects
131+
return Objects()
132132

133133

134134
def characteristic_polynomial(x, var='x'):

src/sage/misc/nested_class_test.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def __init__(self):
6363
sage: sage.misc.nested_class_test.TestParent1()
6464
<sage.misc.nested_class_test.TestParent1_with_category object at ...>
6565
"""
66-
from sage.categories.all import Sets
66+
from sage.categories.sets_cat import Sets
6767
Parent.__init__(self, category = Sets())
6868

6969
class Element(ElementWrapper):
@@ -80,7 +80,7 @@ def __init__(self):
8080
...
8181
TypeError: metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases
8282
"""
83-
from sage.categories.all import Sets
83+
from sage.categories.sets_cat import Sets
8484
Parent.__init__(self, category = Sets())
8585

8686
class Element(ElementWrapper):
@@ -96,7 +96,7 @@ def __init__(self):
9696
sage: sage.misc.nested_class_test.TestParent3()
9797
<sage.misc.nested_class_test.TestParent3_with_category object at ...>
9898
"""
99-
from sage.categories.all import Sets
99+
from sage.categories.sets_cat import Sets
100100
Parent.__init__(self, category = Sets())
101101

102102
class Element(ElementWrapper):
@@ -111,7 +111,7 @@ def __init__(self):
111111
sage: sage.misc.nested_class_test.TestParent4()
112112
<sage.misc.nested_class_test.TestParent4_with_category object at ...>
113113
"""
114-
from sage.categories.all import Sets
114+
from sage.categories.sets_cat import Sets
115115
Parent.__init__(self, category=Sets())
116116

117117
def __eq__(self, other):

src/sage/structure/category_object.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -647,7 +647,7 @@ cdef class CategoryObject(SageObject):
647647
return self._Hom_(codomain, cat)
648648
except (AttributeError, TypeError):
649649
pass
650-
from sage.categories.all import Hom
650+
from sage.categories.homset import Hom
651651
return Hom(self, codomain, cat)
652652

653653
def latex_variable_names(self):

src/sage/structure/element.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -653,7 +653,7 @@ cdef class Element(SageObject):
653653
return self._parent.base_ring()
654654

655655
def category(self):
656-
from sage.categories.all import Elements
656+
from sage.categories.category_types import Elements
657657
return Elements(self._parent)
658658

659659
def _test_new(self, **options):

src/sage/structure/sage_object.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ cdef class SageObject:
480480
#############################################################################
481481

482482
def category(self):
483-
from sage.categories.all import Objects
483+
from sage.categories.objects import Objects
484484
return Objects()
485485

486486
def _test_category(self, **options):

src/sage/structure/sequence.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -232,8 +232,8 @@ def Sequence(x, universe=None, check=True, immutable=False, cr=False, cr_str=Non
232232
x = list(x) # make a copy even if x is a list, we're going to change it
233233

234234
if len(x) == 0:
235-
import sage.categories.all
236-
universe = sage.categories.all.Objects()
235+
from sage.categories.objects import Objects
236+
universe = Objects()
237237
else:
238238
import sage.structure.element
239239
if use_sage_types:
@@ -244,8 +244,8 @@ def Sequence(x, universe=None, check=True, immutable=False, cr=False, cr_str=Non
244244
try:
245245
x[i], x[i+1] = sage.structure.element.canonical_coercion(x[i],x[i+1])
246246
except TypeError:
247-
import sage.categories.all
248-
universe = sage.categories.all.Objects()
247+
from sage.categories.objects import Objects
248+
universe = Objects()
249249
x = list(orig_x)
250250
check = False # no point
251251
break

0 commit comments

Comments
 (0)