-
-
Notifications
You must be signed in to change notification settings - Fork 491
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Trac #34547: Interfaces: use more lazy imports, restore top-level fun…
…ctions maxima_console etc. Various files in `sage/interfaces/` have this pattern: {{{ class Octave(...): .... octave = Octave() }}} When combined with `from .octave import Octave, octave` in `sage/interfaces/all.py`, this means that an instance of `Octave` is created when Sage starts up. I think we should avoid this with lazy imports. URL: https://trac.sagemath.org/34547 Reported by: jhpalmieri Ticket author(s): John Palmieri Reviewer(s): Matthias Koeppe
- Loading branch information
Showing
14 changed files
with
59 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,80 +1,45 @@ | ||
# interfaces to other interpreters | ||
|
||
from sage.misc.lazy_import import lazy_import | ||
|
||
from .frobby import frobby | ||
from .four_ti_2 import four_ti_2 | ||
from .axiom import Axiom, axiom | ||
from .fricas import FriCAS, fricas | ||
|
||
from .sage0 import sage0, sage0_version, Sage | ||
from .gap import gap, gap_reset_workspace, Gap | ||
from .gap3 import gap3, gap3_version, Gap3 | ||
lazy_import('sage.interfaces.genus2reduction', ['genus2reduction', 'Genus2reduction']) | ||
from .gfan import gfan, Gfan | ||
from .giac import giac, Giac | ||
from .gp import gp, gp_version, Gp | ||
from .gnuplot import gnuplot | ||
from .kash import kash, kash_version, Kash | ||
from .lisp import lisp, Lisp | ||
from .magma import magma, Magma | ||
from .magma_free import magma_free | ||
from .macaulay2 import macaulay2, Macaulay2 | ||
from .maple import maple, Maple | ||
from .maxima import maxima, Maxima | ||
# import problems | ||
#from maxima_lib import maxima_lib | ||
from .mathematica import mathematica, Mathematica | ||
from .mathics import mathics, Mathics | ||
from .matlab import matlab, matlab_version, Matlab | ||
from .mupad import mupad, Mupad # NOT functional yet | ||
from .mwrank import mwrank, Mwrank | ||
from .octave import octave, Octave | ||
from .polymake import polymake | ||
from .qepcad import qepcad, qepcad_version, qepcad_formula | ||
from .qsieve import qsieve | ||
from .maxima import maxima, Maxima | ||
from .singular import singular, singular_version, Singular | ||
from .sage0 import sage0 as sage0, sage0_version, Sage | ||
from .scilab import scilab | ||
from .tachyon import tachyon_rt | ||
from .psage import PSage | ||
from .ecm import ECM, ecm | ||
from .povray import povray | ||
from .lie import lie, LiE | ||
from .r import r, R, r_version | ||
from .read_data import read_data | ||
|
||
interfaces = ['gap', 'gap3', 'giac', 'gp', 'mathematica', 'gnuplot', \ | ||
'kash', 'magma', 'macaulay2', 'maple', 'maxima', \ | ||
'mathematica', 'mwrank', 'octave', 'r', \ | ||
'singular', 'sage0', 'sage'] | ||
from .magma import magma, Magma | ||
from .polymake import polymake | ||
|
||
from sage.misc.lazy_import import lazy_import | ||
|
||
try: | ||
from sage.repl.rich_output.display_manager import get_display_manager as _get_display_manager | ||
except ImportError: | ||
pass | ||
else: | ||
if _get_display_manager().is_in_terminal(): | ||
from .axiom import axiom_console | ||
from .fricas import fricas_console | ||
from .gap import gap_console | ||
from .gap3 import gap3_console | ||
from .giac import giac_console | ||
from .gp import gp_console | ||
from .gnuplot import gnuplot_console | ||
from .kash import kash_console | ||
from .lisp import lisp_console | ||
from .magma import magma_console | ||
from .macaulay2 import macaulay2_console | ||
from .maple import maple_console | ||
from .maxima_abstract import maxima_console | ||
from .mathematica import mathematica_console | ||
from .mathics import mathics_console | ||
from .matlab import matlab_console | ||
from .mupad import mupad_console | ||
from .mwrank import mwrank_console | ||
from .octave import octave_console | ||
from .qepcad import qepcad_console | ||
from .singular import singular_console | ||
from .sage0 import sage0_console | ||
from .lie import lie_console | ||
from .r import r_console | ||
lazy_import('sage.interfaces.axiom', ['Axiom', 'axiom']) | ||
lazy_import('sage.interfaces.ecm', ['ECM', 'ecm']) | ||
lazy_import('sage.interfaces.four_ti_2', 'four_ti_2') | ||
lazy_import('sage.interfaces.fricas', ['FriCAS', 'fricas']) | ||
lazy_import('sage.interfaces.frobby', 'frobby') | ||
lazy_import('sage.interfaces.gap3', ['gap3', 'gap3_version', 'Gap3']) | ||
lazy_import('sage.interfaces.genus2reduction', ['genus2reduction', 'Genus2reduction']) | ||
lazy_import('sage.interfaces.gfan', ['gfan', 'Gfan']) | ||
lazy_import('sage.interfaces.giac', ['giac', 'Giac']) | ||
lazy_import('sage.interfaces.gnuplot', 'gnuplot') | ||
lazy_import('sage.interfaces.kash', ['kash', 'kash_version', 'Kash']) | ||
lazy_import('sage.interfaces.lie', ['lie', 'LiE']) | ||
lazy_import('sage.interfaces.lisp', ['lisp', 'Lisp']) | ||
lazy_import('sage.interfaces.macaulay2', ['macaulay2', 'Macaulay2']) | ||
lazy_import('sage.interfaces.magma_free', 'magma_free') | ||
lazy_import('sage.interfaces.maple', ['maple', 'Maple']) | ||
lazy_import('sage.interfaces.mathematica', ['mathematica', 'Mathematica']) | ||
lazy_import('sage.interfaces.mathics', ['mathics', 'Mathics']) | ||
lazy_import('sage.interfaces.matlab', ['matlab', 'matlab_version', 'Matlab']) | ||
lazy_import('sage.interfaces.mupad', ['mupad', 'Mupad']) # NOT functional yet | ||
lazy_import('sage.interfaces.mwrank', ['mwrank', 'Mwrank']) | ||
lazy_import('sage.interfaces.octave', ['octave', 'Octave']) | ||
lazy_import('sage.interfaces.povray', 'povray') | ||
lazy_import('sage.interfaces.psage', 'PSage') | ||
lazy_import('sage.interfaces.qepcad', ['qepcad', 'qepcad_version', 'qepcad_formula']) | ||
lazy_import('sage.interfaces.qsieve', 'qsieve') | ||
lazy_import('sage.interfaces.r', ['r', 'R', 'r_version']) | ||
lazy_import('sage.interfaces.read_data', 'read_data') | ||
lazy_import('sage.interfaces.scilab', 'scilab') | ||
lazy_import('sage.interfaces.tachyon', 'tachyon_rt') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters