Ticket #11043: 11043-lazy-plot-rebase4.7.1.patch

File 11043-lazy-plot-rebase4.7.1.patch, 6.5 KB (added by was, 10 years ago)
  • sage/all.py

    # HG changeset patch
    # User Robert Bradshaw <robertwb@math.washington.edu>
    # Date 1301130596 25200
    # Node ID 09f0506c9424f8b6ccef209edd3a6f26033f0e93
    # Parent  ec32aa4b0fedbb842b6caaa4a9616167a9dc4697
    #11043 - Lazily import plot, numpy, etc. to speed up startup.
    
    diff --git a/sage/all.py b/sage/all.py
    a b  
    1616        sage: frames=[x for x in gc.get_objects() if inspect.isframe(x)]
    1717        sage: len(frames)
    1818        11
    19    
     19
     20Make sure numpy is not imported at startup::
     21
     22    sage: os.system('''sage -c "assert 'numpy' not in sys.modules"''') == 0
     23    True
    2024"""
    2125
    2226from __future__ import with_statement
     
    103107from sage.functions.all  import *
    104108from sage.calculus.all   import *
    105109
    106 from sage.server.all     import *
     110lazy_import("sage.server.all", "*", overwrite=False)
    107111import sage.tests.all as tests
    108112
    109113from sage.crypto.all     import *
    110114import sage.crypto.mq as mq
    111115
    112 from sage.plot.all       import *
    113 from sage.plot.plot3d.all     import *
     116lazy_import("sage.plot.all", "*", overwrite=False)
     117lazy_import("sage.plot.plot3d.all", "*", overwrite=False)
    114118
    115119from sage.coding.all     import *
    116120from sage.combinat.all   import *
    117121
    118122lazy_import("sage.lfunctions.all", "*", overwrite=False)
    119123
    120 from sage.geometry.all   import *
    121 from sage.geometry.triangulation.all   import *
     124lazy_import("sage.geometry.all", "*", overwrite=False)
     125lazy_import("sage.geometry.triangulation.all", "*", overwrite=False)
    122126
    123127from sage.homology.all   import *
    124128
    125129from sage.quadratic_forms.all import *
    126130
    127 from sage.gsl.all        import *
     131lazy_import("sage.gsl.all", "*", overwrite=False)
    128132
    129133from sage.games.all      import *
    130134
     
    137141from sage.stats.all      import *
    138142import sage.stats.all as stats
    139143
    140 import sage.finance.all  as finance
     144lazy_import("sage.finance", "all", "finance", overwrite=False)
    141145
    142146import sage.interacts.all as interacts
    143147
  • sage/calculus/all.py

    diff --git a/sage/calculus/all.py b/sage/calculus/all.py
    a b  
     1from sage.misc.lazy_import import lazy_import
     2
    13from calculus import maxima as maxima_calculus
    24from calculus import (laplace, inverse_laplace,
    35                      limit, lim)
     
    1517
    1618from var import (var, function, clear_vars)
    1719
    18 from riemann import Riemann_Map
    19 
    20 from interpolators import polygon_spline, complex_cubic_spline
     20lazy_import('sage.calculus.riemann', 'Riemann_Map')
     21lazy_import('sage.calculus.interpolators', ('polygon_spline', 'complex_cubic_spline'))
    2122
    2223from sage.modules.all import vector
    2324
  • sage/calculus/desolvers.py

    diff --git a/sage/calculus/desolvers.py b/sage/calculus/desolvers.py
    a b  
    5757##########################################################################
    5858
    5959from sage.interfaces.maxima import MaximaElement, Maxima
    60 from sage.plot.all import line
    6160from sage.symbolic.expression import is_SymbolicEquation
    6261from sage.symbolic.ring import is_SymbolicVariable
    6362from sage.calculus.functional import diff
     
    10491048        x00 = x01
    10501049        t00 = t00 + h
    10511050        soln.append([t00,x00,y00])
     1051    from sage.plot.all import line
    10521052    Q1 = line([[x[0],x[1]] for x in soln], rgbcolor=(1/4,1/8,3/4))
    10531053    Q2 = line([[x[0],x[2]] for x in soln], rgbcolor=(1/2,1/8,1/4))
    10541054    return [Q1,Q2]
  • sage/functions/prime_pi.pyx

    diff --git a/sage/functions/prime_pi.pyx b/sage/functions/prime_pi.pyx
    a b  
    2828
    2929from sage.rings.integer import Integer
    3030from sage.rings.fast_arith import prime_range
    31 import sage.plot.all
    3231
    3332cdef extern from "math.h":
    3433    double sqrt(double)
  • sage/functions/spike_function.py

    diff --git a/sage/functions/spike_function.py b/sage/functions/spike_function.py
    a b  
    22
    33import math
    44
    5 from sage.plot.all import line
    65from sage.modules.free_module_element import vector
    76from sage.rings.all import RDF
    87
     
    249248                    new_x = xmax
    250249                v.append( (new_x, 0) )
    251250                x = new_x
     251        from sage.plot.all import line
    252252        L = line(v, **kwds)
    253253        L.xmin(xmin-1); L.xmax(xmax)
    254254        return L
  • sage/functions/transcendental.py

    diff --git a/sage/functions/transcendental.py b/sage/functions/transcendental.py
    a b  
    3737from sage.symbolic.function import GinacFunction, BuiltinFunction, is_inexact
    3838from sage.symbolic.ring import SR
    3939
    40 import sage.plot.all
    41 
    4240CC = complex_field.ComplexField()
    4341I = CC.gen(0)
    4442
  • sage/gsl/dwt.pyx

    diff --git a/sage/gsl/dwt.pyx b/sage/gsl/dwt.pyx
    a b  
    2525
    2626#include 'gsl.pxi'
    2727
    28 import sage.plot.all
    29 
    3028#import gsl_array
    3129#cimport gsl_array
    3230
     
    137135        cdef int i
    138136        cdef double x
    139137        v = []
    140         point = sage.plot.all.point
     138        from sage.plot.all import point
    141139        if xmin == None:
    142140            x_min = 0
    143141        if xmax == None:
  • sage/gsl/fft.pyx

    diff --git a/sage/gsl/fft.pyx b/sage/gsl/fft.pyx
    a b  
    2626
    2727include '../ext/stdsage.pxi'
    2828
    29 import sage.plot.all
    30 import sage.libs.pari.all
    3129from sage.rings.integer import Integer
    3230from sage.rings.complex_number import ComplexNumber
    3331
     
    9391        cdef int i
    9492        v = []
    9593
    96         pari = sage.libs.pari.all.pari
    97         point = sage.plot.all.point
     94        from sage.libs.pari.all import pari
     95        from sage.plot.all import point
    9896        pi = pari('Pi')
    9997        s = 1/(3*pi)   # so arg gets scaled between -1/3 and 1/3.
    10098
     
    115113        cdef double pr_x, x, h
    116114        v = []
    117115
    118         point = sage.plot.all.point
     116        from sage.plot.all import point
    119117
    120118        for i from xmin <= i < xmax:
    121119            x = self.data[2*i]
  • sage/plot/all.py

    diff --git a/sage/plot/all.py b/sage/plot/all.py
    a b  
     1import sage.misc.lazy_import
     2assert sage.misc.lazy_import.check_lazy()
     3
    14from plot import (Graphics, plot,
    25                  graphics_array,
    36                  list_plot, parametric_plot,
  • sage/stats/all.py

    diff --git a/sage/stats/all.py b/sage/stats/all.py
    a b  
     1from sage.misc.lazy_import import lazy_import
     2
    13from r import (ttest)
    24from basic_stats import (mean, mode, std, variance, median, moving_average)
    35
    4 import hmm.all as hmm
     6lazy_import("sage.stats.hmm", "all", "hmm")
    57
    6 from sage.finance.time_series import TimeSeries
    7 from intlist import IntList
     8lazy_import("sage.finance.time_series", "TimeSeries")
     9lazy_import("sage.stats.intlist", "IntList")
    810