Ticket #11599: trac_11599_no_circular_imports.patch

File trac_11599_no_circular_imports.patch, 23.6 KB (added by vbraun, 10 years ago)

Rebased patch

  • sage/schemes/generic/affine_space.py

    # HG changeset patch
    # User Volker Braun <vbraun@stp.dias.ie>
    # Date 1324030489 0
    # Node ID a0d4c05f0e52d6bfed54ed0add14d3655d8f71d4
    # Parent  9911f68f11d5699cccd6d642150470a2c04b8f8f
    Trac #11599: Make the scheme submodules noncircular.
    
    The file notes/imports.txt describes how the different
    files in sage.schemes.generic should import each other
    to avoid circular imports in the future.
    
    diff --git a/sage/schemes/generic/affine_space.py b/sage/schemes/generic/affine_space.py
    a b  
    2020    Integer)
    2121
    2222from sage.misc.all import latex
     23from sage.structure.parent_gens import normalize_names
    2324
    24 import algebraic_scheme
    25 
    26 import ambient_space
    27 
     25from scheme import AffineScheme
     26from ambient_space import AmbientSpace
    2827import homset
    29 
    3028import morphism
    3129
    32 import projective_space
    3330
    34 import scheme
    35 
    36 from sage.structure.parent_gens import normalize_names
    3731
    3832def is_AffineSpace(x):
    3933    r"""
     
    110104            raise TypeError, "You must specify the variables names of the coordinate ring."
    111105    return AffineSpace_generic(n, R, names)
    112106
    113 class AffineSpace_generic(ambient_space.AmbientSpace, scheme.AffineScheme):
     107class AffineSpace_generic(AmbientSpace, AffineScheme):
    114108    """
    115109    Affine space of dimension `n` over the ring `R`.
    116110   
     
    166160            Affine Space of dimension 3 over 5-adic Ring with capped relative precision 20
    167161        """
    168162        names = normalize_names(n, names)
    169         ambient_space.AmbientSpace.__init__(self, n, R)
     163        AmbientSpace.__init__(self, n, R)
    170164        self._assign_names(names)
    171165
    172166    def __iter__(self):
     
    554548        except KeyError:
    555549            pass
    556550        if PP is None:
    557             PP = projective_space.ProjectiveSpace(n, self.base_ring())
     551            from sage.schemes.generic.projective_space import ProjectiveSpace
     552            PP = ProjectiveSpace(n, self.base_ring())
    558553        R = self.coordinate_ring()
    559554        v = list(R.gens())
    560555        if n < 0 or n >self.dimension_relative():
     
    609604            sage: X.dimension()
    610605            0
    611606        """
    612         return algebraic_scheme.AlgebraicScheme_subscheme_affine(self, X)
     607        from sage.schemes.generic.algebraic_scheme import AlgebraicScheme_subscheme_affine
     608        return AlgebraicScheme_subscheme_affine(self, X)
  • sage/schemes/generic/algebraic_scheme.py

    diff --git a/sage/schemes/generic/algebraic_scheme.py b/sage/schemes/generic/algebraic_scheme.py
    a b  
    20812081              Defn: Defined on coordinates by sending [z0 : z1 : z2 : z3] to
    20822082                    [z2 : z1 : z2 : z3]
    20832083        """
    2084         return morphism.SchemeMorphism_on_points_toric_variety(*args, **kwds)
     2084        from sage.schemes.generic.toric_morphism import SchemeMorphism_on_points_toric_variety
     2085        return SchemeMorphism_on_points_toric_variety(*args, **kwds)
    20852086
    20862087    def affine_patch(self, i):
    20872088        r"""
  • sage/schemes/generic/divisor.py

    diff --git a/sage/schemes/generic/divisor.py b/sage/schemes/generic/divisor.py
    a b  
    4646from sage.rings.all import ZZ
    4747from sage.structure.formal_sum import FormalSum
    4848
     49from morphism import is_SchemeMorphism
    4950from affine_space import is_AffineSpace
    50 from morphism import is_SchemeMorphism
    5151from projective_space import is_ProjectiveSpace
    5252
    5353
  • sage/schemes/generic/homset.py

    diff --git a/sage/schemes/generic/homset.py b/sage/schemes/generic/homset.py
    a b  
    1414from sage.rings.finite_rings.constructor import is_FiniteField
    1515from sage.rings.rational_field import is_RationalField
    1616from sage.rings.morphism import is_RingHomomorphism
     17
    1718import spec
    1819import morphism
    19 
     20from sage.schemes.generic.toric_morphism import SchemeMorphism_toric_coordinates_field
    2021
    2122
    2223
     
    353354        try:
    354355            return X._point_class(X, arg)
    355356        except AttributeError:  # should be very rare
    356             return morphism.SchemeMorphism_toric_coordinates_field(self, arg)
     357            return SchemeMorphism_toric_coordinates_field(self, arg)
    357358
  • sage/schemes/generic/morphism.py

    diff --git a/sage/schemes/generic/morphism.py b/sage/schemes/generic/morphism.py
    a b  
    691691
    692692
    693693
    694 #*******************************************************************
    695 # Toric varieties
    696 #*******************************************************************
    697 class SchemeMorphism_toric_coordinates_field(SchemeMorphism_coordinates):
    698     """
    699     Construct a morphism determined by giving coordinates in a field.
    700 
    701     .. WARNING::
    702 
    703         You should not create objects of this class directly.
    704 
    705     INPUT:
    706 
    707     - ``X`` -- subscheme of a toric variety.
    708 
    709     - ``coordinates`` -- list of coordinates in the base field of ``X``.
    710 
    711     - ``check`` -- if ``True`` (default), the input will be checked for
    712       correctness.
    713 
    714     OUTPUT:
    715 
    716     - :class:`SchemeMorphism_toric_coordinates_field`.
    717 
    718     TESTS::
    719 
    720         sage: fan = FaceFan(lattice_polytope.octahedron(2))
    721         sage: P1xP1 = ToricVariety(fan)
    722         sage: P1xP1(1,2,3,4)
    723         [1 : 2 : 3 : 4]
    724     """
    725     # Mimicking affine/projective classes
    726     def __init__(self, X, coordinates, check=True):
    727         r"""
    728         See :class:`SchemeMorphism_toric_coordinates_field` for documentation.
    729 
    730         TESTS::
    731 
    732             sage: fan = FaceFan(lattice_polytope.octahedron(2))
    733             sage: P1xP1 = ToricVariety(fan)
    734             sage: P1xP1(1,2,3,4)
    735             [1 : 2 : 3 : 4]
    736         """
    737         # Convert scheme to its set of points over the base ring
    738         if scheme.is_Scheme(X):
    739             X = X(X.base_ring())
    740         super(SchemeMorphism_toric_coordinates_field, self).__init__(X)
    741         if check:
    742             # Verify that there are the right number of coords
    743             # Why is it not done in the parent?
    744             if is_SchemeMorphism(coordinates):
    745                 coordinates = list(coordinates)
    746             if not isinstance(coordinates, (list, tuple)):
    747                 raise TypeError("coordinates must be a scheme point, list, "
    748                                 "or tuple. Got %s" % coordinates)
    749             d = X.codomain().ambient_space().ngens()
    750             if len(coordinates) != d:
    751                 raise ValueError("there must be %d coordinates! Got only %d: "
    752                                  "%s" % (d, len(coordinates), coordinates))
    753             # Make sure the coordinates all lie in the appropriate ring
    754             coordinates = Sequence(coordinates, X.value_ring())
    755             # Verify that the point satisfies the equations of X.
    756             X.codomain()._check_satisfies_equations(coordinates)
    757         self._coords = coordinates
    758 
    759 
    760 class SchemeMorphism_on_points_toric_variety(SchemeMorphism_on_points):
    761     """
    762     Construct a morphism determined by action on points.
    763 
    764     .. WARNING::
    765 
    766         You should not create objects of this class directly.
    767 
    768     INPUT:
    769 
    770     - same as for
    771       :class:`~sage.schemes.generic.morphism.SchemeMorphism_on_points`.
    772 
    773     OUPUT:
    774 
    775     - :class:`~sage.schemes.generic.morphism.SchemeMorphism_on_points_toric_variety`.
    776 
    777     TESTS::
    778 
    779         sage: fan = FaceFan(lattice_polytope.octahedron(2))
    780         sage: P1xP1 = ToricVariety(fan)
    781         sage: P1xP1.inject_variables()
    782         Defining z0, z1, z2, z3
    783         sage: P1 = P1xP1.subscheme(z0-z2)
    784         sage: H = P1xP1.Hom(P1)
    785         sage: import sage.schemes.generic.morphism as MOR
    786         sage: MOR.SchemeMorphism_on_points_toric_variety(H, [z0,z1,z0,z3])
    787         Scheme morphism:
    788           From: 2-d toric variety covered by 4 affine patches
    789           To:   Closed subscheme of 2-d toric variety
    790                 covered by 4 affine patches defined by:
    791           z0 - z2
    792           Defn: Defined on coordinates by sending
    793                 [z0 : z1 : z2 : z3] to [z0 : z1 : z0 : z3]
    794     """
    795 
    796     def __init__(self, parent, polynomials, check=True):
    797         r"""
    798         See :class:`SchemeMorphism_on_points_toric_variety` for documentation.
    799 
    800         TESTS::
    801 
    802             sage: fan = FaceFan(lattice_polytope.octahedron(2))
    803             sage: P1xP1 = ToricVariety(fan)
    804             sage: P1xP1.inject_variables()
    805             Defining z0, z1, z2, z3
    806             sage: P1 = P1xP1.subscheme(z0-z2)
    807             sage: H = P1xP1.Hom(P1)
    808             sage: import sage.schemes.generic.morphism as MOR
    809             sage: MOR.SchemeMorphism_on_points_toric_variety(H, [z0,z1,z0,z3])
    810             Scheme morphism:
    811               From: 2-d toric variety covered by 4 affine patches
    812               To:   Closed subscheme of 2-d toric variety
    813                     covered by 4 affine patches defined by:
    814               z0 - z2
    815               Defn: Defined on coordinates by sending
    816                     [z0 : z1 : z2 : z3] to [z0 : z1 : z0 : z3]
    817         """
    818         SchemeMorphism_on_points.__init__(self, parent, polynomials, check)
    819         if check:
    820             # Check that defining polynomials are homogeneous (degrees can be
    821             # different if the target uses weighted coordinates)
    822             for p in self.defining_polynomials():
    823                 if not self.domain().ambient_space().is_homogeneous(p):
    824                     raise ValueError("%s is not homogeneous!" % p)
    825 
  • new file sage/schemes/generic/notes/imports.txt

    diff --git a/sage/schemes/generic/notes/imports.txt b/sage/schemes/generic/notes/imports.txt
    new file mode 100644
    - +  
     1In order to avoid circular imports, the schemes should only import
     2from other modules higher in the following hierarchy:
     3
     41. scheme, point
     5
     62. spec, ambient_space, morphism
     7
     83. toric_morphism, glue
     9
     104. homset
     11
     125. affine_scheme, projective_scheme, toric_variety
     13 
     146. algebraic_scheme, fano_toric_variety
     15
     167. hypersurface
     17
     188. divisor
     19
     209. divisor_group
     21
     2210. toric_divisor
     23
     24If you nevertheless need something from a module lower in the
     25hierarchy, you should defer the import. That is, put the import at the
     26class/method level and not in the module scope. For example, scheme.py
     27needs spec.py for the default base scheme but contains no "import
     28spec" at the module level.
     29
     30
     31
  • sage/schemes/generic/projective_space.py

    diff --git a/sage/schemes/generic/projective_space.py b/sage/schemes/generic/projective_space.py
    a b  
    7070                            ZZ)
    7171
    7272from sage.misc.all import latex
    73 
     73from sage.structure.parent_gens import normalize_names
     74from sage.rings.arith import gcd
     75from sage.combinat.tuple import Tuples
     76 
     77from ambient_space import AmbientSpace
    7478import homset
    7579import morphism
    7680
    77 import ambient_space
    78 import affine_space
    79 
    80 from sage.structure.parent_gens import normalize_names
    81 
    82 from sage.rings.arith import gcd
    83 
    84 from sage.combinat.tuple import Tuples
    8581
    8682def is_ProjectiveSpace(x):
    8783    r"""
     
    168164    else:
    169165        raise TypeError, "R (=%s) must be a commutative ring"%R
    170166
    171 class ProjectiveSpace_ring(ambient_space.AmbientSpace):
     167class ProjectiveSpace_ring(AmbientSpace):
    172168    """
    173169    Projective space of dimension `n` over the ring
    174170    `R`.
     
    201197            Projective Space of dimension 3 over 5-adic Ring with capped relative precision 20
    202198        """
    203199        names = normalize_names(n+1, names)
    204         ambient_space.AmbientSpace.__init__(self, n, R)
     200        AmbientSpace.__init__(self, n, R)
    205201        self._assign_names(names)
    206202
    207203    def ngens(self):
     
    545541            self.__affine_patches = {}
    546542        except KeyError:
    547543            pass
    548         AA = affine_space.AffineSpace(n, self.base_ring(), names='x')
     544        from sage.schemes.generic.affine_space import AffineSpace
     545        AA = AffineSpace(n, self.base_ring(), names='x')
    549546        AA._default_embedding_index = i
    550547        phi = AA.projective_embedding(i, self)
    551548        self.__affine_patches[i] = AA
  • sage/schemes/generic/scheme.py

    diff --git a/sage/schemes/generic/scheme.py b/sage/schemes/generic/scheme.py
    a b  
    2323                            ZZ, is_RingHomomorphism, GF, PowerSeriesRing,
    2424                            Rationals)
    2525
    26 import homset
    27 
    28 import morphism
    29 
    30 import spec
    31 
    3226def is_Scheme(x):
    3327    """
    3428    Return True if `x` is a scheme.
     
    4438    """
    4539    return isinstance(x, Scheme)
    4640
     41
    4742# If a derived class sets any of the properties, _base_scheme, _base_ring,
    4843# or _base_morphism, it will determine the others.  If none are set,
    4944# the base defaults to Spec(Z) with the canonical morphism.
     
    5954            sage: I = (x^2 - y^2)*R
    6055            sage: RmodI = R.quotient(I)
    6156            sage: X = Spec(RmodI)
    62             sage: TestSuite(X).run(skip = ["_test_an_element", "_test_elements", "_test_some_elements", "_test_category"]) # See #7946
     57            sage: TestSuite(X).run(skip = ["_test_an_element", "_test_elements",
     58            ...                            "_test_some_elements", "_test_category"]) # See #7946
    6359
    6460        A scheme is in the category of all schemes over the base scheme of self::
    6561
    6662            sage: ProjectiveSpace(4, QQ).category()
    6763            Category of schemes over Spectrum of Rational Field
    6864        """
    69         if spec.is_Spec(X):
     65        from sage.schemes.generic.spec import is_Spec
     66        if is_Spec(X):
    7067            self._base_ring = X.coordinate_ring()
    7168            base = self._base_ring
    7269        else:
     
    7875        if category is None:
    7976            category = default_category
    8077        else:
    81             assert category.is_subcategory(default_category), "%s is not a subcategory of %s"%(category, default_category)
     78            assert category.is_subcategory(default_category), \
     79                "%s is not a subcategory of %s"%(category, default_category)
    8280
    8381        Parent.__init__(self, base, category = category)
    8482
     
    203201        S = args[0]
    204202        if is_CommutativeRing(S):
    205203            return self.point_homset(S)
    206         elif is_Scheme(S):
     204        if is_Scheme(S):
    207205            return S.Hom(self)
    208         elif isinstance(S, (list, tuple)):
     206        from sage.schemes.generic.morphism import SchemeMorphism_coordinates
     207        if isinstance(S, (list, tuple)):
    209208            args = S
    210         elif isinstance(S, morphism.SchemeMorphism_coordinates):
     209        elif isinstance(S, SchemeMorphism_coordinates):
    211210            if S.codomain() == self:
    212211                return S
    213212        else:
     
    341340        try:
    342341            return self._base_scheme
    343342        except AttributeError:
     343            from sage.schemes.generic.spec import Spec, SpecZ
    344344            if hasattr(self, '_base_morphism'):
    345345                self._base_scheme = self._base_morphism.codomain()
    346346            elif hasattr(self, '_base_ring'):
    347347                import spec
    348                 self._base_scheme = spec.Spec(self._base_ring)
     348                self._base_scheme = Spec(self._base_ring)
    349349            else:
    350350                import spec               
    351                 self._base_scheme = spec.SpecZ
     351                self._base_scheme = SpecZ
    352352            return self._base_scheme
    353353
    354354    def base_morphism(self):
     
    378378            return self._base_morphism
    379379        except AttributeError:
    380380            from sage.categories.schemes import Schemes
     381            from sage.schemes.generic.spec import Spec, SpecZ
    381382            SCH = Schemes()
    382383            if hasattr(self, '_base_scheme'):
    383384                self._base_morphism = self.Hom(self._base_scheme, category=SCH).natural_map()
    384385            elif hasattr(self, '_base_ring'):
    385                 self._base_morphism = self.Hom(spec.Spec(self._base_ring), category=SCH).natural_map()
     386                self._base_morphism = self.Hom(Spec(self._base_ring), category=SCH).natural_map()
    386387            else:
    387                 self._base_morphism = self.Hom(spec.SpecZ, category=SCH).natural_map()
     388                self._base_morphism = self.Hom(SpecZ, category=SCH).natural_map()
    388389            return self._base_morphism
    389390
    390391    structure_morphism = base_morphism
     
    456457            Scheme endomorphism of Spectrum of Rational Field
    457458              Defn: Identity map
    458459        """
    459         return morphism.SchemeMorphism_id(self)
     460        from sage.schemes.generic.morphism import SchemeMorphism_id
     461        return SchemeMorphism_id(self)
    460462
    461463    def hom(self, x, Y=None, check=True):
    462464        """
     
    492494            sage: S._Hom_(P)
    493495            Set of points of Projective Space of dimension 3 over Integer Ring defined over Integer Ring
    494496        """
    495         return homset.SchemeHomset(self, Y, category=category, check=check)
     497        from sage.schemes.generic.homset import SchemeHomset
     498        return SchemeHomset(self, Y, category=category, check=check)
    496499
    497500    point_set = point_homset
    498501
  • new file sage/schemes/generic/toric_morphism.py

    diff --git a/sage/schemes/generic/toric_morphism.py b/sage/schemes/generic/toric_morphism.py
    new file mode 100644
    - +  
     1"""
     2Morphisms of Toric Varieties
     3
     4
     5"""
     6
     7
     8#*****************************************************************************
     9#  Copyright (C) 2010 Volker Braun <vbraun.name@gmail.com>
     10#  Copyright (C) 2010 Andrey Novoseltsev <novoselt@gmail.com>
     11#  Copyright (C) 2006 William Stein <wstein@gmail.com>
     12#  Distributed under the terms of the GNU General Public License (GPL)
     13#                  http://www.gnu.org/licenses/
     14#*****************************************************************************
     15
     16from sage.structure.sequence  import Sequence
     17
     18import scheme     
     19from sage.schemes.generic.morphism import (
     20    is_SchemeMorphism,
     21    SchemeMorphism_coordinates, SchemeMorphism_on_points
     22)
     23
     24
     25
     26class SchemeMorphism_toric_coordinates_field(SchemeMorphism_coordinates):
     27    """
     28    Construct a morphism determined by giving coordinates in a field.
     29
     30    .. WARNING::
     31
     32        You should not create objects of this class directly.
     33
     34    INPUT:
     35
     36    - ``X`` -- subscheme of a toric variety.
     37
     38    - ``coordinates`` -- list of coordinates in the base field of ``X``.
     39
     40    - ``check`` -- if ``True`` (default), the input will be checked for
     41      correctness.
     42
     43    OUTPUT:
     44
     45    - :class:`SchemeMorphism_toric_coordinates_field`.
     46
     47    TESTS::
     48
     49        sage: fan = FaceFan(lattice_polytope.octahedron(2))
     50        sage: P1xP1 = ToricVariety(fan)
     51        sage: P1xP1(1,2,3,4)
     52        [1 : 2 : 3 : 4]
     53    """
     54    # Mimicking affine/projective classes
     55    def __init__(self, X, coordinates, check=True):
     56        r"""
     57        See :class:`SchemeMorphism_toric_coordinates_field` for documentation.
     58
     59        TESTS::
     60
     61            sage: fan = FaceFan(lattice_polytope.octahedron(2))
     62            sage: P1xP1 = ToricVariety(fan)
     63            sage: P1xP1(1,2,3,4)
     64            [1 : 2 : 3 : 4]
     65        """
     66        # Convert scheme to its set of points over the base ring
     67        if scheme.is_Scheme(X):
     68            X = X(X.base_ring())
     69        super(SchemeMorphism_toric_coordinates_field, self).__init__(X)
     70        if check:
     71            # Verify that there are the right number of coords
     72            # Why is it not done in the parent?
     73            if is_SchemeMorphism(coordinates):
     74                coordinates = list(coordinates)
     75            if not isinstance(coordinates, (list, tuple)):
     76                raise TypeError("coordinates must be a scheme point, list, "
     77                                "or tuple. Got %s" % coordinates)
     78            d = X.codomain().ambient_space().ngens()
     79            if len(coordinates) != d:
     80                raise ValueError("there must be %d coordinates! Got only %d: "
     81                                 "%s" % (d, len(coordinates), coordinates))
     82            # Make sure the coordinates all lie in the appropriate ring
     83            coordinates = Sequence(coordinates, X.value_ring())
     84            # Verify that the point satisfies the equations of X.
     85            X.codomain()._check_satisfies_equations(coordinates)
     86        self._coords = coordinates
     87
     88
     89
     90class SchemeMorphism_on_points_toric_variety(SchemeMorphism_on_points):
     91    """
     92    Construct a morphism determined by action on points.
     93
     94    .. WARNING::
     95
     96        You should not create objects of this class directly.
     97
     98    INPUT:
     99
     100    - same as for
     101      :class:`~sage.schemes.generic.morphism.SchemeMorphism_on_points`.
     102
     103    OUPUT:
     104
     105    - :class:`~sage.schemes.generic.morphism.SchemeMorphism_on_points_toric_variety`.
     106
     107    TESTS::
     108
     109        sage: fan = FaceFan(lattice_polytope.octahedron(2))
     110        sage: P1xP1 = ToricVariety(fan)
     111        sage: P1xP1.inject_variables()
     112        Defining z0, z1, z2, z3
     113        sage: P1 = P1xP1.subscheme(z0-z2)
     114        sage: H = P1xP1.Hom(P1)
     115        sage: import sage.schemes.generic.toric_morphism as MOR
     116        sage: MOR.SchemeMorphism_on_points_toric_variety(H, [z0,z1,z0,z3])
     117        Scheme morphism:
     118          From: 2-d toric variety covered by 4 affine patches
     119          To:   Closed subscheme of 2-d toric variety
     120                covered by 4 affine patches defined by:
     121          z0 - z2
     122          Defn: Defined on coordinates by sending
     123                [z0 : z1 : z2 : z3] to [z0 : z1 : z0 : z3]
     124    """
     125
     126    def __init__(self, parent, polynomials, check=True):
     127        r"""
     128        See :class:`SchemeMorphism_on_points_toric_variety` for documentation.
     129
     130        TESTS::
     131
     132            sage: fan = FaceFan(lattice_polytope.octahedron(2))
     133            sage: P1xP1 = ToricVariety(fan)
     134            sage: P1xP1.inject_variables()
     135            Defining z0, z1, z2, z3
     136            sage: P1 = P1xP1.subscheme(z0-z2)
     137            sage: H = P1xP1.Hom(P1)
     138            sage: import sage.schemes.generic.toric_morphism as MOR
     139            sage: MOR.SchemeMorphism_on_points_toric_variety(H, [z0,z1,z0,z3])
     140            Scheme morphism:
     141              From: 2-d toric variety covered by 4 affine patches
     142              To:   Closed subscheme of 2-d toric variety
     143                    covered by 4 affine patches defined by:
     144              z0 - z2
     145              Defn: Defined on coordinates by sending
     146                    [z0 : z1 : z2 : z3] to [z0 : z1 : z0 : z3]
     147        """
     148        SchemeMorphism_on_points.__init__(self, parent, polynomials, check)
     149        if check:
     150            # Check that defining polynomials are homogeneous (degrees can be
     151            # different if the target uses weighted coordinates)
     152            for p in self.defining_polynomials():
     153                if not self.domain().ambient_space().is_homogeneous(p):
     154                    raise ValueError("%s is not homogeneous!" % p)
     155
     156
     157
  • sage/schemes/generic/toric_variety.py

    diff --git a/sage/schemes/generic/toric_variety.py b/sage/schemes/generic/toric_variety.py
    a b  
    233233
    234234import sys
    235235           
     236from sage.functions.all import factorial
    236237from sage.geometry.cone import Cone, is_Cone
    237238from sage.geometry.fan import Fan
    238239from sage.matrix.all import matrix
     
    245246from sage.schemes.generic.ambient_space import AmbientSpace
    246247from sage.schemes.generic.homset import (SchemeHomset_coordinates,
    247248                                         SchemeHomset_toric_coordinates_field)
    248 from sage.schemes.generic.morphism import (SchemeMorphism_on_points_toric_variety,
    249                                            SchemeMorphism_toric_coordinates_field,
    250                                            SchemeMorphism_coordinates,
    251                                            SchemeMorphism_on_points,
    252                                            is_SchemeMorphism)
    253 from sage.functions.all import factorial
     249from sage.schemes.generic.toric_morphism import (SchemeMorphism_on_points_toric_variety,
     250                                                 SchemeMorphism_toric_coordinates_field)
     251
    254252
    255253
    256254# Default prefix for indexed coordinates