Skip to content

Commit d48a809

Browse files
author
Release Manager
committed
gh-36573: Replace relative imports by absolute ones in structure <!-- ^^^^^ Please provide a concise, informative and self-explanatory title. Don't put issue numbers in there, do this in the PR body below. For example, instead of "Fixes #1234" use "Introduce new method to calculate 1+1" --> <!-- Describe your changes here in detail --> Relative imports are not used consistently in the codebase and result in issues for doctesting with pytest (which admittedly is a limitation of pytest). We normalize the relative imports in `sage.structure` to be absolute imports. <!-- Why is this change required? What problem does it solve? --> <!-- If this PR resolves an open issue, please link to it here. For example "Fixes #12345". --> <!-- If your change requires a documentation PR, please link it appropriately. --> ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> <!-- If your change requires a documentation PR, please link it appropriately --> <!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> <!-- Feel free to remove irrelevant items. --> - [x] The title is concise, informative, and self-explanatory. - [x] The description explains in detail what this PR is about. - [ ] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation accordingly. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on - #12345: short description why this is a dependency - #34567: ... --> <!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> URL: #36573 Reported by: Tobias Diez Reviewer(s):
2 parents f53e808 + 460d967 commit d48a809

File tree

12 files changed

+36
-35
lines changed

12 files changed

+36
-35
lines changed

src/sage/structure/all.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
1-
from .factorization import Factorization
1+
from sage.structure.factorization import Factorization
22

3-
from .sequence import Sequence, seq
3+
from sage.structure.sequence import Sequence, seq
44

5-
from .unique_representation import UniqueRepresentation
5+
from sage.structure.unique_representation import UniqueRepresentation
66

7-
from .sage_object import SageObject
7+
from sage.structure.sage_object import SageObject
88

9-
from .element import (
9+
from sage.structure.element import (
1010
canonical_coercion,
1111
coercion_model,
1212
get_coercion_model,
1313
coercion_traceback,
1414
parent
1515
)
1616

17-
from .parent import Parent
17+
from sage.structure.parent import Parent
1818

19-
from .parent_gens import localvars
19+
from sage.structure.parent_gens import localvars
2020

21-
from .proof import all as proof
21+
from sage.structure.proof import all as proof
2222

2323
from sage.misc.lazy_import import lazy_import
2424
lazy_import('sage.structure.formal_sum', ['FormalSums', 'FormalSum'])
2525
del lazy_import
2626

27-
from .mutability import Mutability
27+
from sage.structure.mutability import Mutability
2828

29-
from .element_wrapper import ElementWrapper
29+
from sage.structure.element_wrapper import ElementWrapper

src/sage/structure/coerce.pxd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
from .parent cimport Parent
2-
from .coerce_dict cimport TripleDict
1+
from sage.structure.parent cimport Parent
2+
from sage.structure.coerce_dict cimport TripleDict
33

44
cpdef py_scalar_parent(py_type) noexcept
55
cpdef py_scalar_to_element(py) noexcept

src/sage/structure/coerce.pyx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,11 @@ cimport gmpy2
8484
cdef mul, truediv
8585
from operator import mul, truediv
8686

87-
from .richcmp cimport rich_to_bool, revop
88-
from .sage_object cimport SageObject
89-
from .parent cimport Parent_richcmp_element_without_coercion
90-
from .element cimport bin_op_exception, parent, Element
91-
from .coerce_exceptions import CoercionException
87+
from sage.structure.richcmp cimport rich_to_bool, revop
88+
from sage.structure.sage_object cimport SageObject
89+
from sage.structure.parent cimport Parent_richcmp_element_without_coercion
90+
from sage.structure.element cimport bin_op_exception, parent, Element
91+
from sage.structure.coerce_exceptions import CoercionException
9292
from sage.rings.integer_fake cimport is_Integer
9393
from sage.categories.map cimport Map
9494
from sage.categories.morphism import IdentityMorphism

src/sage/structure/coerce_actions.pyx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ from cpython.long cimport *
1818
from cpython.number cimport *
1919
from cysignals.signals cimport sig_check
2020

21-
from .coerce cimport coercion_model
22-
from .element cimport parent, Element, ModuleElement
23-
from .parent cimport Parent
24-
from .coerce_exceptions import CoercionException
21+
from sage.structure.coerce cimport coercion_model
22+
from sage.structure.element cimport parent, Element, ModuleElement
23+
from sage.structure.parent cimport Parent
24+
from sage.structure.coerce_exceptions import CoercionException
2525
from sage.categories.action cimport InverseAction, PrecomposedAction
2626
from sage.arith.long cimport integer_check_long
2727

src/sage/structure/element.pxd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
from .sage_object cimport SageObject
2-
from .parent cimport Parent
1+
from sage.structure.sage_object cimport SageObject
2+
from sage.structure.parent cimport Parent
33
from sage.misc.inherit_comparison cimport InheritComparisonMetaclass
44

55

src/sage/structure/factory.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ AUTHORS:
5656

5757
import types
5858

59-
from .sage_object cimport SageObject
59+
from sage.structure.sage_object cimport SageObject
6060

6161
cdef sage_version
6262
from sage.version import version as sage_version

src/sage/structure/parent.pyx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -119,13 +119,13 @@ from sage.misc.lazy_attribute import lazy_attribute
119119
from sage.categories.sets_cat import Sets, EmptySetError
120120
from sage.misc.lazy_string cimport _LazyString
121121
from sage.sets.pythonclass cimport Set_PythonType_class
122-
from .category_object import CategoryObject
123-
from .coerce cimport coercion_model
124-
from .coerce cimport parent_is_integers
125-
from .coerce_exceptions import CoercionException
126-
from .coerce_maps cimport (NamedConvertMap, DefaultConvertMap,
122+
from sage.structure.category_object import CategoryObject
123+
from sage.structure.coerce cimport coercion_model
124+
from sage.structure.coerce cimport parent_is_integers
125+
from sage.structure.coerce_exceptions import CoercionException
126+
from sage.structure.coerce_maps cimport (NamedConvertMap, DefaultConvertMap,
127127
DefaultConvertMap_unique, CallableConvertMap)
128-
from .element cimport parent
128+
from sage.structure.element cimport parent
129129

130130

131131
cdef _record_exception() noexcept:

src/sage/structure/parent_base.pxd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# https://www.gnu.org/licenses/
77
###############################################################################
88

9-
from .parent_old cimport Parent as Parent_old
9+
from sage.structure.parent_old cimport Parent as Parent_old
1010

1111
cdef class ParentWithBase(Parent_old):
1212
pass

src/sage/structure/parent_base.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Base class for old-style parent objects with a base ring
1212
# ****************************************************************************
1313

1414
cimport sage.structure.parent as parent
15-
from .coerce_exceptions import CoercionException
15+
from sage.structure.coerce_exceptions import CoercionException
1616

1717
cdef inline check_old_coerce(parent.Parent p) noexcept:
1818
if p._element_constructor is not None:

src/sage/structure/parent_gens.pxd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Parent objects with generators
1212
# http://www.gnu.org/licenses/
1313
#*****************************************************************************
1414

15-
from .parent_base cimport ParentWithBase
15+
from sage.structure.parent_base cimport ParentWithBase
1616

1717

1818
cdef class ParentWithGens(ParentWithBase):

0 commit comments

Comments
 (0)