Skip to content

Commit

Permalink
Merge pull request #5925 from BarinderBanwait/modcrv_testing
Browse files Browse the repository at this point in the history
refactor verify folder
  • Loading branch information
roed314 authored Mar 12, 2024
2 parents 9e7e82f + 3dff40b commit 6973366
Show file tree
Hide file tree
Showing 17 changed files with 29 additions and 16 deletions.
16 changes: 11 additions & 5 deletions lmfdb/verify/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,17 @@

_curdir = os.path.dirname(os.path.abspath(__file__))
_prefix = 'lmfdb.verify.'
for tablename in database.db.tablenames:
filename = os.path.join(_curdir, tablename + '.py')
if os.path.exists(filename):
verifier = getattr(importlib.import_module(_prefix + tablename), tablename)
database.db[tablename]._verifier = verifier()

for dirpath, dirs, filenames in os.walk(_curdir):
filenames = [f for f in filenames if f[0] != '_']
filenames = [f for f in filenames if os.path.splitext(f)[-1] == '.py'] # this filters out any table names that end up in log files
dirs[:] = [d for d in dirs if d[0] != '_']
for f in filenames:
tablename = os.path.splitext(f)[0]
if tablename in database.db.tablenames:
other_thing = os.path.basename(os.path.normpath(dirpath)) + '.'
verifier = getattr(importlib.import_module(_prefix + other_thing + tablename), tablename)
database.db[tablename]._verifier = verifier()
database.db.is_verifying = True
db = database.db
__all__ = ['db']
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

from lmfdb.lmfdb_database import db
from .verification import TableChecker, overall
from ..verification import TableChecker, overall

class gps_gl2zhat_fine(TableChecker):
table = db.gps_gl2zhat_fine
Expand Down
2 changes: 1 addition & 1 deletion lmfdb/verify/mf.py → lmfdb/verify/mf/mf.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from sage.all import cached_function, psi, RR, Integer, prod

from psycopg2.sql import SQL, Identifier
from .verification import TableChecker, overall
from ..verification import TableChecker, overall


@cached_function
Expand Down
2 changes: 1 addition & 1 deletion lmfdb/verify/mf_gamma1.py → lmfdb/verify/mf/mf_gamma1.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from lmfdb.lmfdb_database import db, SQL
from .mf import MfChecker, check_analytic_conductor
from .verification import overall, slow, fast, accumulate_failures
from ..verification import overall, slow, fast, accumulate_failures

@cached_function
def sturm_bound1(level, weight):
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

from lmfdb import db
from .mf import SubspacesChecker
from .verification import overall
from ..verification import overall

class mf_gamma1_subspaces(SubspacesChecker):
table = db.mf_gamma1_subspaces
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from lmfdb.backend.utils import IdentifierWrapper as Identifier
from psycopg2.sql import SQL, Literal
from .mf import MfChecker
from .verification import overall, overall_long, slow
from ..verification import overall, overall_long, slow

class mf_hecke_cc(MfChecker):
table = db.mf_hecke_cc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from lmfdb.lmfdb_database import db, SQL
from .mf import MfChecker
from .verification import overall, overall_long, accumulate_failures
from ..verification import overall, overall_long, accumulate_failures

class mf_hecke_lpolys(MfChecker):
table = db.mf_hecke_lpolys
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from lmfdb.lmfdb_database import db, SQL
from .mf import MfChecker
from .verification import overall, slow, integer_types
from ..verification import overall, slow, integer_types

class mf_hecke_nf(MfChecker):
table = db.mf_hecke_nf
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from psycopg2.sql import SQL, Literal
from lmfdb.utils import names_and_urls
from .mf import MfChecker
from .verification import overall, overall_long, slow, fast, accumulate_failures
from ..verification import overall, overall_long, slow, fast, accumulate_failures

CCC = ComplexField(200)

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from lmfdb.lmfdb_database import db, SQL
from .mf import MfChecker, check_analytic_conductor
from .verification import overall, overall_long, fast, slow, accumulate_failures
from ..verification import overall, overall_long, fast, slow, accumulate_failures


@cached_function
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

from lmfdb import db
from .mf import SubspacesChecker
from .verification import overall
from ..verification import overall

class mf_subspaces(SubspacesChecker):
table = db.mf_subspaces
Expand Down
9 changes: 8 additions & 1 deletion lmfdb/verify/verify_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,14 @@ def directory(path):

def find_validated_tables():
curdir = os.path.dirname(os.path.abspath(__file__))
return [tablename for tablename in db.tablenames if os.path.exists(os.path.join(curdir, tablename + '.py'))]
validated_tables = []

for _, _, filenames in os.walk(curdir):
for f in filenames:
root_name = os.path.splitext(f)[0]
if root_name in db.tablenames:
validated_tables.append(root_name)
return validated_tables

if __name__ == '__main__':
validated_tables = find_validated_tables()
Expand Down

0 comments on commit 6973366

Please sign in to comment.