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

Commit

Permalink
fix imports for python 3
Browse files Browse the repository at this point in the history
  • Loading branch information
a-andre committed Feb 2, 2017
1 parent c61082d commit 1ba5a63
Show file tree
Hide file tree
Showing 17 changed files with 50 additions and 35 deletions.
3 changes: 2 additions & 1 deletion src/sage/categories/map.pyx
Expand Up @@ -22,10 +22,11 @@ AUTHORS:
#
# http://www.gnu.org/licenses/
#*****************************************************************************
from __future__ import absolute_import
from __future__ import print_function

include "sage/ext/stdsage.pxi"
import homset
from . import homset
import weakref
from sage.structure.parent cimport Set_PythonType
from sage.misc.constant_function import ConstantFunction
Expand Down
4 changes: 2 additions & 2 deletions src/sage/libs/ntl/ntl_ZZ_pEContext.pyx
Expand Up @@ -131,7 +131,7 @@ cdef class ntl_ZZ_pEContext_class(object):
sage: c.ZZ_pE([4,3])
[4 3]
"""
from ntl_ZZ_pE import ntl_ZZ_pE
from .ntl_ZZ_pE import ntl_ZZ_pE
return ntl_ZZ_pE(v,modulus=self)

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

def ntl_ZZ_pEContext( ntl_ZZ_pX f):
Expand Down
2 changes: 1 addition & 1 deletion src/sage/libs/ntl/ntl_mat_ZZ.pyx
Expand Up @@ -20,7 +20,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 .ntl_ZZ import unpickle_class_args

cdef inline ntl_ZZ make_ZZ(ZZ_c* x):
cdef ntl_ZZ y
Expand Down
5 changes: 3 additions & 2 deletions src/sage/matrix/matrix_dense.pyx
Expand Up @@ -7,11 +7,12 @@ TESTS::
sage: m = matrix(R,2,[0,a,b,b^2])
sage: TestSuite(m).run()
"""
from __future__ import absolute_import
from __future__ import print_function

cimport matrix
cimport sage.matrix.matrix as matrix

from sage.structure.element cimport Element, RingElement
from sage.structure.element cimport Element, RingElement
from sage.structure.sage_object cimport richcmp_not_equal, rich_to_bool
import sage.matrix.matrix_space
import sage.structure.sequence
Expand Down
8 changes: 5 additions & 3 deletions src/sage/matrix/matrix_generic_dense.pyx
@@ -1,15 +1,17 @@
"""
Dense Matrices over a general ring
"""
from __future__ import absolute_import

cimport cython
from cpython.list cimport *
from cpython.number cimport *
from cpython.ref cimport *

cimport matrix_dense
import matrix_dense
cimport sage.matrix.matrix_dense as matrix_dense
from . import matrix_dense

cimport matrix
cimport sage.matrix.matrix as matrix

from sage.structure.element cimport parent_c

Expand Down
8 changes: 5 additions & 3 deletions src/sage/matrix/matrix_generic_sparse.pyx
Expand Up @@ -52,9 +52,10 @@ EXAMPLES::
sage: c.is_sparse()
True
"""
from __future__ import absolute_import

cimport matrix
cimport matrix_sparse
cimport sage.matrix.matrix as matrix
cimport sage.matrix.matrix_sparse as matrix_sparse
cimport sage.structure.element
from sage.structure.element cimport ModuleElement

Expand Down Expand Up @@ -601,7 +602,6 @@ cdef class Matrix_generic_sparse(matrix_sparse.Matrix_sparse):
####################################################################################
# Various helper functions
####################################################################################
import matrix_space

def Matrix_sparse_from_rows(X):
"""
Expand Down Expand Up @@ -633,6 +633,8 @@ def Matrix_sparse_from_rows(X):
raise TypeError("X (=%s) must be a list or tuple"%X)
if len(X) == 0:
raise ArithmeticError("X must be nonempty")

from . import matrix_space
entries = {}
R = X[0].base_ring()
ncols = X[0].degree()
Expand Down
3 changes: 2 additions & 1 deletion src/sage/matrix/matrix_gf2e_dense.pyx
Expand Up @@ -74,10 +74,11 @@ REFERENCES:
# (at your option) any later version.
# http://www.gnu.org/licenses/
#*****************************************************************************
from __future__ import absolute_import

include "cysignals/signals.pxi"

cimport matrix_dense
cimport sage.matrix.matrix_dense as matrix_dense
from sage.structure.element cimport Matrix, Vector
from sage.structure.element cimport ModuleElement, Element, RingElement

Expand Down
3 changes: 2 additions & 1 deletion src/sage/matrix/matrix_mod2_dense.pyx
Expand Up @@ -99,11 +99,12 @@ TODO:
# (at your option) any later version.
# http://www.gnu.org/licenses/
#*****************************************************************************
from __future__ import absolute_import

include "cysignals/signals.pxi"
include "cysignals/memory.pxi"

cimport matrix_dense
cimport sage.matrix.matrix_dense as matrix_dense
from libc.stdio cimport *
from sage.structure.element cimport (Matrix, Vector, parent_c,
ModuleElement, Element)
Expand Down
5 changes: 3 additions & 2 deletions src/sage/matrix/matrix_sparse.pyx
Expand Up @@ -9,11 +9,12 @@ Base class for sparse matrices
# (at your option) any later version.
# http://www.gnu.org/licenses/
#*****************************************************************************
from __future__ import absolute_import
from __future__ import print_function

cimport cython
cimport matrix
cimport matrix0
cimport sage.matrix.matrix as matrix
cimport sage.matrix.matrix0 as matrix0
from sage.structure.element cimport Element, RingElement, ModuleElement, Vector
from sage.structure.sage_object cimport richcmp
from sage.rings.ring import is_Ring
Expand Down
5 changes: 3 additions & 2 deletions src/sage/modular/modsym/heilbronn.pyx
Expand Up @@ -16,6 +16,7 @@ Heilbronn matrix computation
#
# http://www.gnu.org/licenses/
#*****************************************************************************
from __future__ import absolute_import

import sage.arith.all

Expand All @@ -31,8 +32,8 @@ from sage.libs.flint.fmpz_poly cimport *
cdef extern from "<math.h>":
float roundf(float x)

cimport p1list
import p1list
cimport sage.modular.modsym.p1list as p1list
from . import p1list
cdef p1list.export export
export = p1list.export()

Expand Down
6 changes: 3 additions & 3 deletions src/sage/modules/vector_integer_dense.pyx
Expand Up @@ -52,17 +52,17 @@ TESTS::
# (at your option) any later version.
# http://www.gnu.org/licenses/
#*****************************************************************************

from __future__ import absolute_import

include 'sage/ext/stdsage.pxi'

from sage.structure.element cimport Element, ModuleElement, RingElement, Vector

from sage.rings.integer cimport Integer

cimport free_module_element
cimport sage.modules.free_module_element as free_module_element

from free_module_element import vector
from .free_module_element import vector

from sage.libs.gmp.mpz cimport *

Expand Down
6 changes: 3 additions & 3 deletions src/sage/modules/vector_mod2_dense.pyx
Expand Up @@ -33,15 +33,15 @@ TESTS::
# (at your option) any later version.
# http://www.gnu.org/licenses/
#*****************************************************************************

from __future__ import absolute_import

from sage.rings.finite_rings.integer_mod cimport IntegerMod_int, IntegerMod_abstract
from sage.rings.integer cimport Integer
from sage.rings.rational cimport Rational
from sage.structure.element cimport Element, ModuleElement, RingElement, Vector

cimport free_module_element
from free_module_element import vector
cimport sage.modules.free_module_element as free_module_element
from .free_module_element import vector

from sage.libs.m4ri cimport *

Expand Down
5 changes: 3 additions & 2 deletions src/sage/modules/vector_modn_dense.pyx
Expand Up @@ -93,6 +93,7 @@ AUTHOR:
# (at your option) any later version.
# http://www.gnu.org/licenses/
#*****************************************************************************
from __future__ import absolute_import

include "cysignals/memory.pxi"

Expand All @@ -114,8 +115,8 @@ cdef mod_int ivalue(IntegerMod_abstract x) except -1:

from sage.structure.element cimport Element, ModuleElement, RingElement, Vector

cimport free_module_element
from free_module_element import vector
cimport sage.modules.free_module_element as free_module_element
from .free_module_element import vector

cdef class Vector_modn_dense(free_module_element.FreeModuleElement):
cdef _new_c(self):
Expand Down
5 changes: 3 additions & 2 deletions src/sage/modules/vector_rational_dense.pyx
Expand Up @@ -50,6 +50,7 @@ TESTS::
# Distributed under the terms of the GNU General Public License (GPL)
# http://www.gnu.org/licenses/
###############################################################################
from __future__ import absolute_import
from __future__ import print_function

include "cysignals/signals.pxi"
Expand All @@ -60,8 +61,8 @@ from sage.structure.element cimport Element, ModuleElement, RingElement, Vector
from sage.rings.integer cimport Integer
from sage.rings.rational cimport Rational

cimport free_module_element
from free_module_element import vector
cimport sage.modules.free_module_element as free_module_element
from .free_module_element import vector

from sage.libs.gmp.mpq cimport *

Expand Down
5 changes: 3 additions & 2 deletions src/sage/structure/parent_base.pyx
Expand Up @@ -8,12 +8,13 @@ Base class for old-style parent objects with a base ring
# The full text of the GPL is available at:
# http://www.gnu.org/licenses/
###############################################################################
from __future__ import absolute_import

include "sage/ext/stdsage.pxi"

cimport parent
cimport sage.structure.parent as parent

from coerce_exceptions import CoercionException
from .coerce_exceptions import CoercionException

cdef inline check_old_coerce(parent.Parent p):
if p._element_constructor is not None:
Expand Down
5 changes: 3 additions & 2 deletions src/sage/structure/parent_gens.pyx
Expand Up @@ -75,14 +75,15 @@ TESTS::
# (at your option) any later version.
# http://www.gnu.org/licenses/
#*****************************************************************************
from __future__ import absolute_import
from __future__ import print_function

include 'sage/ext/stdsage.pxi'

import sage.misc.defaults
from sage.misc.latex import latex_variable_name
import gens_py
cimport parent
from . import gens_py
cimport sage.structure.parent as parent
from sage.structure.coerce_dict import MonoDict
cimport sage.structure.category_object as category_object

Expand Down
7 changes: 4 additions & 3 deletions src/sage/structure/parent_old.pyx
Expand Up @@ -25,12 +25,13 @@ This came up in some subtle bug once.
# The full text of the GPL is available at:
# http://www.gnu.org/licenses/
###############################################################################
from __future__ import absolute_import
from __future__ import print_function

cimport sage_object
cimport sage.structure.sage_object as sage_object
import operator
from parent import Set_PythonType, Set_PythonType_class
from coerce import py_scalar_parent
from .parent import Set_PythonType, Set_PythonType_class
from .coerce import py_scalar_parent
from sage.structure.coerce_dict import MonoDict, TripleDict

from cpython.object cimport *
Expand Down

0 comments on commit 1ba5a63

Please sign in to comment.