Merges a new PEX_PATH definition into the existing one (if any).
    :param string pex_path: The PEX_PATH to merge.
322764
def merge_pex_path(self, pex_path):
    
    if not pex_path:
      return
    self.pex_path = ':'.join(merge_split(self.pex_path, pex_path))
1307775
def cwd(self, new_path):
        ''''''
        old_cwd = self._cwd
        self._cwd = new_path
        return old_cwd
585302
def split_path(path):
        
        components = list()
        while path:
            next = win32.PathFindNextComponent(path)
            if next:
                prev = path[ : -len(next) ]
                components.append(prev)
            path = next
        return components
324822
def register_path(self, path):
        
        self._paths.insert(0, os.path.abspath(path))
935112
def simplify_path(path):
    
    skip = {'..', '.', ''}
    stack = []
    paths = path.split('/')
    for tok in paths:
        if tok == '..':
            if stack:
                stack.pop()
        elif tok not in skip:
            stack.append(tok)
    return '/' + '/'.join(stack)
1112048
def merge_data(path_data, request_data):
    
    merged = request_data.copy() if request_data else {}
    merged.update(path_data or {})
    return merged
766601
def pfx_path(path):
    
    if path[0] != os.path.sep: return os.path.sep + path
    else:                      return path
348187
def add(self, path):
        
        if not path.startswith(os.sep):
            raise ValueError("Non-absolute path '{}'".format(path))
        path = path.rstrip(os.sep)
        while True:
            self._paths[path] = None
            path, _ = os.path.split(path)
            if path == os.sep:
                break
1307054
def pkgPath(root, path, rpath="/"):
    
    global data_files
    if not os.path.exists(path):
        return
    files = []
    for spath in os.listdir(path):
        # Ignore test directories
        if spath == 'test':
            continue
        subpath = os.path.join(path, spath)
        spath = os.path.join(rpath, spath)
        if os.path.isfile(subpath):
            files.append(subpath)
        if os.path.isdir(subpath):
            pkgPath(root, subpath, spath)
    data_files.append((root + rpath, files))
1130822
def JoinKeyPath(path_segments):
  
  # This is an optimized way to combine the path segments into a single path
  # and combine multiple successive path separators to one.

  # Split all the path segments based on the path (segment) separator.
  path_segments = [
      segment.split(definitions.KEY_PATH_SEPARATOR)
      for segment in path_segments]

  # Flatten the sublists into one list.
  path_segments = [
      element for sublist in path_segments for element in sublist]

  # Remove empty path segments.
  path_segments = filter(None, path_segments)

  key_path = definitions.KEY_PATH_SEPARATOR.join(path_segments)
  if not key_path.startswith('HKEY_'):
    key_path = '{0:s}{1:s}'.format(definitions.KEY_PATH_SEPARATOR, key_path)
  return key_path
414043
def rename(self, new_path):
        
        rename_path = fix_raw_path(new_path)
        if is_folder(self.path):
            os.rename(self.path, rename_path)
        else:
            os.renames(self.path, rename_path)
803688
def appendPath(self, path):
        
        # normalize the path
        path = os.path.normcase(nstr(path)).strip()
        if path and path != '.' and path not in sys.path:
            sys.path.append(path)
            self._addedpaths.append(path)
            return True
        return False
1354536
def add_path(self, path):
        """"""
        if not os.path.exists(path):
            raise RuntimeError('Path does not exists: %s.' % path)
        self.paths.append(path)
951651
def _create_path_if_not_exist(self, path):
        
        if path and not os.path.exists(path):
            os.makedirs(path)
178460
def JoinPath(self, path_segments):
    
    # This is an optimized way to combine the path segments into a single path
    # and combine multiple successive path separators to one.

    # Split all the path segments based on the path (segment) separator.
    path_segments = [
        segment.split(self.PATH_SEPARATOR) for segment in path_segments]

    # Flatten the sublists into one list.
    path_segments = [
        element for sublist in path_segments for element in sublist]

    # Remove empty path segments.
    path_segments = list(filter(None, path_segments))

    return '{0:s}{1:s}'.format(
        self.PATH_SEPARATOR, self.PATH_SEPARATOR.join(path_segments))
141942
def _JoinKeyPath(self, path_segments):
    
    # This is an optimized way to combine the path segments into a single path
    # and combine multiple successive path separators to one.

    # Split all the path segments based on the path (segment) separator.
    path_segments = [
        segment.split(definitions.KEY_PATH_SEPARATOR)
        for segment in path_segments]

    # Flatten the sublists into one list.
    path_segments = [
        element for sublist in path_segments for element in sublist]

    # Remove empty path segments.
    path_segments = filter(None, path_segments)

    return definitions.KEY_PATH_SEPARATOR.join(path_segments)
475715
def add(self, path, data=None, replace=False):
        
        node = self.current[-1]
        for item in self._splitpath(path):
            tag, attribs = self._splittag(item)
            next_node = node.get_child(tag, attribs)
            if next_node is not None:
                node = next_node
            else:
                node = node.add(Node(tag, attribs))
        if replace:
            node.text = ''
        if data:
            if node.text is None:
                node.text = unquote(data)
            else:
                node.text += unquote(data)
        return node