""" import os import shutil import socket import sys import tempfile import time import urllib import urllib2 from invenio.config import CFG_BIBUPLOAD_FFT_ALLOWED_LOCAL_PATHS, \ CFG_TMPSHAREDDIR from invenio_utils.url import make_invenio_opener URL_OPENER = make_invenio_opener('filedownloadutils') #: block size when performing I/O. CFG_FILEUTILS_BLOCK_SIZE = 1024 * 8 class InvenioFileDownloadError(Exception): """A generic download exception.""" def __init__(self, msg, code=None): Exception.__init__(self, msg) self.code = code class InvenioFileCopyError(Exception):
from datetime import datetime, timedelta from flask import current_app from invenio_base.globals import cfg from invenio_utils.url import make_invenio_opener import rdflib from six import iteritems from six.moves import cPickle from .errors import TaxonomyError from .registry import taxonomies urlopen = make_invenio_opener('classifier').open _contains_digit = re.compile("\d") _starts_with_non = re.compile("(?i)^non[a-z]") _starts_with_anti = re.compile("(?i)^anti[a-z]") _split_by_punctuation = re.compile("(\W+)") _CACHE = {} def get_cache(taxonomy_id): """Return thread-safe cache for the given taxonomy id. :param taxonomy_id: identifier of the taxonomy :type taxonomy_id: str
from flask import current_app from invenio_base.globals import cfg from invenio_utils.url import make_invenio_opener from werkzeug.local import LocalProxy import rdflib from six import iteritems from six.moves import cPickle from .errors import TaxonomyError from .registry import taxonomies urlopen = LocalProxy(lambda: make_invenio_opener('classifier').open) _contains_digit = re.compile("\d") _starts_with_non = re.compile("(?i)^non[a-z]") _starts_with_anti = re.compile("(?i)^anti[a-z]") _split_by_punctuation = re.compile("(\W+)") _CACHE = {} def get_cache(taxonomy_id): """Return thread-safe cache for the given taxonomy id. :param taxonomy_id: identifier of the taxonomy :type taxonomy_id: str