Parses a shell item path segment.

    Args:
      shell_item (pyfwsi.item): shell item.

    Returns:
      str: shell item path segment.
430361
def _ParseShellItemPathSegment(self, shell_item):
    
    path_segment = None

    if isinstance(shell_item, pyfwsi.root_folder):
      description = shell_folder_ids.DESCRIPTIONS.get(
          shell_item.shell_folder_identifier, None)

      if description:
        path_segment = description
      else:
        path_segment = '{{{0:s}}}'.format(shell_item.shell_folder_identifier)

      path_segment = '<{0:s}>'.format(path_segment)

    elif isinstance(shell_item, pyfwsi.volume):
      if shell_item.name:
        path_segment = shell_item.name
      elif shell_item.identifier:
        path_segment = '{{{0:s}}}'.format(shell_item.identifier)

    elif isinstance(shell_item, pyfwsi.file_entry):
      long_name = ''
      for extension_block in shell_item.extension_blocks:
        if isinstance(extension_block, pyfwsi.file_entry_extension):
          long_name = extension_block.long_name

      if long_name:
        path_segment = long_name
      elif shell_item.name:
        path_segment = shell_item.name

    elif isinstance(shell_item, pyfwsi.network_location):
      if shell_item.location:
        path_segment = shell_item.location

    if path_segment is None and shell_item.class_type == 0x00:
      # TODO: check for signature 0x23febbee
      pass

    if path_segment is None:
      path_segment = '<UNKNOWN: 0x{0:02x}>'.format(shell_item.class_type)

    return path_segment
1269128
def get(self, item_name):
		
		if self.prefix:
			item_name = self.prefix + self.seperator + item_name
		item_names = item_name.split(self.seperator)
		node = self._storage
		for item_name in item_names:
			node = node[item_name]
		return node
1135588
def itemPath( self, item ):
        
        path = []
        while ( item ):
            path.insert(0, nativestring(item.text()))
            item = item.parent()
        
        sep = self.separator()
        return sep + sep.join(path)
1357554
def _get_path_entry_from_list(self, query_path):
        
        cur_data = self.config_file_contents
        try:
            for child in query_path:
                cur_data = cur_data[child]
            return cur_data
        except (AttributeError, KeyError):
            raise errors.ResourceNotFoundError('Could not find query path %s in the config file contents' %
                                               query_path)
1167688
def path_list(self, sep=os.pathsep):
        '''  '''
        from pathlib import Path
        return [ Path(pathstr) for pathstr in self.split(sep) ]
404752
def to_path_value(self, obj):
        
        if type(obj) == list:
            return ','.join(obj)
        else:
            return str(obj)
122353
def get_item_sh(self, item):
        

        sh_fields = {}

        # Not shared common get_item_sh because it is pretty specific
        if 'member' in item:
            # comment and rsvp
            identity = self.get_sh_identity(item['member'])
        elif 'event_hosts' in item:
            # meetup event
            identity = self.get_sh_identity(item['event_hosts'][0])
        else:
            return sh_fields

        created = unixtime_to_datetime(item['created'] / 1000)
        sh_fields = self.get_item_sh_fields(identity, created)

        return sh_fields
946084
def pathFromItem(self, item, avatar):
        
        for subnav in self.children:
            subpath = subnav.pathFromItem(item, avatar)
            if subpath:
                subpath.insert(0, self)
                return subpath
        else:
            myItem = self.loadForAvatar(avatar)
            if myItem is item:
                return [self]
        return []
222251
def split_by_fname_file(self, fname:PathOrStr, path:PathOrStr=None)->'ItemLists':
        ""
        path = Path(ifnone(path, self.path))
        valid_names = loadtxt_str(path/fname)
        return self.split_by_files(valid_names)
1088004
def read_list(path_in):
    
    with open(path_in) as fin:
        while True:
            line = fin.readline()
            if not line:
                break
            line = [i.strip() for i in line.strip().split('\t')]
            line_len = len(line)
            # check the data format of .lst file
            if line_len < 3:
                print('lst should have at least has three parts, but only has %s parts for %s' % (line_len, line))
                continue
            try:
                item = [int(line[0])] + [line[-1]] + [float(i) for i in line[1:-1]]
            except Exception as e:
                print('Parsing lst met error for %s, detail: %s' % (line, e))
                continue
            yield item
950045
def folderitem(self, obj, item, index):
        
        url = item.get("url")
        title = item.get("DocumentID")

        item["replace"]["DocumentID"] = get_link(url, title)

        item["FileDownload"] = ""
        item["replace"]["FileDownload"] = ""
        file = self.get_file(obj)
        if file and file.get_size() > 0:
            filename = file.filename
            download_url = "{}/at_download/File".format(url)
            anchor = get_link(download_url, filename)
            item["FileDownload"] = filename
            item["replace"]["FileDownload"] = anchor

        item["DocumentVersion"] = obj.getDocumentVersion()
        item["DocumentLocation"] = obj.getDocumentLocation()
        item["DocumentType"] = obj.getDocumentType()

        return item
618530
def path_components(path):
    
    components = []
    # The loop guarantees that the returned components can be
    # os.path.joined with the path separator and point to the same
    # location:    
    while True:
        (new_path, tail) = os.path.split(path)  # Works on any platform
        components.append(tail)        
        if new_path == path:  # Root (including drive, on Windows) reached
            break
        path = new_path
    components.append(new_path)    
    components.reverse()  # First component first 
    return components
1014110
def parse_item(self, location: str, item_type: Type[T], item_name_for_log: str = None,
                   file_mapping_conf: FileMappingConfiguration = None, options: Dict[str, Dict[str, Any]] = None) -> T:
        

        # -- item_name_for_log
        item_name_for_log = item_name_for_log or ''
        check_var(item_name_for_log, var_types=str, var_name='item_name_for_log')

        if len(item_name_for_log) > 0:
            item_name_for_log = item_name_for_log + ' '
        self.logger.debug('**** Starting to parse single object ' + item_name_for_log + 'of type <'
                          + get_pretty_type_str(item_type) + '> at location ' + location + ' ****')

        # common steps
        return self._parse__item(item_type, location, file_mapping_conf, options=options)
216486
def items(self, path=None, version=None):
        
        if version is None:
            version = -1
        items = {}
        for item in self.versions(version).items():
            items[item.path] = item
        parent = self.parent

        # get latest committed items from parents
        while parent:
            for item in parent.items(path=path):
                if item.path not in items.keys():
                    items[item.path] = item
            parent = parent.parent

        # filter items matching path regex
        if path is not None:
            path += '$'
            regex = re.compile(path)
            return [item for path, item in items.items() if regex.match(path)]
        else:
            return items.values()
122807
def item(p_queue, queue_id, host=None):
    if host is not None:
        return os.path.join(_path(host, _c.FSQ_QUEUE, root=hosts(p_queue)),
                            valid_name(queue_id))
    ''''''
    return os.path.join(_path(p_queue, _c.FSQ_QUEUE), valid_name(queue_id))
201093
def parse(self, data):
        
        self.binding_var_count = 0
        self.segment_count = 0

        segments = self.parser.parse(data)
        # Validation step: checks that there are no nested bindings.
        path_wildcard = False
        for segment in segments:
            if segment.kind == _TERMINAL and segment.literal == '**':
                if path_wildcard:
                    raise ValidationException(
                        'validation error: path template cannot contain more '
                        'than one path wildcard')
                path_wildcard = True
        return segments
547573
def get_multifile_object_child_location(self, parent_item_prefix: str, child_name: str) -> str:
        
        check_var(parent_item_prefix, var_types=str, var_name='parent_item_prefix')
        check_var(child_name, var_types=str, var_name='item_name')

        # assert that folder_path is a folder
        if not isdir(parent_item_prefix):
            raise ValueError(
                'Cannot get attribute item in non-flat mode, parent item path is not a folder : ' + parent_item_prefix)
        return join(parent_item_prefix, child_name)