<commit_before>
from pygr import pygrData,pygrSchema
from metabase import ResourceServer, dumps, OneToManyRelation, \
     ManyToManyRelation, PygrDataNotPortableError, PygrDataNotFoundError, \
     PygrDataMismatchError, PygrDataEmptyError, PygrDataReadOnlyError, \
     PygrDataSchemaError, PygrDataNoModuleError, ResourceZone

schema = pygrSchema # ROOT OF OUR SCHEMA NAMESPACE

# PROVIDE TOP-LEVEL NAMES IN OUR RESOURCE HIERARCHY
Bio = pygrData.Bio

getResource = pygrData._mdb # our metabase interface
addResource = pygrData._mdb.add_resource
addSchema = pygrData._mdb.add_schema
deleteResource = pygrData._mdb.delete_resource
dir = pygrData._mdb.dir
def newServer(*args, **kwargs):
    return ResourceServer(pygrData._mdb, *args, **kwargs)
save = pygrData._mdb.commit
rollback = pygrData._mdb.rollback
list_pending = pygrData._mdb.list_pending
loads = pygrData._mdb.loads<commit_msg>provided pygr.Data.addResourceDict() for backwards compatibility<commit_after>
from pygr import pygrData,pygrSchema
from metabase import ResourceServer, dumps, OneToManyRelation, \
     ManyToManyRelation, PygrDataNotPortableError, PygrDataNotFoundError, \
     PygrDataMismatchError, PygrDataEmptyError, PygrDataReadOnlyError, \
     PygrDataSchemaError, PygrDataNoModuleError, ResourceZone

schema = pygrSchema # ROOT OF OUR SCHEMA NAMESPACE

# PROVIDE TOP-LEVEL NAMES IN OUR RESOURCE HIERARCHY
Bio = pygrData.Bio

getResource = pygrData._mdb # our metabase interface
addResource = pygrData._mdb.add_resource
def addResourceDict(d, layer=None):
    'queue a dict of name:object pairs for saving to specified db layer'
    if layer is not None: # use the named metabase specified by layer
        mdb = pygrData._mdb.zoneDict[layer] # KeyError if layer not found!
    else: # use default MetabaseList
        mdb = pygrData._mdb
    for k,v in d.items(): # queue each resource in the dictionary
        mdb.add_resource(k, v)

addSchema = pygrData._mdb.add_schema
deleteResource = pygrData._mdb.delete_resource
dir = pygrData._mdb.dir
def newServer(*args, **kwargs):
    return ResourceServer(pygrData._mdb, *args, **kwargs)
save = pygrData._mdb.commit
rollback = pygrData._mdb.rollback
list_pending = pygrData._mdb.list_pending
loads = pygrData._mdb.loads
{'fraction_non_alphanumeric': 0.07435440783615316, 'fraction_numerical': 0.0, 'mean_word_length': 5.224376731301939, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6457736', 'n_tokens_mistral': 741, 'n_tokens_neox': 731, 'n_words': 183}