Retrieve upload library from nglims specified user libraries.
190804
def _library_from_nglims(gi, sample_info, config):
    
    names = [config.get(x, "").strip() for x in ["lab_association", "researcher"]
             if config.get(x)]
    for name in names:
        for ext in ["sequencing", "lab"]:
            check_name = "%s %s" % (name.split()[0], ext)
            try:
                return _get_library_from_name(gi, check_name, None, sample_info)
            except ValueError:
                pass
    check_names = set([x.lower() for x in names])
    for libname, role in config["private_libs"]:
        # Try to find library for lab or rsearcher
        if libname.lower() in check_names:
            return _get_library_from_name(gi, libname, role, sample_info)
    # default to first private library if available
    if len(config.get("private_libs", [])) > 0:
        libname, role = config["private_libs"][0]
        return _get_library_from_name(gi, libname, role, sample_info)
    # otherwise use the lab association or researcher name
    elif len(names) > 0:
        return _get_library_from_name(gi, names[0], None, sample_info, create=True)
    else:
        raise ValueError("Could not find Galaxy library for sample %s" % sample_info["description"])
1230321
def get_upload_form(self):
        """"""
        return self.form_class(self.request.POST, self.request.FILES)
68316
private Throwable loadLib(String _lib) {
        try {
            System.load(_lib);
            return null;
        } catch (Throwable _ex) {
            return _ex;
        }
    }
1241079
def receiveVolumeInfo(self, paths):
        
        path = self.selectReceivePath(paths)
        path = path + Store.theInfoExtension

        if self._skipDryRun(logger)("receive info in '%s'", path):
            return None

        return _Uploader(self.bucket, path, bufferSize=theInfoBufferSize)
1313076
def _load_library(self):
        
        path = self._library_path()
        logger.info("Loading library from path {}".format(path))
        library_dir = os.path.dirname(path)
        if platform.system() == 'Windows':
            import win32api
            olddir = os.getcwd()
            os.chdir(library_dir)
            win32api.SetDllDirectory('.')

        result = cdll.LoadLibrary(path)

        if platform.system() == 'Windows':
            os.chdir(olddir)

        return result
736906
def getarchive(project, user, format=None):
        """"""
        if os.path.isfile(Project.path(project, user) + '.download'):
            #make sure we don't start two compression processes at the same time
            return withheaders(flask.make_response('Another compression is already running',403),headers={'allow_origin': settings.ALLOW_ORIGIN})
        else:
            if not format:
                data = flask.request.values
                if 'format' in data:
                    format = data['format']
                else:
                    format = 'zip' #default

            #validation, security
            contentencoding = None
            if format == 'zip':
                contenttype = 'application/zip'
                command = "/usr/bin/zip -r" #TODO: do not hard-code path!
                if os.path.isfile(Project.path(project, user) + "output/" + project + ".tar.gz"):
                    os.unlink(Project.path(project, user) + "output/" + project + ".tar.gz")
                if os.path.isfile(Project.path(project, user) + "output/" + project + ".tar.bz2"):
                    os.unlink(Project.path(project, user) + "output/" + project + ".tar.bz2")
            elif format == 'tar.gz':
                contenttype = 'application/x-tar'
                contentencoding = 'gzip'
                command = "/bin/tar -czf"
                if os.path.isfile(Project.path(project, user) + "output/" + project + ".zip"):
                    os.unlink(Project.path(project, user) + "output/" + project + ".zip")
                if os.path.isfile(Project.path(project, user) + "output/" + project + ".tar.bz2"):
                    os.unlink(Project.path(project, user) + "output/" + project + ".tar.bz2")
            elif format == 'tar.bz2':
                contenttype = 'application/x-bzip2'
                command = "/bin/tar -cjf"
                if os.path.isfile(Project.path(project, user) + "output/" + project + ".tar.gz"):
                    os.unlink(Project.path(project, user) + "output/" + project + ".tar.gz")
                if os.path.isfile(Project.path(project, user) + "output/" + project + ".zip"):
                    os.unlink(Project.path(project, user) + "output/" + project + ".zip")
            else:
                return withheaders(flask.make_response('Invalid archive format',403) ,headers={'allow_origin': settings.ALLOW_ORIGIN})#TODO: message won't show

            path = Project.path(project, user) + "output/" + project + "." + format

            if not os.path.isfile(path):
                printlog("Building download archive in " + format + " format")
                cmd = command + ' ' + project + '.' + format + ' *'
                printdebug(cmd)
                printdebug(Project.path(project, user)+'output/')
                process = subprocess.Popen(cmd, cwd=Project.path(project, user)+'output/', shell=True)
                if not process:
                    return withheaders(flask.make_response("Unable to make download package",500),headers={'allow_origin': settings.ALLOW_ORIGIN})
                else:
                    pid = process.pid
                    f = open(Project.path(project, user) + '.download','w')
                    f.write(str(pid))
                    f.close()
                    os.waitpid(pid, 0) #wait for process to finish
                    os.unlink(Project.path(project, user) + '.download')

            extraheaders = {'allow_origin': settings.ALLOW_ORIGIN }
            if contentencoding:
                extraheaders['Content-Encoding'] = contentencoding
            return withheaders(flask.Response( getbinarydata(path) ), contenttype, extraheaders )
292929
def jsonresolver_loader(url_map):
    """"""
    from flask import current_app
    url_map.add(Rule(
        '/grants/10.13039/<path:doi_grant_code>',
        endpoint=resolve_grant_endpoint,
        host=current_app.config['OPENAIRE_JSONRESOLVER_GRANTS_HOST']))
949241
public static void loadLibrary(boolean _trySystemLibsFirst, String _libName, String... _searchPathes) {
        if (!isEnabled()) {
            return;
        }

        List<SearchOrder> loadOrder = new ArrayList<>();

        if (_trySystemLibsFirst) {
            loadOrder.add(SearchOrder.SYSTEM_PATH);
        }

        loadOrder.add(SearchOrder.CUSTOM_PATH);
        loadOrder.add(SearchOrder.CLASS_PATH);

        loadLibrary(_libName, loadOrder.toArray(new SearchOrder[] {}), _searchPathes);
    }
393998
def _get_file_handlers(self, dsid):
        """"""
        ds_info = self.ids[dsid]

        filetype = self._preferred_filetype(ds_info['file_type'])
        if filetype is None:
            logger.warning("Required file type '%s' not found or loaded for "
                           "'%s'", ds_info['file_type'], dsid.name)
        else:
            return self.file_handlers[filetype]
1263679
def get_library_instance(self, library_path, library_name):
        """"""
        if self.is_library_in_libraries(library_path, library_name):
            from rafcon.core.states.library_state import LibraryState
            return LibraryState(library_path, library_name, "0.1")
        else:
            logger.warning("Library manager will not create a library instance which is not in the mounted libraries.")
625629
function pullcatalog(opts, cb) {
  opts.path = APIM_CATALOG_ENDP +
              '?' + // filter parms
              APIM_CLIENT_ID_EQ + opts.clientid + '&' +
              APIM_TYPE_EQ + APIM_TYPE_FILTER;
  opts.prefix = 'catalogs-';
  opts.suffix = '.json';
  fetch(opts, function(err, result) {
    if (err) {
      cb(err);
    } else if (typeof result === 'object') {
      response.catalogs = result.file;
      var models = [];
      models.push(new ModelType('products', 'products-', APIM_PRODUCTS_ENDP));
      models.push(new ModelType('apis', 'apis-', APIM_APIS_ENDP));
      models.push(new ModelType('subscriptions', 'subs-', APIM_SUBS_ENDP));
      models.push(new ModelType('tlsprofiles', 'tlsprofs-', APIM_TLS_ENDP));
      models.push(new ModelType('registries', 'registries-', APIM_REGISTRIES_ENDP));
      models.forEach(
        function(model) {
          response[model.name] = [];
        }
      );
      var catalogsJSON;
      try {
        catalogsJSON = JSON.parse(result.contents);
      } catch (e) {
        cb(e);
        return;
      }
      var catalogs = [];
      catalogsJSON.forEach(function(obj) {
        catalogs.push({
          org: obj.organization.id,
          cat: obj.id });
      });
      cb(null, catalogs, models);
    } else {
      var error = new Error('Unexpected type returned from catalog fetch');
      cb(error);
    }
  });
}
1136446
def get_provider(moduleOrReq):
    """"""
    if isinstance(moduleOrReq, Requirement):
        return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
    try:
        module = sys.modules[moduleOrReq]
    except KeyError:
        __import__(moduleOrReq)
        module = sys.modules[moduleOrReq]
    loader = getattr(module, '__loader__', None)
    return _find_adapter(_provider_factories, loader)(module)
811991
def slice_upload(cookie, data):
    '''
    '''
    url = ''.join([
        const.PCS_URL_C,
        'file?method=upload&type=tmpfile&app_id=250528',
        '&', cookie.sub_output('BDUSS'),
    ])
    fields = []
    files = [('file', ' ', data)]
    headers = {'Accept': const.ACCEPT_HTML,'Origin': const.PAN_URL}
    req = net.post_multipart(url, headers, fields, files)
    if req:
        return json.loads(req.data.decode())
    else:
        return None
958124
def getLibraryFiles(self, engineRoot, delimiter=' '):
		
		return delimiter.join(self.resolveRoot(self.libs, engineRoot))
336378
def _load_lib():
    """"""
    lib_path = find_lib_path()
    if len(lib_path) == 0:
        return None
    lib = ctypes.cdll.LoadLibrary(lib_path[0])
    lib.LGBM_GetLastError.restype = ctypes.c_char_p
    return lib
1368694
private static InputStream getInputStream(String libPath) throws IOException {
    Preconditions.checkArgument(
        (libPath.endsWith(".jar") || libPath.endsWith(".aar")) && Files.exists(Paths.get(libPath)),
        "invalid library path! " + libPath);
    LOG(VERBOSE, "Info", "opening library: " + libPath + "...");
    InputStream jarIS = null;
    if (libPath.endsWith(".jar")) {
      jarIS = new FileInputStream(libPath);
    } else if (libPath.endsWith(".aar")) {
      ZipFile aar = new ZipFile(libPath);
      ZipEntry jarEntry = aar.getEntry("classes.jar");
      jarIS = (jarEntry == null ? null : aar.getInputStream(jarEntry));
    }
    return jarIS;
  }
195769
def library(page = 0)
      songs = []
      resp = @client.request('userGetSongsInLibrary',
                             userID: @id,
                             page: page.to_s)
      songs = resp['songs'].map do |song|
        Song.new song
      end if resp.key?('songs')
      songs
    end