Find an augmenting path from u to target with value at most val
500582
def _augment(graph, capacity, flow, val, u, target, visit):
    """"""
    visit[u] = True
    if u == target:
        return val
    for v in graph[u]:
        cuv = capacity[u][v]
        if not visit[v] and cuv > flow[u][v]:  # reachable arc
            res = min(val, cuv - flow[u][v])
            delta = _augment(graph, capacity, flow, res, v, target, visit)
            if delta > 0:
                flow[u][v] += delta            # augment flow
                flow[v][u] -= delta
                return delta
    return 0
242455
function shiftDeepValue(target, path) {
    var deepRef = getDeepRef(target, path);
    if (!isArray(deepRef))
        return;
    return deepRef.shift();
}
895949
def join_path(fname:PathOrStr, path:PathOrStr='.')->Path:
    ""
    return Path(path)/Path(fname)
865478
function getProp (obj, path, isArray) {
  var next;
  path = _.isString(path) ? path.split('.') : path;

  // We have more traversing to do
  if (path.length > 1) {
    next = path.shift();
    if (_.isArray(obj[next])) {
      isArray = true;
      var arr = _.compact(_.flatten(obj[next].map(function (el, i) {
        return getProp(el, _.clone(path), isArray);
      })));
      return arr.length ? arr : undefined;
    } else {
      if (!obj[next]) { return; }
      return getProp(obj[next], path, isArray);
    }

  // No more traversing. We can now target the final node with path[0]
  } else {
    next = path[0];
    // if we are at the end of the path and `obj` is an array
    if (_.isArray(obj)) {
      return _.pluck(obj, next);
    } else {
      if (!obj[next]) { return; }
      return isArray ? [obj[next]] : obj[next];
    }
  }
}
925310
def path_eval(self, obj, keypath):
        '''
        '''
        segs = keypath.split('.')
        this = obj
        for seg in segs:
            if isinstance(this, dict):
                try:
                    this = this[seg]
                except KeyError:
                    raise self.InvalidPath()
            elif isinstance(this, (list, tuple)):
                if seg.isdigit():
                    this = this[int(seg)]
            else:
                try:
                    this = getattr(this, seg)
                except AttributeError:
                    raise self.InvalidPath()
        return this
86365
private static void cs_augment(int k, DZcs A, int[] jmatch, int jmatch_offset, int[] cheap, int cheap_offset,
		    int[] w, int w_offset, int[] js, int js_offset, int[] is, int is_offset, int[] ps, int ps_offset)
	{
		int p, i = -1, Ap[] = A.p, Ai[] = A.i, head = 0, j ;
		boolean found = false ;
		js [js_offset + 0] = k ;				/* start with just node k in jstack */
		while (head >= 0)
		{
			/* --- Start (or continue) depth-first-search at node j ------------- */
			j = js [js_offset + head] ;			/* get j from top of jstack */
			if (w [w_offset + j] != k)			/* 1st time j visited for kth path */
			{
				w [w_offset + j] = k ;			/* mark j as visited for kth path */
				for (p = cheap [cheap_offset + j] ; p < Ap [j+1] && !found ; p++)
				{
					i = Ai [p] ;			/* try a cheap assignment (i,j) */
					found = (jmatch [jmatch_offset + i] == -1) ;
				}
				cheap [cheap_offset + j] = p ;		/* start here next time j is traversed*/
				if (found)
				{
					is [is_offset + head] = i ;  	/* column j matched with row i */
					break ;				/* end of augmenting path */
				}
				ps [ps_offset + head] = Ap [j] ;	/* no cheap match: start dfs for j */
			}
			/* --- Depth-first-search of neighbors of j ------------------------- */
			for (p = ps [ps_offset + head] ; p < Ap [j+1] ; p++)
			{
				i = Ai [p] ;				/* consider row i */
				if (w [w_offset + jmatch [jmatch_offset + i]] == k)
					continue ;			/* skip jmatch [i] if marked */
				ps [ps_offset + head] = p + 1 ;		/* pause dfs of node j */
				is [is_offset + head] = i ;		/* i will be matched with j if found */
				js [js_offset + (++head)] = jmatch [jmatch_offset + i] ;  /* start dfs at column jmatch [i] */
				break;
			}
			if (p == Ap [j+1]) head-- ;			/* node j is done; pop from stack */
		} 							/* augment the match if path found: */
		if (found) for (p = head ; p >= 0 ; p--) jmatch [jmatch_offset + is [is_offset + p]] = js [js_offset + p] ;
	}
227071
function expandPath (path, replacements) {
  return R.toPairs(replacements).reduce((path, [key, value]) => path.replace(`{${key}}`, value), path)
}
541911
def find_path_join_using_plus(node):
    """"""
    return (
        isinstance(node, ast.BinOp)
        and isinstance(node.op, ast.Add)
        and isinstance(node.left, ast.BinOp)
        and isinstance(node.left.op, ast.Add)
        and isinstance(node.left.right, ast.Str)
        and node.left.right.s in ['/', "\\"]
    )
743107
function(path, value, data , op, computed){
    var computed = this.computed,
      op = op || "=", prev, 
      computedProperty = computed? computed[path]:null;

    if(op !== '='){
      prev = computedProperty? computedProperty.get(this): data[path];
      switch(op){
        case "+=":
          value = prev + value;
          break;
        case "-=":
          value = prev - value;
          break;
        case "*=":
          value = prev * value;
          break;
        case "/=":
          value = prev / value;
          break;
        case "%=":
          value = prev % value;
          break;
      }
    }
    if(computedProperty) {
      if(computedProperty.set) return computedProperty.set(this, value);
    }
    data[path] = value;
    return value;
  }
558762
def localpath(*args):
    """"""
    plist = [ROOT] + list(args)
    return os.path.abspath(pjoin(*plist))
24706
def value_for_keypath(obj, path):
    
    val = obj
    for part in path.split('.'):
        match = re.match(list_index_re, part)
        if match is not None:
            val = _extract(val, match.group(1))
            if not isinstance(val, list) and not isinstance(val, tuple):
                raise TypeError('expected list/tuple')
            index = int(match.group(2))
            val = val[index]
        else:
            val = _extract(val, part)
        if val is None:
            return None
    return val
901319
def expand_magic_path(aPath,aBasePath=nil)
			aBasePath ||= Dir.pwd
			path = aPath
			if path.begins_with?('...')
				rel_part = path.split3(/\.\.\.[\/\\]/)[2]
				return find_upwards(aBasePath,rel_part)
			end
			path_combine(aBasePath,aPath)
		end
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]
}
952701
function _walk (name, value, mountedPath) {
        var tov = $type(value) // type of value
        // initial path prefix is root path
        var kp = mountedPath ? mountedPath : $join(_rootPath(), name)
        /**
         *  Array methods hook
         */
        if (tov == ARRAY) {
            $arrayHook(value, function (self, methodName, nativeMethod, args) {
                var pv = $util.copyArray(self)
                var result = nativeMethod.apply(self, args)
                // set value directly after walk
                _props[name] = _walk(name, self, kp)
                if (methodName == 'splice') {
                    _emitChange(kp, self, pv, methodName, args)
                } else {
                    _emitChange(kp, self, pv, methodName)
                }
                return result
            })
        }

        // deep observe into each property value
        switch(tov) {
            case OBJECT: 
                // walk deep into object items
                var props = {}
                var obj = value
                if (instanceOf(value, Mux)) obj = value.$props()
                $util.objEach(obj, function (k, v) {
                    props[k] = _walk(k, v, $join(kp, k))
                })
                return _subInstance(value, props, kp)
            case ARRAY:
                // walk deep into array items
                value.forEach(function (item, index) {
                    value[index] = _walk(index, item, $join(kp, index))
                })
                return value
            default: 
                return value
        }
    }
19707
def _find_observable_paths(extra_files=None):
    """"""
    rv = set(
        os.path.dirname(os.path.abspath(x)) if os.path.isfile(x) else os.path.abspath(x)
        for x in sys.path
    )

    for filename in extra_files or ():
        rv.add(os.path.dirname(os.path.abspath(filename)))

    for module in list(sys.modules.values()):
        fn = getattr(module, "__file__", None)
        if fn is None:
            continue
        fn = os.path.abspath(fn)
        rv.add(os.path.dirname(fn))

    return _find_common_roots(rv)
869473
def abspath(path, **kwargs):
    """"""
    import os.path
    return os.path.abspath(path, **kwargs)
610400
def _inner_search(obj, glob, separator, dirs=True, leaves=False):
    """"""
    for path in dpath.path.paths(obj, dirs, leaves, skip=True):
        if dpath.path.match(path, glob):
            yield path