Beispiel #1
0
def version_dict():
    """
    A dictionary describing the version of Sage.

    INPUT:
        nothing
    OUTPUT:
        dictionary with keys 'major', 'minor', 'tiny', 'prerelease'

    This process the Sage version string and produces a dictionary.
    It expects the Sage version to be in one of these forms:
       N.N
       N.N.N
       N.N.N.N
       N.N.str
       N.N.N.str
       N.N.N.N.str
    where 'N' stands for an integer and 'str' stands for a string.
    The first integer is stored under the 'major' key and the second
    integer under 'minor'.  If there is one more integer, it is stored
    under 'tiny'; if there are two more integers, then they are stored
    together as a float N.N under 'tiny'.  If there is a string, then
    the key 'prerelease' returns True.

    For example, if the Sage version is '3.2.1', then the dictionary
    is {'major': 3, 'minor': 2, 'tiny': 1, 'prerelease': False}.
    If the Sage version is '3.2.1.2', then the dictionary is
    {'major': 3, 'minor': 2, 'tiny': 1.200..., 'prerelease': False}.
    If the Sage version is '3.2.alpha0', then the dictionary is
    {'major': 3, 'minor': 2, 'tiny': 0, 'prerelease': True}.

    EXAMPLES:
        sage: from sage.misc.banner import version_dict
        sage: print "Sage major version is %s" % version_dict()['major']
        Sage major version is ...
        sage: version_dict()['major'] == int(sage.version.version.split('.')[0])
        True
    """
    v = SAGE_VERSION.split('.')
    dict = {}
    dict['major'] = int(v[0])
    dict['minor'] = int(v[1])
    dict['tiny'] = 0
    dict['prerelease'] = False
    try:
        dummy = int(v[-1])
    except ValueError:  # when last entry is not an integer
        dict['prerelease'] = True
    if (len(v) == 3 and not dict['prerelease']) or len(v) > 3:
        dict['tiny'] = int(v[2])
    try:
        teeny = int(v[3])
        dict['tiny'] += 0.1 * teeny
    except (ValueError, IndexError):
        pass
    return dict
Beispiel #2
0
def version_dict():
    """
    A dictionary describing the version of Sage.

    INPUT:
        nothing
    OUTPUT:
        dictionary with keys 'major', 'minor', 'tiny', 'prerelease'

    This process the Sage version string and produces a dictionary.
    It expects the Sage version to be in one of these forms:
       N.N
       N.N.N
       N.N.N.N
       N.N.str
       N.N.N.str
       N.N.N.N.str
    where 'N' stands for an integer and 'str' stands for a string.
    The first integer is stored under the 'major' key and the second
    integer under 'minor'.  If there is one more integer, it is stored
    under 'tiny'; if there are two more integers, then they are stored
    together as a float N.N under 'tiny'.  If there is a string, then
    the key 'prerelease' returns True.

    For example, if the Sage version is '3.2.1', then the dictionary
    is {'major': 3, 'minor': 2, 'tiny': 1, 'prerelease': False}.
    If the Sage version is '3.2.1.2', then the dictionary is
    {'major': 3, 'minor': 2, 'tiny': 1.200..., 'prerelease': False}.
    If the Sage version is '3.2.alpha0', then the dictionary is
    {'major': 3, 'minor': 2, 'tiny': 0, 'prerelease': True}.

    EXAMPLES:
        sage: from sage.misc.banner import version_dict
        sage: print "Sage major version is %s" % version_dict()['major']
        Sage major version is ...
        sage: version_dict()['major'] == int(sage.version.version.split('.')[0])
        True
    """
    v = SAGE_VERSION.split('.')
    dict = {}
    dict['major'] = int(v[0])
    dict['minor'] = int(v[1])
    dict['tiny'] = 0
    dict['prerelease'] = False
    try:
        dummy = int(v[-1])
    except ValueError:  # when last entry is not an integer
        dict['prerelease'] = True
    if (len(v) == 3 and not dict['prerelease']) or len(v) > 3:
        dict['tiny'] = int(v[2])
    try:
        teeny = int(v[3])
        dict['tiny'] += 0.1 * teeny
    except (ValueError, IndexError):
        pass
    return dict
Beispiel #3
0
from lmfdb.utils import make_logger
import flask

## Some common definitions to use in this module.

default_prec = 10   # The default number of terms in a q-expansion
default_bprec = 53  # The default number of bits of precision to compute for floating point data
default_display_bprec = 26  # The default number of bits of precision to display for floating point data
default_max_height = 90
from sage.env import SAGE_VERSION
version_major, version_minor = [int(x) for x in SAGE_VERSION.split('.')[:2]]
#if (version_major, version_minor) >= (6,9):
#    emf_version = 1.3
#elif (version_major, version_minor) >= (6,8):
#    emf_version = 1.3
#else:
#    emf_version = 1.1
emf_version = 1.3

EMF_TOP = "Holomorphic Modular Forms"  # The name to use for the top of this catergory
EMF = "emf"  # The current blueprint name
emf = flask.Blueprint(EMF, __name__, template_folder="views/templates", static_folder="views/static")
emf_logger = make_logger(emf)
emf_logger.info("Initializing elliptic modular forms blueprint with Sage version %s, emf version %s" % (SAGE_VERSION, emf_version))

### Maximum values for computations
N_max_comp = 50
k_max_comp = 12
N_max_Gamma1_fdraw = 33
N_max_Gamma0_fdraw = 300
N_max_db = 5000
Beispiel #4
0
from lmfdb.utils import make_logger
import flask

## Some common definitions to use in this module.

default_prec = 10  # The default number of terms in a q-expansion
default_bprec = 53  # The default number of bits of precision to compute for floating point data
default_display_bprec = 26  # The default number of bits of precision to display for floating point data
default_max_height = 90
from sage.env import SAGE_VERSION
version_major, version_minor = [int(x) for x in SAGE_VERSION.split('.')[:2]]
#if (version_major, version_minor) >= (6,9):
#    emf_version = 1.3
#elif (version_major, version_minor) >= (6,8):
#    emf_version = 1.3
#else:
#    emf_version = 1.1
emf_version = 1.3

EMF_TOP = "Holomorphic Modular Forms"  # The name to use for the top of this catergory
EMF = "emf"  # The current blueprint name
emf = flask.Blueprint(EMF,
                      __name__,
                      template_folder="views/templates",
                      static_folder="views/static")
emf_logger = make_logger(emf)
emf_logger.info(
    "Initializing elliptic modular forms blueprint with Sage version %s, emf version %s"
    % (SAGE_VERSION, emf_version))

### Maximum values for computations