コード例 #1
0
def main(argv):
    file_name = argv[0]
    database_collection = argv[1]
    assert "." in database_collection
    database_name, collection_name = database_collection.split(".")
    # If you know what you are doing, remove the line below.
    # In general you should just avoid using this with an existing collection as it might overwrite information
    assert database_name == "limbo"

    print("Importing file ", file_name, " to database ", database_name, " and collection ", collection_name)
    import json
    import sys
    sys.path.append("../")
    import base
    print("getting connection")
    base._init(37010, "")
    print("I have it")

    C = base.getDBConnection()
    
    collection = C[database_name][collection_name]
    print("Got a collectiopn: ", collection)
    with open(file_name, "r") as f:
        print("Loading data in memory")
        data = json.load(f)
        print("Done")
        print("There are ", len(data), " items ")
        import sys
        sys.path.append("../")
        print("Uploading")
        for x in data:
            try:
                collection.save(x)
            except OverflowError:
                print(x)
                raise OverflowError
        print("Done")
コード例 #2
0
def main(argv):
    file_name = argv[0]
    database_collection = argv[1]
    assert "." in database_collection
    database_name, collection_name = database_collection.split(".")
    # If you know what you are doing, remove the line below.
    # In general you should just avoid using this with an existing collection as it might overwrite information
    assert database_name == "limbo"

    print "Importing file ", file_name, " to database ", database_name, " and collection ", collection_name
    import json
    import sys
    sys.path.append("../")
    import base
    print "getting connection"
    base._init(37010, "")
    print "I have it"

    C = base.getDBConnection()
    
    collection = C[database_name][collection_name]
    print "Got a collectiopn: ", collection
    with open(file_name, "r") as f:
        print "Loading data in memory"
        data = json.load(f)
        print "Done"
	print "There are ", len(data), " items "
        import sys
        sys.path.append("../")
        print "Uploading"
        for x in data:
            try:
                collection.save(x)
            except OverflowError:
                print x
                raise OverflowError
        print "Done"
コード例 #3
0
ファイル: website.py プロジェクト: swisherh/lmfdb
        del configuration['flask_options']["PROFILE"]

    app.run(**configuration['flask_options'])

if True:
    # this bit is so that we can import website.py to use
    # with gunicorn.
    import logging
    logfile = "flasklog"
    file_handler = logging.FileHandler(logfile)
    file_handler.setLevel(logging.WARNING)

    root_logger = logging.getLogger()
    root_logger.setLevel(logging.INFO)
    root_logger.name = "LMFDB"

    import utils
    formatter = logging.Formatter(utils.LmfdbFormatter.fmtString.split(r'[')[0])
    ch = logging.StreamHandler()
    ch.setFormatter(formatter)
    root_logger.addHandler(ch)

    if not configuration:
        configuration = get_configuration()
    logging.info("configuration: %s" % configuration)
    _init(**configuration['mongo_client_options'])
    app.logger.addHandler(file_handler)

def getDownloadsFor(path):
    return "bar"
コード例 #4
0
# -*- coding: utf-8 -*-
import sys
import time
import bson
import sage.all
from sage.all import *
import os
import json

sys.path.append("../")
import base
from pymongo.connection import Connection
base._init(dbport, "")
C = base.getDBConnection()
import pymongo

gr = C.transitivegroups.groups

labels = ['label', 'n', 't', 'auts', 'order', 'parity', 'ab', 'prim', 'cyc', 'solv', 'subs', 'repns', 'resolve', 'name', 'pretty']

gps = gr.find({})
myfile = open('gg_data')

for l in myfile:
  v= json.loads(l)
  data = {}
  for j in range(len(v)):
    data[labels[j]] = v[j]


コード例 #5
0
# This is not a unittest, just a quick script

print "importing base"
import base
print ".....done"
print "initializing connection"
base._init(dbport, "")
print ".....done"

print "math_classes, Lfunction"
from math_classes import ArtinRepresentation, NumberFieldGaloisGroup
from Lfunction import ArtinLfunction
print ".....done"

# a = ArtinRepresentation(1,"5",2)
# b = ArtinRepresentation.find_one({'Dim': 1, 'DBIndex': 1, 'Conductor': '5'})
# c = b.number_field_galois_group()
# d = c.artin_representations()

# l = ArtinLfunction(dimension = "1", conductor = "5", tim_index = "2")
k = 0

for x in ArtinRepresentation.find():
    try:
        tmp = [
            x.local_factor(p) for p in [11, 13, 17, 19, 23]
            if not self.is_bad_prime(p)
        ]
        print tmp
        print x
    except:
コード例 #6
0
    import logging
    root_logger = logging.getLogger()
    root_logger.setLevel(logging.INFO)
    root_logger.name = "LMFDB"
    import utils
    formatter = logging.Formatter(utils.LmfdbFormatter.fmtString.split(r'[')[0])
    ch = logging.StreamHandler()
    ch.setFormatter(formatter)
    root_logger.addHandler(ch)
    
    file_handler = logging.FileHandler(logfile)
    file_handler.setLevel(logging.WARNING)
    app.logger.addHandler(file_handler)
    
    import base
    base._init(dbport, readwrite_password)
    base.set_logfocus(logfocus)
    logging.info("... done.")

    # just for debugging
    #if options["debug"]:
    #  logging.info(str(app.url_map))

    app.run(**options)


if __name__ == '__main__':
    main()
else:
    # this bit is so that we can import website.py to use
    # with gunicorn.
コード例 #7
0
"""

import os.path
import gzip
import re
import sys
import time
import os
import random
import glob
import pymongo
import base
from sage.rings.all import ZZ

print "calling base._init()"
base._init(dbport, '')
print "getting connection"
conn = base.getDBConnection()
print "setting curves"
# curves = conn.elliptic_curves.test
curves = conn.elliptic_curves.curves

# The following ensure_index command checks if there is an index on
# label, conductor, rank and torsion. If there is no index it creates
# one.  Need: once torsion structure is computed, we should have an
# index on that too.

curves.ensure_index('label')
curves.ensure_index('conductor')
curves.ensure_index('rank')
curves.ensure_index('torsion')
コード例 #8
0
ファイル: website.py プロジェクト: jbalakrishnan/lmfdb
    # if options["debug"]:
    #  logging.info(str(app.url_map))

    app.run(**configuration['flask_options'])

if True:
    # this bit is so that we can import website.py to use
    # with gunicorn.
    import logging
    logfile = "flasklog"
    file_handler = logging.FileHandler(logfile)
    file_handler.setLevel(logging.WARNING)

    root_logger = logging.getLogger()
    root_logger.setLevel(logging.INFO)
    root_logger.name = "LMFDB"

    import utils
    formatter = logging.Formatter(utils.LmfdbFormatter.fmtString.split(r'[')[0])
    ch = logging.StreamHandler()
    ch.setFormatter(formatter)
    root_logger.addHandler(ch)

    logging.info("configuration: %s" % configuration)
    import base
    base._init(configuration['dbport'], readwrite_password, parallel_authentication = configuration["threading_opt"])
    app.logger.addHandler(file_handler)

def getDownloadsFor(path):
    return "bar"
コード例 #9
0
    formatter = logging.Formatter(
        utils.LmfdbFormatter.fmtString.split(r'[')[0])
    ch = logging.StreamHandler()
    ch.setFormatter(formatter)
    root_logger.addHandler(ch)

    app.logger.addHandler(file_handler)


if True:
    # this bit is so that we can import website.py to use with gunicorn
    # and to setup logging before anything
    setup_logging()
    logging.info("Configuration = %s" % Configuration().get_all())

    _init()
    if [int(c) for c in sage.version.version.split(".")[:2]
        ] < [int(c) for c in LMFDB_SAGE_VERSION.split(".")[:2]]:
        logging.warning("*** WARNING: SAGE VERSION %s IS OLDER THAN %s ***" %
                        (sage.version.version, LMFDB_SAGE_VERSION))

# Import top-level modules that makeup the site
# Note that this necessarily includes everything, even code in still in an alpha state
import pages
assert pages
import api
assert api
import belyi
assert belyi
import bianchi_modular_forms
assert bianchi_modular_forms
コード例 #10
0
import os.path
import gzip
import re
import sys
import time
import os
import random
import glob
import pymongo
import base
from sage.rings.all import ZZ

print "calling base._init()"
dbport=37010
base._init(dbport, '')
print "getting connection"
conn = base.getDBConnection()
print "setting curves"
# curves = conn.elliptic_curves.test
curves = conn.elliptic_curves.curves

# The following ensure_index command checks if there is an index on
# label, conductor, rank and torsion. If there is no index it creates
# one.  Need: once torsion structure is computed, we should have an
# index on that too.

curves.ensure_index('label')
curves.ensure_index('conductor')
curves.ensure_index('rank')
curves.ensure_index('torsion')
コード例 #11
0
ファイル: website.py プロジェクト: paulhus/lmfdb
    app.run(**configuration['flask_options'])


if True:
    # this bit is so that we can import website.py to use
    # with gunicorn.
    import logging
    logfile = "flasklog"
    file_handler = logging.FileHandler(logfile)
    file_handler.setLevel(logging.WARNING)

    root_logger = logging.getLogger()
    root_logger.setLevel(logging.INFO)
    root_logger.name = "LMFDB"

    import utils
    formatter = logging.Formatter(
        utils.LmfdbFormatter.fmtString.split(r'[')[0])
    ch = logging.StreamHandler()
    ch.setFormatter(formatter)
    root_logger.addHandler(ch)

    logging.info("configuration: %s" % configuration)
    import base
    base._init(configuration['dbport'])
    app.logger.addHandler(file_handler)


def getDownloadsFor(path):
    return "bar"
コード例 #12
0
if True:
    # this bit is so that we can import website.py to use
    # with gunicorn.
    import logging
    logfile = "flasklog"
    file_handler = logging.FileHandler(logfile)
    file_handler.setLevel(logging.WARNING)

    root_logger = logging.getLogger()
    root_logger.setLevel(logging.INFO)
    root_logger.name = "LMFDB"

    import utils
    formatter = logging.Formatter(
        utils.LmfdbFormatter.fmtString.split(r'[')[0])
    ch = logging.StreamHandler()
    ch.setFormatter(formatter)
    root_logger.addHandler(ch)

    logging.info("configuration: %s" % configuration)
    import base
    base._init(configuration['dbport'],
               readwrite_password,
               parallel_authentication=configuration["threading_opt"])
    app.logger.addHandler(file_handler)


def getDownloadsFor(path):
    return "bar"
コード例 #13
0
# This is not a unittest, just a quick script

print "importing base"
import base
print ".....done"
print "initializing connection"
base._init(37010, "")
print ".....done"

print "math_classes, Lfunction"
from math_classes import ArtinRepresentation, NumberFieldGaloisGroup
from Lfunction import ArtinLfunction
print ".....done"

# a = ArtinRepresentation(1,"5",2)
# b = ArtinRepresentation.find_one({'Dim': 1, 'DBIndex': 1, 'Conductor': '5'})
# c = b.number_field_galois_group()
# d = c.artin_representations()


# l = ArtinLfunction("1","5","2")
k = 0

for x in ArtinRepresentation.find():
    try:
        tmp = [x.local_factor(p) for p in [11, 13, 17, 19, 23] if not self.is_bad_prime(p)]
        print tmp
        print x
    except:
        pass
    k += 1
コード例 #14
0
ファイル: website.py プロジェクト: kedlaya/lmfdb
    formatter = logging.Formatter(utils.LmfdbFormatter.fmtString.split(r'[')[0])
    ch = logging.StreamHandler()
    ch.setFormatter(formatter)
    root_logger.addHandler(ch)

    app.logger.addHandler(file_handler)


if True:
    # this bit is so that we can import website.py to use with gunicorn
    # and to setup logging before anything
    setup_logging()
    logging.info("Configuration = %s" % Configuration().get_all())

    _init()
    if [int(c) for c in sage.version.version.split(".")[:2]] < [int(c) for c in LMFDB_SAGE_VERSION.split(".")[:2]]:
        logging.warning("*** WARNING: SAGE VERSION %s IS OLDER THAN %s ***"%(sage.version.version,LMFDB_SAGE_VERSION))

# Import top-level modules that makeup the site
# Note that this necessarily includes everything, even code in still in an alpha state
import pages
assert pages
import api
assert api
import belyi
assert belyi
import bianchi_modular_forms
assert bianchi_modular_forms
import hilbert_modular_forms
assert hilbert_modular_forms
コード例 #15
0
from lmfdb.math_classes import ArtinRepresentation

import base
base._init(int(37010), "")

# x is raw
# a is of type ArtinRepresentation

# all the artin reps that come out of this are safe to appear on the website
# their L functions need to be fixed however

# if you want to do complex queries, and sort using pymongo's interface:
for x in ArtinRepresentation.collection().find():
    a = ArtinRepresentation(data=x)
    print a
    try:
        print a.Lfunction()
    except NotImplementedError or SyntaxError:
        print "Need CYC types and sign"

# if you want to list them all, using a wrapper to directly convert to ArtinRepresentation
for a in ArtinRepresentation.find():
    print a
    try:
        print a.Lfunction()
    except NotImplementedError or SyntaxError:
        print "Need CYC types"
コード例 #16
0
ファイル: website.py プロジェクト: andreeamocanu/lmfdb

if True:
    # this bit is so that we can import website.py to use
    # with gunicorn.
    import logging
    logfile = "flasklog"
    file_handler = logging.FileHandler(logfile)
    file_handler.setLevel(logging.WARNING)

    root_logger = logging.getLogger()
    root_logger.setLevel(logging.INFO)
    root_logger.name = "LMFDB"

    import utils
    formatter = logging.Formatter(
        utils.LmfdbFormatter.fmtString.split(r'[')[0])
    ch = logging.StreamHandler()
    ch.setFormatter(formatter)
    root_logger.addHandler(ch)

    if not configuration:
        configuration = get_configuration()
    logging.info("configuration: %s" % configuration)
    _init(configuration['dbport'])
    app.logger.addHandler(file_handler)


def getDownloadsFor(path):
    return "bar"
コード例 #17
0
ファイル: website.py プロジェクト: nilsskoruppa/lmfdb
    if not configuration:
        configuration = get_configuration()
    app.run(**configuration['flask_options'])

if True:
    # this bit is so that we can import website.py to use
    # with gunicorn.
    import logging
    logfile = "flasklog"
    file_handler = logging.FileHandler(logfile)
    file_handler.setLevel(logging.WARNING)

    root_logger = logging.getLogger()
    root_logger.setLevel(logging.INFO)
    root_logger.name = "LMFDB"

    import utils
    formatter = logging.Formatter(utils.LmfdbFormatter.fmtString.split(r'[')[0])
    ch = logging.StreamHandler()
    ch.setFormatter(formatter)
    root_logger.addHandler(ch)

    if not configuration:
        configuration = get_configuration()
    logging.info("configuration: %s" % configuration)
    _init(configuration['dbport'])
    app.logger.addHandler(file_handler)

def getDownloadsFor(path):
    return "bar"
コード例 #18
0
ファイル: import_ec_data.py プロジェクト: anneschilling/lmfdb
"""

import os.path
import gzip
import re
import sys
import time
import os
import random
import glob
import pymongo
import base
from sage.rings.all import ZZ

print "calling base._init()"
base._init(int(37010), '')
print "getting connection"
conn = base.getDBConnection()
print "setting curves"
# curves = conn.elliptic_curves.test
curves = conn.elliptic_curves.curves

# The following ensure_index command checks if there is an index on
# label, conductor, rank and torsion. If there is no index it creates
# one.  Need: once torsion structure is computed, we should have an
# index on that too.

curves.ensure_index('label')
curves.ensure_index('conductor')
curves.ensure_index('rank')
curves.ensure_index('torsion')
コード例 #19
0
if True:
    # this bit is so that we can import website.py to use with gunicorn
    if not configuration:
        configuration = get_configuration()

    file_handler = logging.FileHandler(
        configuration['logging_options']['logfile'])
    file_handler.setLevel(logging.WARNING)
    if 'logfocus' in configuration['logging_options']:
        set_logfocus(configuration['logging_options']['logfocus'])
        logging.getLogger(get_logfocus()).setLevel(logging.DEBUG)

    root_logger = logging.getLogger()
    root_logger.setLevel(logging.INFO)
    root_logger.name = "LMFDB"

    formatter = logging.Formatter(
        utils.LmfdbFormatter.fmtString.split(r'[')[0])
    ch = logging.StreamHandler()
    ch.setFormatter(formatter)
    root_logger.addHandler(ch)

    logging.info("configuration: %s" % configuration)
    _init(**configuration['mongo_client_options'])
    app.logger.addHandler(file_handler)
    if [int(c) for c in sage.version.version.split(".")[:2]
        ] < [int(c) for c in LMFDB_SAGE_VERSION.split(".")[:2]]:
        logging.warning("*** WARNING: SAGE VERSION %s IS OLDER THAN %s ***" %
                        (sage.version.version, LMFDB_SAGE_VERSION))
コード例 #20
0
ファイル: website.py プロジェクト: paulhus/lmfdb
    # if options["debug"]:
    #  logging.info(str(app.url_map))

    app.run(**configuration['flask_options'])

if True:
    # this bit is so that we can import website.py to use
    # with gunicorn.
    import logging
    logfile = "flasklog"
    file_handler = logging.FileHandler(logfile)
    file_handler.setLevel(logging.WARNING)

    root_logger = logging.getLogger()
    root_logger.setLevel(logging.INFO)
    root_logger.name = "LMFDB"

    import utils
    formatter = logging.Formatter(utils.LmfdbFormatter.fmtString.split(r'[')[0])
    ch = logging.StreamHandler()
    ch.setFormatter(formatter)
    root_logger.addHandler(ch)

    logging.info("configuration: %s" % configuration)
    import base
    base._init(configuration['dbport'])
    app.logger.addHandler(file_handler)

def getDownloadsFor(path):
    return "bar"