Try to ascertain locations of openjp2, openjpeg libraries.

    Returns
    -------
    tuple
        tuple of library handles
543286
def glymur_config():
    
    handles = (load_openjpeg_library(x) for x in ['openjp2', 'openjpeg'])
    handles = tuple(handles)

    if all(handle is None for handle in handles):
        msg = "Neither the openjp2 nor the openjpeg library could be loaded.  "
        warnings.warn(msg)
    return handles
1100687
def find_jdk_home_dir():
    
    for name in JDK_HOME_VARS:
        jdk_home_dir = os.environ.get(name, None)
        if jdk_home_dir \
                and os.path.exists(os.path.join(jdk_home_dir, 'include')) \
                and os.path.exists(os.path.join(jdk_home_dir, 'lib')):
            return jdk_home_dir
    logger.debug('Checking Maven for JAVA_HOME...')
    try:
        output = subprocess.check_output(['mvn', '-v'])
        if isinstance(output, bytes) and not isinstance(output, str):
            #PY3 related
            output = output.decode('utf-8')
        for part in output.split('\n'):
            if part.startswith('Java home:'):
                path = part.split(':')[1].strip()
                if path.endswith('jre'):
                    return path[0:-3]
                
    except Exception:
        # maven probably isn't installed or not on PATH
        logger.debug('Maven not found on PATH. No JAVA_HOME found.')

    return None
130854
def find_mounts(self):
        

        for mountpoint, (orig, fs, opts) in self.mountpoints.items():
            if 'bind' not in opts and (re.match(self.orig_re_pattern, orig) or
                                       (self.be_greedy and re.match(self.re_pattern, mountpoint))):
                yield mountpoint
293807
def get_name_locations(self, name):
        """"""
        result = []
        for module in self.names:
            if name in self.names[module]:
                try:
                    pymodule = self.project.get_module(module)
                    if name in pymodule:
                        pyname = pymodule[name]
                        module, lineno = pyname.get_definition_location()
                        if module is not None:
                            resource = module.get_module().get_resource()
                            if resource is not None and lineno is not None:
                                result.append((resource, lineno))
                except exceptions.ModuleNotFoundError:
                    pass
        return result
1134388
def _findSwiplDar():
    

    # If the exec is in path
    (path, swiHome) = _findSwiplFromExec()
    if path is not None:
        return (path, swiHome)

    # If it is not, use  find_library
    path = _findSwiplPathFromFindLib()
    if path is not None:
        return (path, swiHome)

    # Last guess, searching for the file
    paths = ['.', './lib', '/usr/lib/', '/usr/local/lib', '/opt/local/lib']
    names = ['libswipl.dylib', 'libpl.dylib']

    for name in names:
        for path in paths:
            path = os.path.join(path, name)
            if os.path.exists(path):
                return (path, None)

    return (None, None)
1354908
def _tools_classpath(self):
    

    javac_classpath = Java.global_javac_classpath(self.context.products)
    if javac_classpath:
      return javac_classpath

    self.set_distribution(jdk=True)
    jars = self.dist.find_libs(['tools.jar'])
    if len(jars) != 1:
      raise TaskError('Expected a single `tools.jar` entry for {}; got: {}'.format(
        self.dist, jars))
    return jars
1036426
def get_handlers(self):
        
        handlers = []
        self.static_root = self.application.get_app_component(
        ).get_component_path()
        if self.conf:
            if 'maps' in self.conf:
                if self.conf['maps'] is None:
                    logger.warning("Maps configuration is empty. Finish the"
                                   "static maps configuration.")
                    return handlers
                for map_item in self.conf['maps']:
                    logger.debug("Mapping %s handlers." % map_item['name'])
                    self.static_maps[map_item['name']] = {}
                    self.static_maps[
                        map_item['name']]['root'] = self.static_root
                    if 'root' in map_item:
                        if os.path.isabs(map_item['root']):
                            self.static_maps[
                                map_item['name']]['root'] = map_item['root']
                        else:
                            self.static_maps[
                                map_item['name']]['root'] = os.path.abspath(
                                os.path.join(self.static_root,
                                             map_item['root']))
                    if 'handlers' in map_item:
                        if map_item['handlers'] is None:
                            logger.warning("There is no handles mapped in the"
                                           " static maps config file.")
                        else:
                            handlers = handlers + self.get_static_handlers(
                                map_item)
        else:
            logger.warning("No static maps configurations were provided.")
        return handlers
1238790
def iter_locals(self):
        '''
        
        '''
        if self.is_optimized_out():
            return

        f_localsplus = self.field('f_localsplus')
        for i in safe_range(self.co_nlocals):
            pyop_value = PyObjectPtr.from_pyobject_ptr(f_localsplus[i])
            if not pyop_value.is_null():
                pyop_name = PyObjectPtr.from_pyobject_ptr(self.co_varnames[i])
                yield (pyop_name, pyop_value)
1072489
def find_implementations(project, resource, offset, resources=None,
                         task_handle=taskhandle.NullTaskHandle()):
    
    name = worder.get_name_at(resource, offset)
    this_pymodule = project.get_pymodule(resource)
    pyname = rope.base.evaluate.eval_location(this_pymodule, offset)
    if pyname is not None:
        pyobject = pyname.get_object()
        if not isinstance(pyobject, rope.base.pyobjects.PyFunction) or \
           pyobject.get_kind() != 'method':
            raise exceptions.BadIdentifierError('Not a method!')
    else:
        raise exceptions.BadIdentifierError('Cannot resolve the identifier!')

    def is_defined(occurrence):
        if not occurrence.is_defined():
            return False

    def not_self(occurrence):
        if occurrence.get_pyname().get_object() == pyname.get_object():
            return False
    filters = [is_defined, not_self,
               occurrences.InHierarchyFilter(pyname, True)]
    finder = occurrences.Finder(project, name, filters=filters)
    if resources is None:
        resources = project.get_python_files()
    job_set = task_handle.create_jobset('Finding Implementations',
                                        count=len(resources))
    return _find_locations(finder, resources, job_set)
630058
def get_backends():
    
    IGNORE_DIRS = ["core", "tools", "utils"]

    global backends
    if backends is None:
        backends = {}
        i3pystatus_dir = os.path.dirname(i3pystatus.__file__)
        subdirs = [
            x
            for x in next(os.walk(i3pystatus_dir))[1]
            if not x.startswith("_") and x not in IGNORE_DIRS
        ]
        for subdir in subdirs:
            dirs = next(os.walk(os.path.join(i3pystatus_dir, subdir)))[2]
            backends.update(
                {
                    x[:-3]: "i3pystatus.%s.%s" % (subdir, x[:-3])
                    for x in dirs
                    if not x.startswith("_") and x.endswith(".py")
                }
            )
    return backends
1319520
def trace_toolchain(toolchain):
    

    pkgs = []
    for cls in getmro(type(toolchain)):
        if not issubclass(cls, Toolchain):
            continue
        dist = _cls_lookup_dist(cls)
        value = {
            'project_name': dist.project_name,
            'version': dist.version,
        } if dist else {}
        key = '%s:%s' % (cls.__module__, cls.__name__)
        pkgs.append({key: value})
    return pkgs
60111
def library_sequencing_results(self):
        
        sres_ids = self.sequencing_result_ids
        res = {}
        for i in sres_ids:
            sres = SequencingResult(i)
            res[sres.library_id] = sres
        return res
122025
def _find_tpl(self):
        
        for tpl_possibility in self.tpl_possibilities:
            if os.path.isfile(tpl_possibility):
                return tpl_possibility

        return None
863888
public java.util.List<? extends com.google.appengine.v1.LibraryOrBuilder> 
      getLibrariesOrBuilderList() {
    return libraries_;
  }
523854
def get_distributions(self):
        

        pkg_resources = self.safe_import("pkg_resources")
        libdirs = self.base_paths["libdirs"].split(os.pathsep)
        dists = (pkg_resources.find_distributions(libdir) for libdir in libdirs)
        for dist in itertools.chain.from_iterable(dists):
            yield dist
60456
def _GetSubFileEntries(self):
    
    if self._directory is None:
      self._directory = self._GetDirectory()

    zip_file = self._file_system.GetZipFile()
    if self._directory and zip_file:
      for path_spec in self._directory.entries:
        location = getattr(path_spec, 'location', None)
        if location is None:
          continue

        kwargs = {}
        try:
          kwargs['zip_info'] = zip_file.getinfo(location[1:])
        except KeyError:
          kwargs['is_virtual'] = True

        yield ZipFileEntry(
            self._resolver_context, self._file_system, path_spec, **kwargs)
395938
def get_isomorphisms(reference, lig):
    """"""
    query = pybel.ob.CompileMoleculeQuery(reference.OBMol)
    mappr = pybel.ob.OBIsomorphismMapper.GetInstance(query)
    if all:
        isomorphs = pybel.ob.vvpairUIntUInt()
        mappr.MapAll(lig.OBMol, isomorphs)
    else:
        isomorphs = pybel.ob.vpairUIntUInt()
        mappr.MapFirst(lig.OBMol, isomorphs)
        isomorphs = [isomorphs]
    write_message("Number of isomorphisms: %i\n" % len(isomorphs), mtype='debug')
    # #@todo Check which isomorphism to take
    return isomorphs