Marge AS_PATH and AS4_PATH attribute instances into
        a single AS_PATH instance.
517293
def _construct_as_path_attr(self, as_path_attr, as4_path_attr):
        """"""

        def _listify(li):
            """Reconstruct AS_PATH list.

            Example::

                >>> _listify([[1, 2, 3], {4, 5}, [6, 7]])
                [1, 2, 3, {4, 5}, 6, 7]
            """
            lo = []
            for l in li:
                if isinstance(l, list):
                    lo.extend(l)
                elif isinstance(l, set):
                    lo.append(l)
                else:
                    pass
            return lo

        # If AS4_PATH attribute is None, returns the given AS_PATH attribute
        if as4_path_attr is None:
            return as_path_attr

        # If AS_PATH is shorter than AS4_PATH, AS4_PATH should be ignored.
        if as_path_attr.get_as_path_len() < as4_path_attr.get_as_path_len():
            return as_path_attr

        org_as_path_list = _listify(as_path_attr.path_seg_list)
        as4_path_list = _listify(as4_path_attr.path_seg_list)

        # Reverse to compare backward.
        org_as_path_list.reverse()
        as4_path_list.reverse()

        new_as_path_list = []
        tmp_list = []
        for as_path, as4_path in zip_longest(org_as_path_list, as4_path_list):
            if as4_path is None:
                if isinstance(as_path, int):
                    tmp_list.insert(0, as_path)
                elif isinstance(as_path, set):
                    if tmp_list:
                        new_as_path_list.insert(0, tmp_list)
                        tmp_list = []
                    new_as_path_list.insert(0, as_path)
                else:
                    pass
            elif isinstance(as4_path, int):
                tmp_list.insert(0, as4_path)
            elif isinstance(as4_path, set):
                if tmp_list:
                    new_as_path_list.insert(0, tmp_list)
                    tmp_list = []
                new_as_path_list.insert(0, as4_path)
            else:
                pass
        if tmp_list:
            new_as_path_list.insert(0, tmp_list)

        return bgp.BGPPathAttributeAsPath(new_as_path_list)
214502
def path_join(*args):
    """"""
    return SEP.join((x for x in args if x not in (None, ''))).strip(SEP)
489814
public static Optional<Path> createFile(Path path,
            FileAttribute<?>... attrs) {
        debug(log, "createFile", path, attrs);
        try {
            return Optional.of(Files.createFile(path, attrs));
        } catch (Exception e) {
            return JMExceptionManager.handleExceptionAndReturnEmptyOptional(log,
                    e, "createFile", path);
        }
    }
788506
function _gpfPathJoin (path) {
    var splitPath = _gpfPathDecompose(path);
    _gpfArrayTail(arguments).forEach(_gpfPathAppend.bind(null, splitPath));
    return splitPath.join("/");
}
1087212
def _resolve_path(obj, path=None):
        
        if path:
            for attr_name in path.split('__'):
                obj = getattr(obj, attr_name)
        return obj
548932
static String canonicalizePath(String path) {
    String[] parts = path.split(MODULE_SLASH);
    String[] buffer = new String[parts.length];
    int position = 0;
    int available = 0;

    boolean absolutePath = (parts.length > 1 && parts[0].isEmpty());
    if (absolutePath) {
      // If the path starts with "/" (so the left side, index zero, is empty), then the path will
      // always remain absolute. Make the first segment unavailable to touch.
      --available;
    }

    for (String part : parts) {
      if (part.equals(".")) {
        continue;
      }

      if (part.equals("..")) {
        if (available > 0) {
          // Consume the previous segment.
          --position;
          --available;
          buffer[position] = null;
        } else if (!absolutePath) {
          // If this is a relative path, retain "..", as it can't be consumed on the left.
          buffer[position] = part;
          ++position;
        }
        continue;
      }

      buffer[position] = part;
      ++position;
      ++available;
    }

    if (absolutePath && position == 1) {
      return MODULE_SLASH;  // special-case single absolute segment as joining [""] doesn't work
    }
    return MODULE_JOINER.join(Arrays.copyOf(buffer, position));
  }
836351
function createPath(root, item) {
        var paths = item.parent.split('/'),
            dir, prevEl, el;

        if (paths && paths.length) {
            paths.forEach(function (path, index) {
                dir = paths.slice(0, index + 1).join('/');
                el = root.find(dir);

                if (!el) {
                    el = et.SubElement(prevEl ? prevEl : root, path, {});
                }

                prevEl = el;
            });
        }

        return root.find(item.parent || root.find('*/' + item.parent));
    }
234098
def paths=(raw_paths)
    raw_paths = [raw_paths] unless raw_paths.respond_to? :each

    @paths = raw_paths.map { |path| Pathname.new(path) }
  end
1312675
def convert_path_to_module_parts(path):
    """"""
    module_parts = splitall(path)
    if module_parts[-1] in ['__init__.py', '__init__.pyc']:
        # remove trailing __init__.py
        module_parts = module_parts[:-1]
    else:
        # remove file extension
        module_parts[-1], _ = os.path.splitext(module_parts[-1])
    return module_parts
931101
def _pycall_path_simple(
    x1: int, y1: int, x2: int, y2: int, handle: Any
) -> float:
    """"""
    return ffi.from_handle(handle)(x1, y1, x2, y2)
1032949
def path_to(self, p):
        """"""
        if os.path.isabs(p):
            return p

        return os.sep.join([self._original_dir, p])
1190358
def joinpath(self, *args):
        
        return self.__class__(os.path.join(self, *args))
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)
1103103
function nestedPath (obj, path, val) {
  if (typeof obj !== 'object') {
    return obj
  }
  var keys = path.split('.')
  if (keys.length > 1) {
    path = keys.shift()
    return nestedPath(obj[path], keys.join('.'), val)
  }
  if (val !== undefined) {
    obj[path] = val
  }
  return obj[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))
1286479
def _getattr_path(obj, path):
    
    if not path:
        return None

    for attr in path.split('.'):
        obj = getattr(obj, attr, None)
    return obj
544426
def globs_in_single_dir(cls, spec_dir_path, address_mapper):
    """"""
    return [os.path.join(spec_dir_path, pat) for pat in address_mapper.build_patterns]