示例#1
0
def nlmsa_textdump_unpickler(filepath,kwargs):
  from cnestedlist import textfile_to_binaries,NLMSA
  logger.info('Saving NLMSA indexes from textdump: %s' % filepath)
  path = textfile_to_binaries(filepath,
                      buildpath=classutil.get_env_or_cwd('PYGRDATABUILDDIR'),
                              **kwargs)
  o = NLMSA(path) # NOW OPEN IN READ MODE FROM THE SAVED INDEX FILESET
  o._saveLocalBuild = True # MARK THIS FOR SAVING IN LOCAL PYGR.DATA
  return o
示例#2
0
def nlmsa_textdump_unpickler(filepath, kwargs):
    from cnestedlist import textfile_to_binaries, NLMSA
    logger.info('Saving NLMSA indexes from textdump: %s' % filepath)
    try:
        buildpath = os.environ['WORLDBASEBUILDDIR']
    except KeyError:
        buildpath = classutil.get_env_or_cwd('PYGRDATABUILDDIR')
    path = textfile_to_binaries(filepath, buildpath=buildpath, **kwargs)
    o = NLMSA(path) # now open in read mode from the saved index fileset
    o._saveLocalBuild = True # mark this for saving in local metabase
    return o
def nlmsa_textdump_unpickler(filepath, kwargs):
    from cnestedlist import textfile_to_binaries, NLMSA

    logger.info("Saving NLMSA indexes from textdump: %s" % filepath)
    try:
        buildpath = os.environ["WORLDBASEBUILDDIR"]
    except KeyError:
        buildpath = classutil.get_env_or_cwd("PYGRDATABUILDDIR")
    path = textfile_to_binaries(filepath, buildpath=buildpath, **kwargs)
    o = NLMSA(path)  # now open in read mode from the saved index fileset
    o._saveLocalBuild = True  # mark this for saving in local metabase
    return o
示例#4
0
def download_unpickler(path,filename,kwargs):
    'try to download the desired file, and uncompress it if need be'
    import urllib,classutil,os
    if filename is None:
        filename = os.path.basename(path)
    filepath = os.path.join(classutil.get_env_or_cwd('PYGRDATADOWNLOAD'),\
        filename)
    logger.info('Beginning download of %s to %s...' % (path, filepath))
    t = urllib.urlretrieve(path,filepath,download_monitor)
    logger.info('Download done.')
    filepath = uncompress_file(filepath, **kwargs) # UNCOMPRESS IF NEEDED
    # PATH TO WHERE THIS FILE IS NOW STORED
    o = classutil.SourceFileName(filepath)
    o._saveLocalBuild = True # MARK THIS FOR SAVING IN LOCAL PYGR.DATA
    return o
示例#5
0
def download_unpickler(path, filename, kwargs):
    'try to download the desired file, and uncompress it if need be'
    import os
    import urllib
    import classutil
    if filename is None:
        filename = os.path.basename(path)
    try:
        dl_dir = os.environ['WORLDBASEDOWNLOAD']
    except KeyError:
        dl_dir = classutil.get_env_or_cwd('PYGRDATADOWNLOAD')
    filepath = os.path.join(dl_dir, filename)
    logger.info('Beginning download of %s to %s...' % (path, filepath))
    t = urllib.urlretrieve(path, filepath, download_monitor)
    logger.info('Download done.')
    filepath = uncompress_file(filepath, **kwargs)  # UNCOMPRESS IF NEEDED
    # PATH TO WHERE THIS FILE IS NOW STORED
    o = classutil.SourceFileName(filepath)
    o._saveLocalBuild = True  # MARK THIS FOR SAVING IN LOCAL PYGR.DATA
    return o