A method to find a UDF File Identifier descriptor by its name.

        Parameters:
         currpath - The UTF-8 encoded name to look up.
        Returns:
         The UDF File Identifier descriptor corresponding to the passed in name.
168067
def find_file_ident_desc_by_name(self, currpath):
        # type: (bytes) -> UDFFileIdentifierDescriptor
        '''
        
        '''
        if not self._initialized:
            raise pycdlibexception.PyCdlibInternalError('UDF File Entry not initialized')

        # If this is a directory or it is an empty directory, just skip
        # all work.
        if self.icb_tag.file_type != 4 or not self.fi_descs:
            raise pycdlibexception.PyCdlibInvalidInput('Could not find path')

        tmp = currpath.decode('utf-8')
        try:
            latin1_currpath = tmp.encode('latin-1')
        except (UnicodeDecodeError, UnicodeEncodeError):
            latin1_currpath = b''
        ucs2_currpath = tmp.encode('utf-16_be')

        child = None

        for fi_desc in self.fi_descs:
            if latin1_currpath and fi_desc.encoding == 'latin-1':
                eq = fi_desc.fi == latin1_currpath
            else:
                eq = fi_desc.fi == ucs2_currpath

            if eq:
                child = fi_desc
                break

        if child is None:
            raise pycdlibexception.PyCdlibInvalidInput('Could not find path')

        return child
645717
def lookup(self, dotted_path, lineno=None):
        
        rv = None
        try:
            rv = rustcall(
                _lib.lsm_proguard_mapping_convert_dotted_path,
                self._get_ptr(),
                dotted_path.encode('utf-8'), lineno or 0)
            return _ffi.string(rv).decode('utf-8', 'replace')
        finally:
            if rv is not None:
                _lib.lsm_buffer_free(rv)
446769
def identifierify(name):
    
    name = name.lower()
    name = re.sub('[^a-z0-9]', '_', name)
    return name
940609
function getPackageName(content, pluginLookup, identifierPath) {
  let memberPath = identifierPath.parentPath;
  while (memberPath.isMemberExpression()) {
    const code = content.slice(identifierPath.node.end, memberPath.node.end);
    const pluginName = pluginLookup[code];
    if (pluginName) {
      return pluginName;
    }

    memberPath = memberPath.parentPath;
  }

  return '';
}
882542
def displayable_path(path, separator=u'; '):
    
    if isinstance(path, (list, tuple)):
        return separator.join(displayable_path(p) for p in path)
    elif isinstance(path, six.text_type):
        return path
    elif not isinstance(path, bytes):
        # A non-string object: just get its unicode representation.
        return six.text_type(path)

    try:
        return path.decode(_fsencoding(), 'ignore')
    except (UnicodeError, LookupError):
        return path.decode('utf8', 'ignore')
1324084
def DirnamePath(self, path):
    
    if path.endswith(self.PATH_SEPARATOR):
      path = path[:-1]
    if not path:
      return None

    dirname, _, _ = path.rpartition(self.PATH_SEPARATOR)
    return dirname
393449
def prefixed_name(self) -> Tuple[YangIdentifier, Optional[YangIdentifier]]:
        """"""
        i1 = self.yang_identifier()
        try:
            next = self.peek()
        except EndOfInput:
            return (i1, None)
        if next != ":":
            return (i1, None)
        self.offset += 1
        return (self.yang_identifier(), i1)
1223899
def path_to_tuple(path, windows=False):
    
    if windows:
        path_tup = tuple(path.split('\\'))
    else:
        path_tup = tuple(path.split('/'))
    #
    # Normalize UTF-8 encoding to consistent form so cache lookups will work, see
    # https://docs.python.org/3.6/library/unicodedata.html#unicodedata.normalize
    path_tup = tuple(normalize('NFD', part) for part in path_tup)
    return path_tup
894653
def getfullfilename(file_path):
        ''' 
        '''
        warnings.warn("getfullfilename() is deprecated and will be removed in near future. Use chirptext.io.write_file() instead", DeprecationWarning)
        if file_path:
            return os.path.basename(file_path)
        else:
            return ''
554173
def IdentifiersIndexer(instance):
    
    identifiers = instance.Schema()['Identifiers'].get(instance)
    return [safe_unicode(i['Identifier']) for i in identifiers]
664869
public static final char getFileTypeLetter(Path path)
    {
        if (Files.isRegularFile(path))
        {
            return '-';
        }
        if (Files.isDirectory(path))
        {
            return 'd';
        }
        if (Files.isSymbolicLink(path))
        {
            return 'l';
        }
        throw new IllegalArgumentException(path+" is either regular file, directory or symbolic link");
    }
564286
private void getDescriptor(final StringBuffer buf) {
        switch (sort) {
            case VOID:
                buf.append('V');
                return;
            case BOOLEAN:
                buf.append('Z');
                return;
            case CHAR:
                buf.append('C');
                return;
            case BYTE:
                buf.append('B');
                return;
            case SHORT:
                buf.append('S');
                return;
            case INT:
                buf.append('I');
                return;
            case FLOAT:
                buf.append('F');
                return;
            case LONG:
                buf.append('J');
                return;
            case DOUBLE:
                buf.append('D');
                return;
            case ARRAY:
                buf.append(this.buf, off, len);
                return;
                // case OBJECT:
            default:
                buf.append('L');
                buf.append(this.buf, off, len);
                buf.append(';');
        }
    }
473231
def _get_course_descriptor_path(self, courseid):
        
        if not id_checker(courseid):
            raise InvalidNameException("Course with invalid name: " + courseid)
        course_fs = self.get_course_fs(courseid)
        if course_fs.exists("course.yaml"):
            return courseid+"/course.yaml"
        if course_fs.exists("course.json"):
            return courseid+"/course.json"
        raise CourseNotFoundException()
594199
def descriptors(package):
    
    from os import path
    dpath = _descriptor_path(package)
    if path.isfile(dpath):
        import json
        with open(dpath) as f:
            jdb = json.load(f)
        return jdb
    else:
        return None
295558
def get_file_descriptor(self):
        
        return self._subscription.connection and self._subscription.connection._sock.fileno()
327271
def interleaved_filename(file_path):
    """"""
    if not isinstance(file_path, tuple):
        raise OneCodexException("Cannot get the interleaved filename without a tuple.")
    if re.match(".*[._][Rr][12][_.].*", file_path[0]):
        return re.sub("[._][Rr][12]", "", file_path[0])
    else:
        warnings.warn("Paired-end filenames do not match--are you sure they are correct?")
        return file_path[0]
1001747
def get_unique_name(self, cursor):
        """"""
        name = ''
        if cursor.kind in [CursorKind.UNEXPOSED_DECL]:
            return ''
        # covers most cases
        name = cursor.spelling
        # if its a record decl or field decl and its type is unnamed
        if cursor.spelling == '':
            # a unnamed object at the root TU
            if (cursor.semantic_parent
                and cursor.semantic_parent.kind == CursorKind.TRANSLATION_UNIT):
                name = self.make_python_name(cursor.get_usr())
                log.debug('get_unique_name: root unnamed type kind %s',cursor.kind)
            elif cursor.kind in [CursorKind.STRUCT_DECL,CursorKind.UNION_DECL,
                                 CursorKind.CLASS_DECL,CursorKind.FIELD_DECL]:
                name = self._make_unknown_name(cursor)
                log.debug('Unnamed cursor type, got name %s',name)
            else:
                log.debug('Unnamed cursor, No idea what to do')
                #import code
                #code.interact(local=locals())
                return ''
        if cursor.kind in [CursorKind.STRUCT_DECL,CursorKind.UNION_DECL,
                                 CursorKind.CLASS_DECL]:
            names= {CursorKind.STRUCT_DECL: 'struct',
                    CursorKind.UNION_DECL: 'union',
                    CursorKind.CLASS_DECL: 'class',
                    CursorKind.TYPE_REF: ''}
            name = '%s_%s'%(names[cursor.kind],name)
        log.debug('get_unique_name: name "%s"',name)
        return name