Ticket #11043: 11043-lazy-plot-again.patch
File 11043-lazy-plot-again.patch, 16.3 KB (added by , 11 years ago) |
---|
-
sage/all.py
# HG changeset patch # User Robert Bradshaw <robertwb@math.washington.edu> # Date 1314117592 25200 # Node ID 80b98dac6a5572159d2b4aa6deb4a78e34bc76f7 # Parent 2a2abbcad325ccca9399981ceddf5897eb467e64 #11043 - lazy plot import diff -r 2a2abbcad325 -r 80b98dac6a55 sage/all.py
a b 73 73 from time import sleep 74 74 75 75 from sage.misc.all import * # takes a while 76 from sage.misc.lazy_import import lazy_import 76 77 77 78 from sage.misc.sh import sh 78 79 … … 124 125 125 126 from sage.quadratic_forms.all import * 126 127 127 from sage.gsl.all import * 128 lazy_import("sage.gsl.all", "*", overwrite=False) 128 129 129 130 from sage.games.all import * 130 131 … … 161 162 #after a few releases, and this code should be removed. 162 163 #--Mike Hansen 9/25/2008 163 164 message = "\nUsing %(name)s from the top level is deprecated since it was designed to be used by developers rather than end users.\nIt most likely does not do what you would expect it to do. If you really need to use it, import it from the module that it is defined in." 165 from sage.misc.lazy_import import LazyImport 164 166 sage.misc.misc.deprecated_callable_import(None, globals(), locals(), 165 [name for name in globals().keys()166 if name.startswith('is_') and name[3].isupper() ], message)167 [name for name, value in globals().items() 168 if name.startswith('is_') and name[3].isupper() and type(value) is not LazyImport], message) 167 169 168 170 del message, name 169 171 -
sage/calculus/all.py
diff -r 2a2abbcad325 -r 80b98dac6a55 sage/calculus/all.py
a b 15 15 16 16 from var import (var, function, clear_vars) 17 17 18 from riemann import Riemann_Map 18 from sage.misc.lazy_import import lazy_import 19 lazy_import("riemann", "Riemann_Map") 19 20 20 21 from interpolators import polygon_spline, complex_cubic_spline 21 22 -
sage/combinat/e_one_star.py
diff -r 2a2abbcad325 -r 80b98dac6a55 sage/combinat/e_one_star.py
a b 211 211 from sage.combinat.words.morphism import WordMorphism 212 212 from sage.matrix.constructor import matrix 213 213 from sage.modules.free_module_element import vector 214 from sage.plot.plot import Graphics 215 from sage.plot.plot import rainbow 216 from sage.plot.colors import Color 217 from sage.plot.polygon import polygon 218 from sage.plot.line import line 219 from sage.rings.integer_ring import ZZ 214 from sage.plot.all import Graphics, rainbow, Color, polygon, line 215 from sage.rings.all import ZZ 220 216 from sage.misc.latex import LatexExpr 221 217 from sage.misc.lazy_attribute import lazy_attribute 222 218 from sage.misc.cachefunc import cached_method -
sage/combinat/words/paths.py
diff -r 2a2abbcad325 -r 80b98dac6a55 sage/combinat/words/paths.py
a b 183 183 from sage.combinat.words.abstract_word import Word_class 184 184 from sage.combinat.words.word import FiniteWord_class 185 185 from sage.combinat.words.alphabet import OrderedAlphabet 186 from sage.plot. plotimport arrow, line, polygon, point, Graphics186 from sage.plot.all import arrow, line, polygon, point, Graphics 187 187 from sage.modules.free_module_element import vector 188 188 from sage.rings.integer import Integer 189 189 from sage.rings.all import ZZ, RR, QuadraticField -
sage/databases/database.py
diff -r 2a2abbcad325 -r 80b98dac6a55 sage/databases/database.py
a b 66 66 from sage.misc.misc import tmp_filename 67 67 from sage.structure.sage_object import SageObject 68 68 import sage.server.support 69 from sage.plot. plotimport plot69 from sage.plot.all import plot 70 70 from sage.graphs.graph import Graph 71 71 72 72 -
sage/functions/orthogonal_polys.py
diff -r 2a2abbcad325 -r 80b98dac6a55 sage/functions/orthogonal_polys.py
a b 308 308 #***************************************************************************** 309 309 310 310 import copy 311 import sage.plot.plot312 311 import sage.interfaces.all 313 312 from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing 314 313 from sage.rings.rational_field import RationalField -
sage/functions/piecewise.py
diff -r 2a2abbcad325 -r 80b98dac6a55 sage/functions/piecewise.py
a b 68 68 # http://www.gnu.org/licenses/ 69 69 #***************************************************************************** 70 70 71 import sage.plot.plot72 71 import sage.interfaces.all 73 72 from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing 74 73 from sage.rings.rational_field import RationalField -
sage/functions/special.py
diff -r 2a2abbcad325 -r 80b98dac6a55 sage/functions/special.py
a b 382 382 #***************************************************************************** 383 383 384 384 import copy 385 from sage.plot. plotimport plot385 from sage.plot.all import plot 386 386 import sage.interfaces.all 387 387 from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing 388 388 from sage.rings.rational_field import RationalField -
sage/geometry/lattice_polytope.py
diff -r 2a2abbcad325 -r 80b98dac6a55 sage/geometry/lattice_polytope.py
a b 107 107 from sage.misc.all import tmp_filename 108 108 from sage.misc.misc import deprecation 109 109 from sage.modules.all import vector 110 from sage.plot.plot import hue 111 from sage.plot.plot3d.index_face_set import IndexFaceSet 112 from sage.plot.plot3d.all import line3d, point3d 113 from sage.plot.plot3d.shapes2 import text3d 114 from sage.plot.plot3d.tachyon import Tachyon 110 from sage.plot.all import hue 115 111 from sage.rings.all import Integer, ZZ, QQ, gcd, lcm 116 112 from sage.sets.set import Set_generic 117 113 from sage.structure.all import Sequence … … 2432 2428 sage: m = matrix([[0,0,0],[0,1,1],[1,0,1],[1,1,0]]).transpose() 2433 2429 sage: p = LatticePolytope(m, compute_vertices=True) 2434 2430 sage: p.plot3d() 2435 """ 2431 """ 2432 from sage.plot.plot3d.index_face_set import IndexFaceSet 2433 from sage.plot.plot3d.all import line3d, point3d 2434 from sage.plot.plot3d.shapes2 import text3d 2436 2435 dim = self.dim() 2437 2436 amb_dim = self.ambient_dim() 2438 2437 if dim > 3: -
sage/graphs/graph_coloring.py
diff -r 2a2abbcad325 -r 80b98dac6a55 sage/graphs/graph_coloring.py
a b 17 17 18 18 from sage.combinat.matrices.dlxcpp import DLXCPP 19 19 from sage.all import Matrix, vector, QQ 20 from sage.plot. colorsimport rainbow20 from sage.plot.all import rainbow 21 21 from chrompoly import chromatic_polynomial 22 22 from graph_generators import GraphGenerators 23 23 -
sage/groups/perm_gps/cubegroup.py
diff -r 2a2abbcad325 -r 80b98dac6a55 sage/groups/perm_gps/cubegroup.py
a b 107 107 from sage.rings.finite_rings.constructor import FiniteField as GF 108 108 from sage.rings.arith import factor 109 109 from sage.groups.abelian_gps.abelian_group import AbelianGroup 110 from sage.plot.polygon import polygon 111 from sage.plot.text import text 110 from sage.plot.all import polygon, text 112 111 pi = RDF.pi() 113 112 114 113 115 from sage.plot.plot3d.shapes import Box116 from sage.plot.plot3d.texture import Texture117 118 114 ####################### predefined colors ################## 119 115 120 116 named_colors = { … … 1030 1026 1031 1027 1032 1028 def cubie(self, size, gap, x,y,z, colors, stickers=True): 1029 from sage.plot.plot3d.shapes import Box 1033 1030 sides = cubie_face_list[x,y,z] 1034 1031 t = 2*size+gap 1035 1032 my_colors = [colors[sides[i]+6] for i in range(6)] … … 1048 1045 sage: C.plot3d() 1049 1046 sage: C.plot() 1050 1047 """ 1048 from sage.plot.plot3d.shapes import Box 1051 1049 while len(self.colors) < 7: 1052 1050 self.colors.append((.1, .1, .1)) 1051 from sage.plot.plot3d.texture import Texture 1053 1052 side_colors = [Texture(color=c, ambient=.75) for c in self.colors] 1054 1053 start_colors = sum([[c]*8 for c in side_colors], []) 1055 1054 facets = self._group.facets(self._state) -
sage/gsl/integration.pyx
diff -r 2a2abbcad325 -r 80b98dac6a55 sage/gsl/integration.pyx
a b 22 22 include 'gsl.pxi' 23 23 24 24 import sage.rings.complex_double 25 import sage.plot.plot26 25 import sage.gsl.interpolation 27 26 28 27 from sage.ext.fast_eval cimport FastDoubleFunc -
sage/media/wav.py
diff -r 2a2abbcad325 -r 80b98dac6a55 sage/media/wav.py
a b 28 28 import os 29 29 import wave 30 30 31 from sage.plot. plotimport list_plot31 from sage.plot.all import list_plot 32 32 from sage.structure.sage_object import SageObject 33 33 from sage.misc.all import srange 34 34 from sage.misc.html import html -
sage/misc/lazy_import.pyx
diff -r 2a2abbcad325 -r 80b98dac6a55 sage/misc/lazy_import.pyx
a b 791 791 sage: 'EllipticCurve' in get_star_imports('sage.schemes.all') 792 792 True 793 793 """ 794 global star_imports 794 global star_imports, _sage_all_import_done 795 795 if star_imports is None: 796 796 cache_file = get_cache_file() 797 797 if os.path.exists(cache_file): … … 801 801 try: 802 802 return star_imports[module_name] 803 803 except KeyError: 804 all_done = _sage_all_import_done 805 _sage_all_import_done = True # so that checks pass 804 806 module = __import__(module_name, {}, {}, ["*"]) 807 _sage_all_import_done = all_done 805 808 if hasattr(module, "__all__"): 806 809 all = module.__all__ 807 810 else: 808 811 all = [key for key in dir(module) if key[0] != "_"] 809 812 star_imports[module_name] = all 810 813 return all 814 815 # Utility functions for asserting that things stay lazily imported. 816 817 _sage_all_import_done = False 818 819 def check_lazy(module_name = None): 820 """ 821 Used to assert lazily imported modules don't actually get imported 822 during the import of sage.all is done. 823 824 TESTS:: 825 826 sage: from sage.misc.lazy_import import check_lazy 827 sage: check_lazy("foo") 828 True 829 sage: sage.misc.lazy_import._sage_all_import_done = False 830 sage: check_lazy("foo") 831 False 832 sage: sage.misc.lazy_import._sage_all_import_done = True 833 sage: check_lazy("foo") 834 True 835 """ 836 if module_name is None: 837 module_name = inspect.currentframe().f_globals['__name__'] 838 return _sage_all_import_done -
sage/modular/overconvergent/genus0.py
diff -r 2a2abbcad325 -r 80b98dac6a55 sage/modular/overconvergent/genus0.py
a b 185 185 from sage.modules.all import vector 186 186 from sage.modules.module import Module_old 187 187 from sage.structure.element import Vector, ModuleElement 188 from sage.plot. plotimport plot188 from sage.plot.all import plot 189 189 from sage.rings.all import (O, Infinity, ZZ, QQ, pAdicField, PolynomialRing, PowerSeriesRing, is_pAdicField) 190 190 import weakref 191 191 -
sage/plot/all.py
diff -r 2a2abbcad325 -r 80b98dac6a55 sage/plot/all.py
a b 1 from plot import (Graphics, plot, 2 graphics_array, 3 list_plot, parametric_plot, 4 polar_plot, 5 is_Graphics, 6 show_default) 7 8 from line import line, line2d 9 from arrow import arrow, arrow2d 10 from bar_chart import bar_chart 11 from bezier_path import bezier_path 12 from scatter_plot import scatter_plot 13 from disk import disk 14 from point import point, points, point2d 15 from matrix_plot import matrix_plot 16 from plot_field import plot_vector_field, plot_slope_field 17 from text import text 18 from polygon import polygon, polygon2d 19 from circle import circle 20 from ellipse import ellipse 21 from contour_plot import contour_plot, implicit_plot, region_plot 22 from density_plot import density_plot 23 from complex_plot import complex_plot 24 from arc import arc 25 26 from animate import Animation as animate 27 28 from plot3d.tachyon import Tachyon 29 30 from colors import Color, hue, rainbow, colors, colormaps 31 32 from step import plot_step_function 1 from sage.misc.lazy_import import lazy_import 2 lazy_import("sage.plot.all_nonlazy", "*", overwrite=False) 3 import sage.misc.lazy_import -
new file sage/plot/all_nonlazy.py
diff -r 2a2abbcad325 -r 80b98dac6a55 sage/plot/all_nonlazy.py
- + 1 import sage.misc.lazy_import 2 assert sage.misc.lazy_import.check_lazy() 3 4 from plot import (Graphics, plot, 5 graphics_array, 6 list_plot, parametric_plot, 7 polar_plot, 8 is_Graphics, 9 show_default) 10 11 from line import line, line2d 12 from arrow import arrow, arrow2d 13 from bar_chart import bar_chart 14 from bezier_path import bezier_path 15 from scatter_plot import scatter_plot 16 from disk import disk 17 from point import point, points, point2d 18 from matrix_plot import matrix_plot 19 from plot_field import plot_vector_field, plot_slope_field 20 from text import text 21 from polygon import polygon, polygon2d 22 from circle import circle 23 from ellipse import ellipse 24 from contour_plot import contour_plot, implicit_plot, region_plot 25 from density_plot import density_plot 26 from complex_plot import complex_plot 27 from arc import arc 28 29 from animate import Animation as animate 30 31 from plot3d.tachyon import Tachyon 32 33 from colors import Color, hue, rainbow, colors, colormaps 34 35 from step import plot_step_function -
sage/plot/plot3d/all.py
diff -r 2a2abbcad325 -r 80b98dac6a55 sage/plot/plot3d/all.py
a b 1 2 from plot3d import plot3d, cylindrical_plot3d, spherical_plot3d, Spherical, SphericalElevation, Cylindrical 3 from parametric_plot3d import parametric_plot3d 4 from plot_field3d import plot_vector_field3d 5 from implicit_plot3d import implicit_plot3d 6 from list_plot3d import list_plot3d 7 from revolution_plot3d import revolution_plot3d 8 9 from platonic import tetrahedron, cube, octahedron, dodecahedron, icosahedron 10 11 from shapes2 import sphere, line3d, polygon3d, point3d, text3d, bezier3d 12 13 from shapes import arrow3d 14 15 #from shapes import Box, ColorCube, Cone, Cylinder, LineSegment, Arrow, Sphere, Torus, Text as Text3D 16 #from parametric_surface import ParametricSurface, MobiusStrip 17 #from plot3d import plot3d, axes as axes3d 18 19 20 1 from sage.misc.lazy_import import lazy_import 2 lazy_import("sage.plot.plot3d.all_nonlazy", "*", overwrite=False) 3 import sage.misc.lazy_import -
new file sage/plot/plot3d/all_nonlazy.py
diff -r 2a2abbcad325 -r 80b98dac6a55 sage/plot/plot3d/all_nonlazy.py
- + 1 2 from plot3d import plot3d, cylindrical_plot3d, spherical_plot3d, Spherical, SphericalElevation, Cylindrical 3 from parametric_plot3d import parametric_plot3d 4 from plot_field3d import plot_vector_field3d 5 from implicit_plot3d import implicit_plot3d 6 from list_plot3d import list_plot3d 7 from revolution_plot3d import revolution_plot3d 8 9 from platonic import tetrahedron, cube, octahedron, dodecahedron, icosahedron 10 11 from shapes2 import sphere, line3d, polygon3d, point3d, text3d, bezier3d 12 13 from shapes import arrow3d 14 15 #from shapes import Box, ColorCube, Cone, Cylinder, LineSegment, Arrow, Sphere, Torus, Text as Text3D 16 #from parametric_surface import ParametricSurface, MobiusStrip 17 #from plot3d import plot3d, axes as axes3d 18 19 20