Return a member generator by a dot-delimited path
432643
def _resolve_child(self, path):
        ''
        obj = self

        for component in path.split('.'):
            ptr = obj
            if not isinstance(ptr, Permuter):
                raise self.MessageNotFound("Bad element path [wrong type]")

            # pylint: disable=protected-access
            found_gen = (_ for _ in ptr._generators if _.name() == component)

            obj = next(found_gen, None)

            if not obj:
                raise self.MessageNotFound("Path '{}' unresolved to member."
                                           .format(path))
        return ptr, obj
251381
def _GetExpandedPaths(args):
  """"""
  opts = globbing.PathOpts(
      follow_links=args.follow_links, pathtype=args.pathtype)

  for path in args.paths:
    for expanded_path in globbing.ExpandPath(str(path), opts):
      yield expanded_path
388229
def getpath(d, json_path, default=None, sep='.'):
    '''
    '''
    for key in json_path.split(sep):
        try:
            d = d[key]
        except (KeyError, TypeError):
            return default
    return d
1199289
function generateHoistNameBasedOn(path, suffix = "") {
  const names = [];
  if (suffix) {
    names.push(suffix);
  }

  let current = path;
  while (!(current.isIdentifier() || current.isJSXIdentifier())) {
    names.push(current.node.property.name);
    current = current.get("object");
  }
  names.push(current.node.name);

  return path.scope.generateUidIdentifier(names.reverse().join("$"));
}
497408
private String joinPaths(String dirName, String folderName, boolean generatedResource) {

		return PathNormalizer.joinPaths(dirName, folderName, generatedResource);
	}
61453
function get_member_path(MemberName) {
	var name = npm_sanitize(MemberName.toLowerCase());
	var path = npm_path.join(Membership.RootFolder, name);
	return path;
}
598272
function dig (obj, ...path) {
  const key = path.shift()
  if (key == null || obj == null) {
    return
  }
  const val = obj[key]
  if (typeof val === 'object') {
    return dig(val, ...path)
  }
  return val
}
640294
function getPropertyValue(obj, path) {

   if (path.length === 0 || obj === undefined) {
      return undefined;
   }
   var notation = dotNotation(path);
   if (!notation) {
      return;
   }
   path = notation.path;
   for (var i = 0; i < path.length; i++) {
      obj = obj[path[i]];
      if (obj === undefined) {
         return undefined;
      }
   }
   return obj;
}
605793
function getPathParts(path) {
  // split the path specified into an array on `.`
  const pathParts = String(path).split('.');

  // create an empty array which will be the result
  const parts = [];

  // create an index variable so we can skip indexes if
  // need be when parsing the paths
  let index = 0;

  // while the index is smaller then the parts array length
  while (index < pathParts.length) {
    // get the part from the parts array
    let parsedPart = pathParts[index];

    // while (if) the part starts with `\` remove it and
    // append `.` and then next part from the array to it
    // this should result in `test\\.test` being parsed
    // into `test.test`. This is done so users can escape
    // dots from the dot notation
    while (parsedPart[parsedPart.length - 1] === '\\'
          && pathParts[index + 1] !== undefined
          && pathParts[index + 1] !== null) {
      // remove `\` and append the `.`
      parsedPart = `${parsedPart.slice(0, -1)}.`;
      // increase the index so next iteration it will skip
      // the next path which is about to be added to this path
      index += 1;
      // add the next path to the current one because they are
      // apart of the same object key
      parsedPart += pathParts[index];
    }

    // increase the index so we can continue to the next path
    // in the array
    index += 1;

    // append the parsed path to the results array
    parts.push(parsedPart);
  }

  // return all the parsed paths
  return parts;
}
1071828
function getPathFromMemberExpression(expr, acc = []) {
  if (expr.type === "Identifier") {
    return acc.concat(expr.name);
  } else if (expr.type === "MemberExpression") {
    return acc.concat(getPathFromMemberExpression(expr.object, acc)).concat(expr.property.name);
  } else {
    throw new Error(`Expected MemberExpression or Identifier but get ${expr.type}.`);
  }
}
40926
function (data, path) {
    path = path || '';
    if (_.isObject(data)) {
      for (var key in data) {
        if (_.isObject(data)) {
          data[key] = _recurseFeedDefaultNamespace(data[key], path !== '' ? path + '.' + key : key);
        }
      }
      return data;
    }
    else {
      if (data == null || data === '') {
        // return default data if empty/null
        return path;
      }
      else {
        return data;
      }
    }
  }
910199
def find(self, path, match, flags):
        
        try:
            match = re.compile(match, flags)
        except sre_constants.error as ex:
            print("Bad regexp: %s" % (ex))
            return

        offset = len(path)
        for cpath in Tree(self, path).get():
            if match.search(cpath[offset:]):
                yield cpath
383173
def _extract_member(self, member, targetpath, pwd):
        
        # build the destination pathname, replacing
        # forward slashes to platform specific separators.
        # Strip trailing path separator, unless it represents the root.
        if (targetpath[-1:] in (os.path.sep, os.path.altsep)
            and len(os.path.splitdrive(targetpath)[1]) > 1):
            targetpath = targetpath[:-1]

        # don't include leading "/" from file name if present
        if member.filename[0] == '/':
            targetpath = os.path.join(targetpath, member.filename[1:])
        else:
            targetpath = os.path.join(targetpath, member.filename)

        targetpath = os.path.normpath(targetpath)

        # Create all upper directories if necessary.
        upperdirs = os.path.dirname(targetpath)
        if upperdirs and not os.path.exists(upperdirs):
            os.makedirs(upperdirs)

        if member.filename[-1] == '/':
            if not os.path.isdir(targetpath):
                os.mkdir(targetpath)
            return targetpath

        source = self.open(member, pwd=pwd)
        target = file(targetpath, "wb")
        shutil.copyfileobj(source, target)
        source.close()
        target.close()

        return targetpath
532403
def convert_to_path(name):
    """"""
    if name.startswith('.'):
        remainder = name.lstrip('.')
        dot_count = (len(name) - len(remainder))
        prefix = '../'*(dot_count-1)
    else:
        remainder = name
        dot_count = 0
        prefix = ''
    filename = prefix + os.path.join(*remainder.split('.'))
    return (filename, dot_count)
382549
def file_name_generator_recursive(path):
  
  for name in os.listdir(path):
    full_name = os.path.join(path, name)
    if os.path.isdir(full_name):
      for new_name in file_name_generator_recursive(full_name):
        yield new_name
    else:
      yield full_name
382374
function dotMap(path) {
  if (typeof path !== 'string' || path.length === 0) {
    return I
  }
  var segments = path.split('.')
  var len = segments.length

  switch (len) {
    case 0: return I
    case 1: return function (x) {
        return x[segments[0]]
      }
    case 2: return function (x) {
        return x[segments[0]][segments[1]]
      }
    case 3: return function (x) {
        return x[segments[0]][segments[1]][segments[2]]
      }
    case 4: return function (x) {
      return x[segments[0]][segments[1]][segments[2]][segments[3]]
    }
  }
  return function (x) {
    var i
    while(i = segments.shift(), x = x[i], segments.length);
    return x;
  }
}
35401
def iter_prefixes(path):
    
    split_path = path.split('.')
    for i in range(1, len(split_path) + 1):
        yield join_paths(*split_path[:i])