code stringlengths 17 6.64M |
|---|
def _post_json(url, data, **kwargs):
'\n Return the json response or raise an error.\n\n EXAMPLES::\n\n sage: from sage.databases.findstat import _post_json, FINDSTAT_API_STATISTICS\n sage: _post_json(FINDSTAT_API_STATISTICS, {"fields": "yyy"}) # optional -- internet\n Traceb... |
def _submit(args, url):
'\n Open a post form containing fields for each of the arguments,\n which is sent to the given url.\n\n INPUT:\n\n - args, a dictionary whose keys are the form fields\n\n - url, the goal of the post request\n\n EXAMPLES::\n\n sage: from sage.databases.findstat impo... |
def _data_to_str(data, domain, codomain=None):
'\n Return a string representation of the given list of ``(objects,\n values)`` pairs suitable for a FindStat query.\n\n INPUT:\n\n - ``data``, a list of lists of objects\n\n - ``domain``, a :class:`FindStatCollection`\n\n - ``codomain`` -- (optiona... |
def _data_from_iterable(iterable, mapping=False, domain=None, codomain=None, check=True):
'\n Return a list of pairs of lists of the same size, domain, and if\n applicable, codomain.\n\n INPUT:\n\n - iterable, a pair of lists of the same size, or an iterable of\n pairs, such that every pair consi... |
def _data_from_function(function, domain):
'\n Return a lazy list of pairs of singleton lists of the same size,\n domain.\n\n INPUT:\n\n - ``function``, a callable\n - ``domain``, a :class:`FindStatCollection`\n\n If ``function`` returns the value ``None``, the pair is omitted.\n\n EXAMPLES::... |
def _data_from_data(data, max_values):
'\n Return the first few pairs (of lists of the same size) with a\n total of at most ``max_values`` objects in the range of the\n collection.\n\n INPUT:\n\n - ``data``, an iterable over pairs of lists of the same size\n\n - ``max_values``, the maximal numbe... |
def _distribution_from_data(data, domain, max_values, generating_functions=False):
'\n Return the first few pairs (of lists of the same size) with a\n total of at most ``max_values`` objects in the range of the\n collection, combined by level.\n\n INPUT:\n\n - ``data``, an iterable over pairs of li... |
def _generating_functions_from_dict(gfs, style):
'\n Convert the generating functions given as a dictionary into a\n desired style.\n\n INPUT:\n\n - ``gfs``, a dictionary whose keys are the levels and whose values\n are dictionaries from values to multiplicities\n\n - ``style``, one of ``"dict... |
def _get_code_from_callable(function):
'\n Return code given a callable, if possible.\n\n TESTS::\n\n sage: from sage.databases.findstat import _get_code_from_callable\n sage: @cached_function\n ....: def statistic(pi):\n ....: pi = Permutations(len(pi))(pi)\n ....: ... |
def findstat(query=None, values=None, distribution=None, domain=None, depth=FINDSTAT_DEFAULT_DEPTH, max_values=FINDSTAT_MAX_VALUES):
'\n Return matching statistics.\n\n INPUT:\n\n One of the following:\n\n - an integer or a string representing a valid FindStat identifier\n (e.g. 45 or \'St000045\... |
def findmap(*args, **kwargs):
'\n Return matching maps.\n\n INPUT:\n\n Valid keywords are: ``domain``, ``codomain``, ``values``,\n ``distribution``, ``depth`` and ``max_values``. They have the\n following meanings:\n\n - ``depth`` -- (default ``FINDSTAT_DEFAULT_DEPTH``), a\n non-negative in... |
class FindStatFunction(SageObject):
'\n A class providing the common methods of :class:`FindStatMap` and\n :class:`FindStatStatistic`.\n\n This class provides methods to access and modify properties of a\n single statistic or map of the FindStat database.\n '
def __init__(self, id, data=None, ... |
class FindStatCombinatorialStatistic(SageObject):
'\n A class providing methods to retrieve the first terms of a statistic.\n\n This class provides methods applicable to instances of\n :class:`FindStatStatistic`, :class:`FindStatCompoundStatistic`\n and :class:`FindStatStatisticQuery`.\n '
def... |
class FindStatStatistic(Element, FindStatFunction, FindStatCombinatorialStatistic, metaclass=InheritComparisonClasscallMetaclass):
'\n A FindStat statistic.\n\n :class:`FindStatStatistic` is a class representing a\n combinatorial statistic available in the FindStat database.\n\n This class provides me... |
class FindStatStatistics(UniqueRepresentation, Parent):
'\n The class of FindStat statistics.\n\n The elements of this class are combinatorial statistics currently\n in FindStat.\n\n EXAMPLES:\n\n We can print a list of the first few statistics currently in\n FindStat in a given domain::\n\n ... |
class FindStatStatisticQuery(FindStatStatistic):
'\n A class representing a query for FindStat (compound) statistics.\n '
def __init__(self, data=None, values_of=None, distribution_of=None, domain=None, known_terms=None, function=None, depth=FINDSTAT_DEFAULT_DEPTH, debug=False):
'\n Init... |
class FindStatCompoundStatistic(Element, FindStatCombinatorialStatistic):
def __init__(self, id, domain=None, check=True):
'\n Initialize a compound statistic.\n\n A compound statistic is a sequence of maps followed by a statistic.\n\n INPUT:\n\n - ``id`` -- a padded identifie... |
class FindStatMatchingStatistic(FindStatCompoundStatistic):
def __init__(self, matching_statistic, offset, quality, domain=None):
'\n Initialize a FindStat statistic match.\n\n INPUT:\n\n - ``matching_statistic``, a compound statistic identifier\n\n - ``offset``, the offset of... |
class FindStatCombinatorialMap(SageObject):
'\n A class serving as common ancestor of :class:`FindStatStatistic`\n and :class:`FindStatCompoundStatistic`.\n '
pass
|
class FindStatMap(Element, FindStatFunction, FindStatCombinatorialMap, metaclass=InheritComparisonClasscallMetaclass):
'\n A FindStat map.\n\n :class:`FindStatMap` is a class representing a combinatorial\n map available in the FindStat database.\n\n This class provides methods to inspect various prope... |
class FindStatMaps(UniqueRepresentation, Parent):
'\n The class of FindStat maps.\n\n The elements of this class are combinatorial maps currently in\n FindStat.\n\n EXAMPLES:\n\n We can print a sample map for each domain and codomain::\n\n sage: from sage.databases.findstat import FindStatCo... |
class FindStatMapQuery(FindStatMap):
'\n A class representing a query for FindStat (compound) maps.\n '
def __init__(self, data=None, values_of=None, distribution_of=None, domain=None, codomain=None, known_terms=None, function=None, depth=FINDSTAT_DEFAULT_DEPTH, debug=False):
'\n Initial... |
class FindStatCompoundMap(Element, FindStatCombinatorialMap):
def __init__(self, id, domain=None, codomain=None, check=True):
'\n Initialize a compound statistic.\n\n INPUT:\n\n - ``id`` -- a padded identifier\n\n - ``domain``-- (optional), the domain of the compound map\n\n ... |
class FindStatMatchingMap(FindStatCompoundMap):
def __init__(self, matching_map, quality, domain=None, codomain=None):
'\n Initialize a FindStat map match.\n\n INPUT:\n\n - ``matching_map``, a compound map identifier\n\n - ``quality``, the quality of the match, as provided by ... |
def _finite_irreducible_cartan_types_by_rank(n):
"\n Return the Cartan types of rank n.\n\n INPUT:\n\n - n -- an integer.\n\n OUTPUT:\n\n The list of Cartan types of rank n.\n\n TESTS::\n\n sage: from sage.databases.findstat import _finite_irreducible_cartan_types_by_rank\n sage: _... |
def _plane_partitions_by_size_aux(n, outer=None):
'\n Iterate over the plane partitions with `n` boxes, as lists.\n\n INPUT:\n\n - n -- an integer.\n\n OUTPUT:\n\n The plane partitions with `n` boxes as lists.\n\n TESTS::\n\n sage: from sage.databases.findstat import _plane_partitions_by_... |
def _plane_partitions_by_size(n):
'\n Iterate over the plane partitions with `n` boxes.\n\n .. TODO::\n\n This can be replaced when :trac:`28244` is merged.\n\n INPUT:\n\n - n -- an integer.\n\n OUTPUT:\n\n The plane partitions with `n` boxes.\n\n TESTS::\n\n sage: from sage.dat... |
def _finite_lattices(n):
"\n Iterate over the lattices with `n` elements.\n\n INPUT:\n\n - n -- an integer.\n\n OUTPUT:\n\n The lattices with `n` elements.\n\n TESTS::\n\n sage: from sage.databases.findstat import _finite_lattices\n sage: [L.cover_relations() for L in _finite_latti... |
class FindStatCollection(Element, metaclass=InheritComparisonClasscallMetaclass):
'\n A FindStat collection.\n\n :class:`FindStatCollection` is a class representing a\n combinatorial collection available in the FindStat database.\n\n Its main use is to allow easy specification of the combinatorial\n ... |
class FindStatCollections(UniqueRepresentation, Parent):
'\n The class of FindStat collections.\n\n The elements of this class are combinatorial collections in\n FindStat as of January 2020. If a new collection was added to the\n web service since then, the dictionary ``_SupportedFindStatCollections`... |
def sortkey(K):
'\n A completely deterministic sorting key for number fields.\n\n EXAMPLES::\n\n sage: from sage.databases.jones import sortkey\n sage: sortkey(QuadraticField(-3))\n (2, 3, False, x^2 + 3)\n '
return (K.degree(), abs(K.discriminant()), (K.discriminant() > 0), K.po... |
class JonesDatabase():
def __init__(self):
self.root = None
def __repr__(self):
return "John Jones's table of number fields with bounded ramification and degree <= 6"
def _load(self, path, filename):
print(filename)
i = 0
while filename[i].isalpha():
... |
class KnotInfoColumnTypes(Enum):
"\n Enum class to specify if a column from the table of knots and links provided\n at the web-pages `KnotInfo <https://knotinfo.math.indiana.edu/>`__ and\n `LinkInfo <https://linkinfo.sitehost.iu.edu>`__. is used for knots only,\n links only or both.\n\n EXAMPLES::... |
class KnotInfoColumns(Enum):
"\n Enum class to select a column from the table of knots and links provided\n at the web-pages `KnotInfo <https://knotinfo.math.indiana.edu/>`__ and\n `LinkInfo <https://linkinfo.sitehost.iu.edu>`__.\n\n EXAMPLES::\n\n sage: from sage.databases.knotinfo_db import K... |
class KnotInfoFilename(Enum):
"\n Enum for the different data files. The following choices are possible:\n\n - ``knots`` -- contains the data from KnotInfo\n - ``links`` -- contains the data for proper links from LinkInfo\n\n Examples::\n\n sage: from sage.databases.knotinfo_db import KnotInfoD... |
class KnotInfoDataBase(SageObject, UniqueRepresentation):
"\n Database interface to KnotInfo\n\n The original data are obtained from KnotInfo web-page (URL see the example\n below). In order to have these data installed during the build process as\n a sage-package they are converted as csv files into ... |
def zeta_zeros():
'\n List of the imaginary parts of the first 2,001,052 zeros of the\n Riemann zeta function, accurate to within 4e-9.\n\n REFERENCES:\n\n - http://www.dtc.umn.edu/~odlyzko/zeta_tables/index.html\n\n EXAMPLES:\n\n The following example shows the imaginary part of the 13th\n n... |
def _fetch(url):
"\n Fetch the given ``url``.\n\n INPUT:\n\n - ``url`` -- a string corresponding to the URL to be fetched.\n\n OUTPUT:\n\n - a string representing the fetched web page.\n\n TESTS::\n\n sage: from sage.databases.oeis import _fetch, oeis_url\n sage: _fetch(oeis_url + ... |
def _urls(html_string):
'\n Return the list of URLs contained in ``html_string``.\n\n Only URLs provided by HTML hyperlinks (``href`` attribute of ``<a>`` tags)\n in are returned, not text strings starting with ``http://``.\n\n INPUT:\n\n - ``html_string`` -- a string representing some HTML code.\n... |
def to_tuple(string):
"\n Convert a string to a tuple of integers.\n\n EXAMPLES::\n\n sage: from sage.databases.oeis import to_tuple\n sage: to_tuple('12,55,273')\n (12, 55, 273)\n "
return tuple((Integer(x) for x in string.split(',') if x))
|
class OEIS():
'\n The On-Line Encyclopedia of Integer Sequences.\n\n ``OEIS`` is a class representing the On-Line Encyclopedia of Integer\n Sequences. You can query it using its methods, but ``OEIS`` can also be\n called directly with three arguments:\n\n - ``query`` -- it can be:\n\n - a stri... |
class OEISSequence(SageObject, UniqueRepresentation):
"\n The class of OEIS sequences.\n\n This class implements OEIS sequences. They are usually produced by calls to\n the On-Line Encyclopedia of Integer Sequences, represented by the class\n :class:`OEIS`.\n\n .. NOTE::\n\n Since some seque... |
class FancyTuple(tuple):
"\n This class inherits from ``tuple``, it allows to nicely print tuples whose\n elements have a one line representation.\n\n EXAMPLES::\n\n sage: from sage.databases.oeis import FancyTuple\n sage: t = FancyTuple(['zero', 'one', 'two', 'three', 4]); t\n 0: ze... |
class SloaneEncyclopediaClass():
'\n A local copy of the Sloane Online Encyclopedia of Integer Sequences\n that contains only the sequence numbers and the sequences\n themselves.\n '
def __init__(self):
'\n Initialize the database but do not load any of the data.\n '
... |
def copy_gz_file(gz_source, bz_destination):
'\n Decompress a gzipped file and install the bzipped version.\n\n This is used by SloaneEncyclopedia.install_from_gz to install\n several gzipped OEIS database files.\n\n INPUT:\n\n - ``gz_source`` -- string. The name of the gzipped file.\n\n - ``bz_... |
def regexp(expr, item):
"\n Function to define regular expressions in pysqlite.\n\n OUTPUT:\n\n - ``True`` if parameter ``item`` matches the regular expression\n parameter ``expr``\n - ``False`` otherwise (i.e.: no match)\n\n REFERENCES:\n\n - [Ha2005]_\n\n EXAMPLES::\n\n sage: fr... |
def verify_type(type):
"\n Verify that the specified ``type`` is one of the allowed strings.\n\n EXAMPLES::\n\n sage: from sage.databases.sql_db import verify_type\n sage: verify_type('INT')\n True\n sage: verify_type('int')\n True\n sage: verify_type('float')\n ... |
def verify_column(col_dict):
"\n Verify that ``col_dict`` is in proper format, and return a dict with\n default values filled in. Proper format::\n\n {'primary_key':False, 'index':False, 'unique': False, 'sql':'REAL'}\n\n EXAMPLES::\n\n sage: from sage.databases.sql_db import verify_column\... |
def verify_operator(operator):
"\n Check that ``operator`` is one of the allowed strings.\n Legal operators include the following strings:\n\n - '='\n - '<='\n - '>='\n - '<'\n - '>'\n - '<>'\n - 'like'\n - 'regexp'\n - 'is null'\n - 'is not null'\n\n EXAMPLES::\n\n s... |
def construct_skeleton(database):
"\n Construct a database skeleton from the sql data. The skeleton data\n structure is a triple indexed dictionary of the following format::\n\n | - skeleton -- a triple-indexed dictionary\n | - outer key -- table name\n | - inner key -- column na... |
def _create_print_table(cur, col_titles, **kwds):
"\n Create a nice printable table from the cursor given with the given\n column titles.\n\n KEYWORDS:\n\n - ``max_field_size`` -- how wide each field can be\n - ``format_cols`` -- a dictionary that allows the user to specify the\n format of a c... |
class SQLQuery(SageObject):
def __init__(self, database, *args, **kwds):
'\n A query for a SQLite database.\n\n INPUT:\n\n - ``database`` -- a SQLDatabase object\n - ``query_dict`` -- a dictionary specifying the query itself. The\n format is::\n\n {\'tabl... |
class SQLDatabase(SageObject):
def __init__(self, filename=None, read_only=None, skeleton=None):
"\n A SQL Database object corresponding to a database file.\n\n INPUT:\n\n - ``filename`` -- a string\n - ``skeleton`` -- a triple-indexed dictionary::\n\n | - outer key... |
class SteinWatkinsIsogenyClass():
def __init__(self, conductor):
self.conductor = conductor
def __repr__(self):
return ('Stein-Watkins isogeny class of conductor %s' % self.conductor)
def __len__(self):
try:
return len(self.curves)
except AttributeError:
... |
def _lines(s):
while True:
i = s.find('\n')
if (i == (- 1)):
(yield '')
return
line = s[:i]
s = s[(i + 1):]
(yield line)
|
class SteinWatkinsAllData():
'\n Class for iterating through one of the Stein-Watkins database files\n for all conductors.\n '
def __init__(self, num):
num = int(num)
self.num = num
if (num < 0):
raise RuntimeError(('num (=%s) must be a nonnegative integer' % num)... |
class SteinWatkinsPrimeData(SteinWatkinsAllData):
def __init__(self, num):
num = int(num)
self.num = num
if (num < 0):
raise RuntimeError(('num (=%s) must be a nonnegative integer' % num))
name = str(num)
name = (('0' * (2 - len(name))) + name)
self._fi... |
def ecdb_num_curves(max_level=200000):
'\n Return a list whose `N`-th entry, for ``0 <= N <= max_level``, is the\n number of elliptic curves of conductor `N` in the database.\n\n EXAMPLES::\n\n sage: sage.databases.stein_watkins.ecdb_num_curves(100) # optional - database_stein_watkins\n [0,... |
class SymbolicData():
'\n Database of ideals as distributed by The SymbolicData Project\n (http://symbolicdata.org).\n\n This class needs the optional ``database_symbolic_data`` package to be\n installed.\n '
def __init__(self):
'\n EXAMPLES::\n\n sage: sd = SymbolicD... |
class DocTestDefaults(SageObject):
'\n This class is used for doctesting the Sage doctest module.\n\n It fills in attributes to be the same as the defaults defined in\n ``sage-runtests``, expect for a few places,\n which is mostly to make doctesting more predictable.\n\n EXAMPLES::\n\n sage:... |
def skipdir(dirname):
'\n Return True if and only if the directory ``dirname`` should not be\n doctested.\n\n EXAMPLES::\n\n sage: from sage.doctest.control import skipdir\n sage: skipdir(sage.env.SAGE_SRC)\n False\n sage: skipdir(os.path.join(sage.env.SAGE_SRC, "sage", "docte... |
def skipfile(filename, tested_optional_tags=False, *, if_installed=False, log=None):
'\n Return ``True`` if and only if the file ``filename`` should not be doctested.\n\n INPUT:\n\n - ``filename`` -- name of a file\n\n - ``tested_optional_tags`` -- a list or tuple or set of optional tags to test,\n ... |
class Logger():
'\n File-like object which implements writing to multiple files at\n once.\n\n EXAMPLES::\n\n sage: from sage.doctest.control import Logger\n sage: with open(tmp_filename(), "w+") as t:\n ....: L = Logger(sys.stdout, t)\n ....: _ = L.write("hello world\... |
class DocTestController(SageObject):
'\n This class controls doctesting of files.\n\n After creating it with appropriate options, call the :meth:`run` method to run the doctests.\n '
def __init__(self, options, args):
'\n Initialization.\n\n INPUT:\n\n - options -- eithe... |
def run_doctests(module, options=None):
'\n Runs the doctests in a given file.\n\n INPUT:\n\n - ``module`` -- a Sage module, a string, or a list of such.\n\n - ``options`` -- a DocTestDefaults object or None.\n\n EXAMPLES::\n\n sage: run_doctests(sage.rings.all)\n Running doctests wit... |
def has_internet():
'\n Test if Internet is available.\n\n Failure of connecting to the site "https://www.sagemath.org" within a second\n is regarded as internet being not available.\n\n EXAMPLES::\n\n sage: from sage.doctest.external import has_internet\n sage: has_internet() # random,... |
def has_latex():
"\n Test if Latex is available.\n\n EXAMPLES::\n\n sage: from sage.doctest.external import has_latex\n sage: has_latex() # optional - latex\n FeatureTestResult('latex', True)\n "
from sage.features.latex import latex
return latex().is_present()
|
def has_xelatex():
"\n Test if xelatex is available.\n\n EXAMPLES::\n\n sage: from sage.doctest.external import has_xelatex\n sage: has_xelatex() # optional - xelatex\n FeatureTestResult('xelatex', True)\n "
from sage.features.latex import xelatex
return xelatex().is_presen... |
def has_pdflatex():
"\n Test if pdflatex is available.\n\n EXAMPLES::\n\n sage: from sage.doctest.external import has_pdflatex\n sage: has_pdflatex() # optional - pdflatex\n FeatureTestResult('pdflatex', True)\n "
from sage.features.latex import pdflatex
return pdflatex().i... |
def has_lualatex():
"\n Test if lualatex is available.\n\n EXAMPLES::\n\n sage: from sage.doctest.external import has_lualatex\n sage: has_lualatex() # optional - lualatex\n FeatureTestResult('lualatex', True)\n "
from sage.features.latex import lualatex
return lualatex().i... |
def has_magma():
'\n Test if Magma is available.\n\n EXAMPLES::\n\n sage: from sage.doctest.external import has_magma\n sage: has_magma() # random, optional - magma\n True\n '
from sage.features.interfaces import Magma
return Magma().is_present()
|
def has_matlab():
'\n Test if Matlab is available.\n\n EXAMPLES::\n\n sage: from sage.doctest.external import has_matlab\n sage: has_matlab() # random, optional - matlab\n True\n '
from sage.features.interfaces import Matlab
return Matlab().is_present()
|
def has_mathematica():
'\n Test if Mathematica is available.\n\n EXAMPLES::\n\n sage: from sage.doctest.external import has_mathematica\n sage: has_mathematica() # random, optional - mathematica\n True\n '
from sage.features.interfaces import Mathematica
return Mathematica().... |
def has_maple():
'\n Test if Maple is available.\n\n EXAMPLES::\n\n sage: from sage.doctest.external import has_maple\n sage: has_maple() # random, optional - maple\n True\n '
from sage.features.interfaces import Maple
return Maple().is_present()
|
def has_macaulay2():
'\n Test if Macaulay2 is available.\n\n EXAMPLES::\n\n sage: from sage.doctest.external import has_macaulay2\n sage: has_macaulay2() # random, optional - macaulay2\n True\n '
from sage.features.interfaces import Macaulay2
return Macaulay2().is_present()
|
def has_octave():
'\n Test if Octave is available.\n\n EXAMPLES::\n\n sage: from sage.doctest.external import has_octave\n sage: has_octave() # random, optional - octave\n True\n '
from sage.features.interfaces import Octave
return Octave().is_present()
|
def has_pandoc():
"\n Test if pandoc is available.\n\n EXAMPLES::\n\n sage: from sage.doctest.external import has_pandoc\n sage: has_pandoc() # optional -- pandoc\n FeatureTestResult('pandoc', True)\n "
from sage.features.pandoc import Pandoc
return Pandoc().is_present()... |
def has_scilab():
'\n Test if Scilab is available.\n\n EXAMPLES::\n\n sage: from sage.doctest.external import has_scilab\n sage: has_scilab() # random, optional - scilab\n True\n '
from sage.interfaces.scilab import scilab
try:
scilab('2+3')
return True
ex... |
def has_cplex():
"\n Test if CPLEX is available.\n\n EXAMPLES::\n\n sage: from sage.doctest.external import has_cplex\n sage: has_cplex() # random, optional - CPLEX\n FeatureTestResult('cplex', True)\n "
from sage.features.mip_backends import CPLEX
return CPLEX().is_present()... |
def has_gurobi():
"\n Test if Gurobi is available.\n\n EXAMPLES::\n\n sage: from sage.doctest.external import has_gurobi\n sage: has_gurobi() # random, optional - Gurobi\n FeatureTestResult('gurobi', True)\n "
from sage.features.mip_backends import Gurobi
return Gurobi().is_p... |
def has_graphviz():
"\n Test if graphviz (dot, twopi, neato) are available.\n\n EXAMPLES::\n\n sage: from sage.doctest.external import has_graphviz\n sage: has_graphviz() # optional -- graphviz\n FeatureTestResult('graphviz', True)\n "
from sage.features.graphviz import Graphvi... |
def has_ffmpeg():
"\n Test if ffmpeg is available.\n\n EXAMPLES::\n\n sage: from sage.doctest.external import has_ffmpeg\n sage: has_ffmpeg() # optional -- ffmpeg\n FeatureTestResult('ffmpeg', True)\n "
from sage.features.ffmpeg import FFmpeg
return FFmpeg().is_present()... |
def has_imagemagick():
"\n Test if ImageMagick (command convert) is available.\n\n EXAMPLES::\n\n sage: from sage.doctest.external import has_imagemagick\n sage: has_imagemagick() # optional -- imagemagick\n FeatureTestResult('imagemagick', True)\n "
from sage.features.imagemagic... |
def has_dvipng():
"\n Test if dvipng is available.\n\n EXAMPLES::\n\n sage: from sage.doctest.external import has_dvipng\n sage: has_dvipng() # optional -- dvipng\n FeatureTestResult('dvipng', True)\n "
from sage.features.dvipng import dvipng
return dvipng().is_present()
|
def has_pdf2svg():
"\n Test if pdf2svg is available.\n\n EXAMPLES::\n\n sage: from sage.doctest.external import has_pdf2svg\n sage: has_pdf2svg() # optional -- pdf2svg\n FeatureTestResult('pdf2svg', True)\n "
from sage.features.pdf2svg import pdf2svg
return pdf2svg().is_prese... |
def has_rubiks():
"\n Test if the rubiks package (``cu2``, ``cubex``, ``dikcube``,\n ``mcube``, ``optimal``, and ``size222``) is available.\n\n EXAMPLES::\n\n sage: from sage.doctest.external import has_rubiks\n sage: has_rubiks() # optional -- rubiks\n FeatureTestResult('rubiks', ... |
def has_4ti2():
"\n Test if the 4ti2 package is available.\n\n EXAMPLES::\n\n sage: from sage.doctest.external import has_4ti2\n sage: has_4ti2() # optional -- 4ti2\n FeatureTestResult('4ti2', True)\n "
from sage.features.four_ti_2 import FourTi2
return FourTi2().is_present... |
def external_features():
"\n Generate the features that are only to be tested if ``--optional=external`` is used.\n\n EXAMPLES::\n\n sage: from sage.doctest.external import external_features\n sage: next(external_features())\n Feature('internet')\n "
from sage.features.internet i... |
def external_software():
'\n Return the alphabetical list of external software supported by this module.\n\n EXAMPLES::\n\n sage: from sage.doctest.external import external_software\n sage: sorted(external_software) == external_software\n True\n '
return sorted((f.name for f in e... |
class AvailableSoftware():
"\n This class keeps the set of available software whose availability is detected lazily\n from the list of external software.\n\n EXAMPLES::\n\n sage: from sage.doctest.external import external_software, available_software\n sage: external_software\n ['cpl... |
def reproducible_repr(val):
'\n String representation of an object in a reproducible way.\n\n This tries to ensure that the returned string does not depend on\n factors outside the control of the doctest.\n One example is the order of elements in a hash-based structure.\n For most objects, this is ... |
class AttributeAccessTracerHelper():
def __init__(self, delegate, prefix=' ', reads=True):
'\n Helper to print proxied access to attributes.\n\n This class does the actual printing of access traces\n for objects proxied by :class:`AttributeAccessTracerProxy`.\n The fact that ... |
class AttributeAccessTracerProxy():
def __init__(self, delegate, **kwds):
'\n Proxy object which prints all attribute and method access to an object.\n\n The implementation is kept lean since all access to attributes of\n the proxy itself requires complicated syntax.\n For thi... |
def trace_method(obj, meth, **kwds):
'\n Trace the doings of a given method.\n It prints method entry with arguments,\n access to members and other methods during method execution\n as well as method exit with return value.\n\n INPUT:\n\n - ``obj`` -- the object containing the method.\n\n - `... |
def _sorted_dict_pprinter_factory(start, end):
'\n Modified version of :func:`IPython.lib.pretty._dict_pprinter_factory`\n that sorts the keys of dictionaries for printing.\n\n EXAMPLES::\n\n sage: {2: 0, 1: 0} # indirect doctest\n {1: 0, 2: 0}\n '
def inner(obj, p, cycle):
... |
def init_sage(controller=None):
'\n Import the Sage library.\n\n This function is called once at the beginning of a doctest run\n (rather than once for each file). It imports the Sage library,\n sets DOCTEST_MODE to True, and invalidates any interfaces.\n\n EXAMPLES::\n\n sage: from sage.do... |
def showwarning_with_traceback(message, category, filename, lineno, file=None, line=None):
'\n Displays a warning message with a traceback.\n\n INPUT: see :func:`warnings.showwarning`.\n\n OUTPUT: None\n\n EXAMPLES::\n\n sage: from sage.doctest.forker import showwarning_with_traceback\n ... |
class SageSpoofInOut(SageObject):
'\n We replace the standard :class:`doctest._SpoofOut` for three reasons:\n\n - we need to divert the output of C programs that don\'t print\n through sys.stdout,\n - we want the ability to recover partial output from doctest\n processes that segfault.\n - w... |
class SageDocTestRunner(doctest.DocTestRunner):
def __init__(self, *args, **kwds):
'\n A customized version of DocTestRunner that tracks dependencies\n of doctests.\n\n INPUT:\n\n - ``stdout`` -- an open file to restore for debugging\n\n - ``checker`` -- None, or an ins... |
def dummy_handler(sig, frame):
"\n Dummy signal handler for SIGCHLD (just to ensure the signal\n isn't ignored).\n\n TESTS::\n\n sage: import signal\n sage: from sage.doctest.forker import dummy_handler\n sage: _ = signal.signal(signal.SIGUSR1, dummy_handler)\n sage: os.kill(o... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.