Skip to content

Commit

Permalink
Replace relative imports in Cython files
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthias Koeppe committed Sep 8, 2023
1 parent dfceb98 commit 7d04241
Show file tree
Hide file tree
Showing 104 changed files with 324 additions and 324 deletions.
4 changes: 2 additions & 2 deletions src/sage/categories/action.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ from sage.categories.map cimport Map
from sage.structure.element cimport parent
from sage.structure.parent cimport Parent

from . import homset
from sage.categories import homset
from weakref import ref


Expand Down Expand Up @@ -92,7 +92,7 @@ cdef class Action(Functor):
:class:`Action` itself, but other classes may use it
"""
def __init__(self, G, S, is_left=True, op=None):
from .groupoid import Groupoid
from sage.categories.groupoid import Groupoid
Functor.__init__(self, Groupoid(G), category(S))
self.G = G
self.US = ref(S)
Expand Down
2 changes: 1 addition & 1 deletion src/sage/categories/functor.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ AUTHORS:
# https://www.gnu.org/licenses/
# ****************************************************************************

from . import category
from sage.categories import category


def _Functor_unpickle(Cl, D, domain, codomain):
Expand Down
2 changes: 1 addition & 1 deletion src/sage/categories/map.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ AUTHORS:
# https://www.gnu.org/licenses/
# ****************************************************************************

from . import homset
from sage.categories import homset
import weakref
from sage.ext.stdsage cimport HAS_DICTIONARY
from sage.arith.power cimport generic_power
Expand Down
2 changes: 1 addition & 1 deletion src/sage/categories/morphism.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ cdef class CallMorphism(Morphism):
cdef class IdentityMorphism(Morphism):

def __init__(self, parent):
from .homset import Homset, Hom
from sage.categories.homset import Homset, Hom
if not isinstance(parent, Homset):
parent = Hom(parent, parent)
Morphism.__init__(self, parent)
Expand Down
4 changes: 2 additions & 2 deletions src/sage/coding/ag_code_decoders.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ from sage.rings.function_field.constructor import FunctionField
from sage.modules.free_module_element import vector
from sage.matrix.constructor import matrix

from .encoder import Encoder
from .decoder import Decoder, DecodingError
from sage.coding.encoder import Encoder
from sage.coding.decoder import Decoder, DecodingError

from sage.modules.free_module_element cimport FreeModuleElement
from sage.matrix.matrix cimport Matrix
Expand Down
2 changes: 1 addition & 1 deletion src/sage/combinat/designs/designs_pyx.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@ def is_quasi_difference_matrix(M,G,int k,int lmbda,int mu,int u,verbose=False):
Column 1 contains 2 empty entries instead of the expected lambda.u=1.1=1
False
"""
from .difference_family import group_law
from sage.combinat.designs.difference_family import group_law

assert k>=2
assert lmbda >=1
Expand Down
2 changes: 1 addition & 1 deletion src/sage/combinat/designs/evenly_distributed_sets.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ cdef class EvenlyDistributedSetsBacktracker:
xe = self.K.multiplicative_generator() ** (self.e)
df = [[xe**j*b for b in B] for j in range((self.q-1)/(2*self.e))]
if check:
from .difference_family import is_difference_family
from sage.combinat.designs.difference_family import is_difference_family
if not is_difference_family(self.K, df, self.q, self.k, 1):
raise RuntimeError("a wrong evenly distributed set was "
"produced by the Sage library for the parameters:\n"
Expand Down
28 changes: 14 additions & 14 deletions src/sage/combinat/designs/orthogonal_arrays_find_recursive.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Functions
"""

from sage.misc.cachefunc import cached_function
from .orthogonal_arrays import orthogonal_array
from sage.combinat.designs.orthogonal_arrays import orthogonal_array
from sage.rings.integer cimport smallInteger
from sage.arith.misc import prime_powers

Expand Down Expand Up @@ -152,7 +152,7 @@ cpdef find_product_decomposition(int k,int n):
# faster to use that rather than calling the divisors function
continue
if is_available(k, n1) and is_available(k, n2):
from .orthogonal_arrays import wilson_construction
from sage.combinat.designs.orthogonal_arrays import wilson_construction
return wilson_construction, (None,k,n1,n2,(),False)
return False

Expand Down Expand Up @@ -202,7 +202,7 @@ cpdef find_wilson_decomposition_with_one_truncated_group(int k,int n):
is_available(k ,m+1) and
is_available(k+1,r ) and
is_available(k ,u )):
from .orthogonal_arrays import wilson_construction
from sage.combinat.designs.orthogonal_arrays import wilson_construction
return wilson_construction, (None,k,r,m,(u,),False)

return False
Expand Down Expand Up @@ -265,7 +265,7 @@ cpdef find_wilson_decomposition_with_two_truncated_groups(int k,int n):
r2 = r1_p_r2-r1
if is_available(k,r2):
assert n == r*m+r1+r2
from .orthogonal_arrays import wilson_construction
from sage.combinat.designs.orthogonal_arrays import wilson_construction
return wilson_construction, (None,k,r,m,(r1,r2),False)
return False

Expand Down Expand Up @@ -305,7 +305,7 @@ cpdef find_construction_3_3(int k,int n):

if (is_available(k+i, nn ) and
is_available(k , mm+i)):
from .orthogonal_arrays_build_recursive import construction_3_3
from sage.combinat.designs.orthogonal_arrays_build_recursive import construction_3_3
return construction_3_3, (k,nn,mm,i)

cpdef find_construction_3_4(int k,int n):
Expand Down Expand Up @@ -348,7 +348,7 @@ cpdef find_construction_3_4(int k,int n):
if (is_available(k+r+1,nn) and
is_available(k , s) and
(is_available(k,mm+r) or is_available(k,mm+r+1))):
from .orthogonal_arrays_build_recursive import construction_3_4
from sage.combinat.designs.orthogonal_arrays_build_recursive import construction_3_4
return construction_3_4, (k,nn,mm,r,s)

cpdef find_construction_3_5(int k,int n):
Expand Down Expand Up @@ -398,7 +398,7 @@ cpdef find_construction_3_5(int k,int n):
(r==0 or is_available(k,r)) and
(s==0 or is_available(k,s)) and
(t==0 or is_available(k,t))):
from .orthogonal_arrays_build_recursive import construction_3_5
from sage.combinat.designs.orthogonal_arrays_build_recursive import construction_3_5
return construction_3_5, (k,nn,mm,r,s,t)

cpdef find_construction_3_6(int k,int n):
Expand Down Expand Up @@ -439,7 +439,7 @@ cpdef find_construction_3_6(int k,int n):

if (is_available(k+i,nn) and
smallInteger(nn).is_prime_power()):
from .orthogonal_arrays_build_recursive import construction_3_6
from sage.combinat.designs.orthogonal_arrays_build_recursive import construction_3_6
return construction_3_6, (k,nn,mm,i)

cpdef find_q_x(int k,int n):
Expand Down Expand Up @@ -491,7 +491,7 @@ cpdef find_q_x(int k,int n):
# is_available(k+1,q) and
is_available(k, x+2 ) and
smallInteger(q).is_prime_power()):
from .orthogonal_arrays_build_recursive import construction_q_x
from sage.combinat.designs.orthogonal_arrays_build_recursive import construction_q_x
return construction_q_x, (k,q,x)
return False

Expand Down Expand Up @@ -545,7 +545,7 @@ cpdef find_thwart_lemma_3_5(int k,int N):
sage: for k,n in kn: # not tested -- too long
....: assert designs.orthogonal_array(k,n,existence=True) is True
"""
from .orthogonal_arrays_build_recursive import thwart_lemma_3_5
from sage.combinat.designs.orthogonal_arrays_build_recursive import thwart_lemma_3_5
cdef int n,m,a,b,c,d,NN,na,nb,nc

for n in prime_powers(k+2,N-2): # There must exist a OA(k+3,n) thus n>=k+2
Expand Down Expand Up @@ -660,7 +660,7 @@ cpdef find_thwart_lemma_4_1(int k,int n):
not is_available(k,mm+4)):
continue

from .orthogonal_arrays_build_recursive import thwart_lemma_4_1
from sage.combinat.designs.orthogonal_arrays_build_recursive import thwart_lemma_4_1
return thwart_lemma_4_1,(k,nn,mm)

return False
Expand Down Expand Up @@ -705,7 +705,7 @@ cpdef find_three_factor_product(int k,int n):
not is_available(k,n2) or
not is_available(k,n3)):
continue
from .orthogonal_arrays_build_recursive import three_factor_product
from sage.combinat.designs.orthogonal_arrays_build_recursive import three_factor_product
return three_factor_product,(k-1,n1,n2,n3)

return False
Expand All @@ -730,7 +730,7 @@ cpdef find_brouwer_separable_design(int k,int n):
sage: find_brouwer_separable_design(5,14)
False
"""
from .orthogonal_arrays_build_recursive import brouwer_separable_design
from sage.combinat.designs.orthogonal_arrays_build_recursive import brouwer_separable_design
cdef int q,x,baer_subplane_size, max_t, min_t, t,e1,e2,e3,e4

for q in prime_powers(2,n):
Expand Down Expand Up @@ -943,7 +943,7 @@ cpdef find_brouwer_van_rees_with_one_truncated_column(int k,int n):

values = int_as_sum(remainder, available_multipliers, r)
if values is not None:
from .orthogonal_arrays import wilson_construction
from sage.combinat.designs.orthogonal_arrays import wilson_construction
return (wilson_construction,
(None,k,r,m,[[(x,1) for x in values]]))

Expand Down
2 changes: 1 addition & 1 deletion src/sage/cpython/wrapperdescr.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Pure Python classes have normal methods, not slot wrappers::
# https://www.gnu.org/licenses/
# ****************************************************************************

from .string import bytes_to_str
from sage.cpython.string import bytes_to_str


def wrapperdescr_call(slotwrapper, self, *args, **kwds):
Expand Down
6 changes: 3 additions & 3 deletions src/sage/graphs/base/graph_backends.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -723,9 +723,9 @@ cdef class GenericGraphBackend(SageObject):
sage: loads(dumps(gi)) == gi
True
"""
from .static_sparse_backend import StaticSparseBackend
from .sparse_graph import SparseGraphBackend
from .dense_graph import DenseGraphBackend
from sage.graphs.base.static_sparse_backend import StaticSparseBackend
from sage.graphs.base.sparse_graph import SparseGraphBackend
from sage.graphs.base.dense_graph import DenseGraphBackend

# implementation, data_structure, multiedges, directed, loops
if isinstance(self, CGraphBackend):
Expand Down
2 changes: 1 addition & 1 deletion src/sage/groups/matrix_gps/group_element.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ from sage.structure.richcmp cimport richcmp


try:
from .group_element_gap import MatrixGroupElement_gap
from sage.groups.matrix_gps.group_element_gap import MatrixGroupElement_gap
except ImportError:
MatrixGroupElement_gap = ()

Expand Down
4 changes: 2 additions & 2 deletions src/sage/libs/gap/element.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ from cpython.object cimport Py_EQ, Py_NE, Py_LE, Py_GE, Py_LT, Py_GT
from cysignals.signals cimport sig_on, sig_off

from sage.libs.gap.gap_includes cimport *
from .libgap import libgap
from sage.libs.gap.libgap import libgap
from sage.libs.gap.util cimport *
from .util import GAPError
from sage.libs.gap.util import GAPError
from sage.cpython.string cimport str_to_bytes, char_to_str
from sage.rings.integer_ring import ZZ
from sage.rings.rational_field import QQ
Expand Down
2 changes: 1 addition & 1 deletion src/sage/libs/gap/util.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ cdef initialize():
argv[11] = s1
argv[4] = s1

from .saved_workspace import workspace
from sage.libs.gap.saved_workspace import workspace
workspace, workspace_is_up_to_date = workspace()
ws = str_to_bytes(workspace, FS_ENCODING, "surrogateescape")
if workspace_is_up_to_date:
Expand Down
2 changes: 1 addition & 1 deletion src/sage/libs/mpmath/ext_libmp.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ from sage.libs.mpmath.ext_impl cimport *
from sage.libs.gmp.all cimport *

# the next line is used by mpmath
from .ext_impl import exp_fixed, cos_sin_fixed, log_int_fixed
from sage.libs.mpmath.ext_impl import exp_fixed, cos_sin_fixed, log_int_fixed

# Note: not thread-safe
cdef MPF tmp1
Expand Down
2 changes: 1 addition & 1 deletion src/sage/libs/ntl/ntl_GF2E.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ from sage.libs.ntl.ntl_ZZ cimport ntl_ZZ
from sage.libs.ntl.ntl_GF2 cimport ntl_GF2
from sage.libs.ntl.ntl_GF2X cimport ntl_GF2X
from sage.libs.ntl.ntl_GF2EContext cimport ntl_GF2EContext_class
from .ntl_GF2EContext import ntl_GF2EContext
from sage.libs.ntl.ntl_GF2EContext import ntl_GF2EContext
from sage.libs.ntl.ntl_ZZ import unpickle_class_args
from sage.misc.randstate cimport current_randstate

Expand Down
4 changes: 2 additions & 2 deletions src/sage/libs/ntl/ntl_GF2EX.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ include 'misc.pxi'
include 'decl.pxi'

from cpython.object cimport Py_EQ, Py_NE
from .ntl_ZZ import unpickle_class_args
from .ntl_GF2EContext import ntl_GF2EContext
from sage.libs.ntl.ntl_ZZ import unpickle_class_args
from sage.libs.ntl.ntl_GF2EContext import ntl_GF2EContext
from sage.libs.ntl.ntl_GF2EContext cimport ntl_GF2EContext_class
from sage.libs.ntl.ntl_GF2E cimport ntl_GF2E

Expand Down
2 changes: 1 addition & 1 deletion src/sage/libs/ntl/ntl_GF2X.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ include 'decl.pxi'
from cpython.object cimport Py_EQ, Py_NE
from sage.rings.integer cimport Integer

from .ntl_ZZ import unpickle_class_value
from sage.libs.ntl.ntl_ZZ import unpickle_class_value
from sage.libs.ntl.ntl_GF2 cimport ntl_GF2


Expand Down
4 changes: 2 additions & 2 deletions src/sage/libs/ntl/ntl_ZZ_pEContext.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ cdef class ntl_ZZ_pEContext_class():
sage: c.ZZ_pE([4,3])
[4 3]
"""
from .ntl_ZZ_pE import ntl_ZZ_pE
from sage.libs.ntl.ntl_ZZ_pE import ntl_ZZ_pE
return ntl_ZZ_pE(v,modulus=self)

def ZZ_pEX(self, v = None):
Expand All @@ -162,7 +162,7 @@ cdef class ntl_ZZ_pEContext_class():
sage: c.ZZ_pEX([4,3])
[[4] [3]]
"""
from .ntl_ZZ_pEX import ntl_ZZ_pEX
from sage.libs.ntl.ntl_ZZ_pEX import ntl_ZZ_pEX
return ntl_ZZ_pEX(v, modulus=self)

cpdef void _assert_is_current_modulus(self) except *:
Expand Down
2 changes: 1 addition & 1 deletion src/sage/libs/ntl/ntl_mat_GF2E.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ include 'decl.pxi'

from cpython.object cimport Py_EQ, Py_NE
from sage.libs.ntl.ntl_GF2E cimport ntl_GF2E
from .ntl_GF2EContext import ntl_GF2EContext
from sage.libs.ntl.ntl_GF2EContext import ntl_GF2EContext
from sage.libs.ntl.ntl_GF2EContext cimport ntl_GF2EContext_class
from sage.rings.integer cimport Integer
from sage.misc.randstate cimport randstate, current_randstate
Expand Down
2 changes: 1 addition & 1 deletion src/sage/libs/ntl/ntl_mat_ZZ.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ from sage.libs.ntl.ntl_ZZ cimport ntl_ZZ
from sage.libs.ntl.ntl_ZZX cimport ntl_ZZX
from cpython.object cimport PyObject_RichCompare

from .ntl_ZZ import unpickle_class_args
from sage.libs.ntl.ntl_ZZ import unpickle_class_args

cdef inline ntl_ZZ make_ZZ(ZZ_c* x):
cdef ntl_ZZ y
Expand Down
2 changes: 1 addition & 1 deletion src/sage/libs/pari/convert_sage.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ cpdef gen_to_sage(Gen z, locals=None):
elif t == t_VECSMALL:
return z.python_list_small()
elif t == t_MAT:
from .convert_sage_matrix import gen_to_sage_matrix
from sage.libs.pari.convert_sage_matrix import gen_to_sage_matrix
return gen_to_sage_matrix(z, locals)
elif t == t_PADIC:
p = z.padicprime()
Expand Down
2 changes: 1 addition & 1 deletion src/sage/matrix/action.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ AUTHOR:

import operator

from .matrix_space import MatrixSpace, is_MatrixSpace
from sage.matrix.matrix_space import MatrixSpace, is_MatrixSpace
from sage.modules.free_module import FreeModule, is_FreeModule
from sage.structure.coerce cimport coercion_model
from sage.categories.homset import Hom, End
Expand Down
4 changes: 2 additions & 2 deletions src/sage/matrix/args.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1014,7 +1014,7 @@ cdef class MatrixArgs:
if self.space is None:
global MatrixSpace
if MatrixSpace is None:
from .matrix_space import MatrixSpace
from sage.matrix.matrix_space import MatrixSpace
self.space = MatrixSpace(self.base, self.nrows, self.ncols,
sparse=self.sparse, **self.kwds)

Expand Down Expand Up @@ -1147,7 +1147,7 @@ cdef class MatrixArgs:
if not (e.flags.c_contiguous is True or e.flags.f_contiguous is True):
raise TypeError('numpy matrix must be either c_contiguous or f_contiguous')

from .constructor import matrix
from sage.matrix.constructor import matrix
from sage.rings.real_double import RDF
from sage.rings.complex_double import CDF

Expand Down
2 changes: 1 addition & 1 deletion src/sage/matrix/change_ring.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Functions for changing the base ring of matrices quickly
"""

from .matrix_space import MatrixSpace
from sage.matrix.matrix_space import MatrixSpace
from sage.matrix.matrix_real_double_dense cimport Matrix_real_double_dense
from sage.matrix.matrix_integer_dense cimport Matrix_integer_dense

Expand Down
2 changes: 1 addition & 1 deletion src/sage/matrix/constructor.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,7 @@ def matrix(*args, **kwds):
Matrix = matrix


from .special import *
from sage.matrix.special import *


@matrix_method
Expand Down
Loading

0 comments on commit 7d04241

Please sign in to comment.