Get object from the user namespace, given a path containing
    zero or more dots.  Return None if the path is not valid.
966274
def _get_user_ns_object(shell, path):
    
    parts = path.split('.', 1)
    name, attr = parts[0], parts[1:]
    if name in shell.user_ns:
        if attr:
            try:
                return _getattr(shell.user_ns[name], attr[0])
            except AttributeError:
                return None
        else:
            return shell.user_ns[name]
    return None
1368316
function getNodeVaue(path, obj) {
    // Gets a value from a JSON object
    // vcard[0].url[0]
    var output = null;
    try {
        var arrayDots = path.split(".");
        for (var i = 0; i < arrayDots.length; i++) {
            if (arrayDots[i].indexOf('[') > -1) {
                // Reconstructs and adds access to array of objects
                var arrayAB = arrayDots[i].split("[");
                var arrayName = arrayAB[0];
                var arrayPosition = Number(arrayAB[1].substring(0, arrayAB[1].length - 1));

                if (obj[arrayName] != null || obj[arrayName] != 'undefined') {
                    if (obj[arrayName][arrayPosition] != null || obj[arrayName][arrayPosition] != 'undefined')
                        obj = obj[arrayName][arrayPosition];

                }
                else {
                    currentObject = null;
                }

            }
            else {
                // Adds access to a property using property array ["given-name"]
                if (obj[arrayDots[i]] != null || obj[arrayDots[i]] != 'undefined')
                  obj = obj[arrayDots[i]];
            }
        }
        output = obj;
    } catch (err) {
        // Add error capture
        output = null;
    }
    return output;
}
557309
def object_ns(self):
        
        return Namespace(
            subject=self.object_,
            object_=None,
            prefix=self.prefix,
            qualifier=self.qualifier,
            version=self.version,
        )
239801
def get_object_by_path(path, default=_marker):
    

    # nothing to do here
    if not path:
        if default is not _marker:
            return default
        fail("get_object_by_path first argument must be a path; {} received"
             .format(path))

    pc = get_portal_catalog()
    portal = get_portal()
    portal_path = get_path(portal)
    portal_url = get_url(portal)

    # ensure we have a physical path
    if path.startswith(portal_url):
        request = get_request()
        path = "/".join(request.physicalPathFromURL(path))

    if not path.startswith(portal_path):
        if default is not _marker:
            return default
        fail("Not a physical path inside the portal.")

    if path == portal_path:
        return portal

    res = pc(path=dict(query=path, depth=0))
    if not res:
        if default is not _marker:
            return default
        fail("Object at path '{}' not found".format(path))
    return get_object(res[0])
1339937
function objectGet(obj, path, throwError) {
  var paths = isArray(path) ? path : path.split('.');
  var current = obj;

  try {
    var _iteratorNormalCompletion2 = true;
    var _didIteratorError2 = false;
    var _iteratorError2 = undefined;

    try {
      for (var _iterator2 = paths[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
        var key = _step2.value;
        current = current[key];
      }
    } catch (err) {
      _didIteratorError2 = true;
      _iteratorError2 = err;
    } finally {
      try {
        if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
          _iterator2.return();
        }
      } finally {
        if (_didIteratorError2) {
          throw _iteratorError2;
        }
      }
    }
  } catch (e) {
    if (throwError) {
      throw "Path does not exist";
    }
  }

  return current;
}
561146
def _GetUsernameFromProfilePath(self, path):
    
    # Strip trailing key separators.
    while path and path[-1] == '\\':
      path = path[:-1]

    if path:
      _, _, path = path.rpartition('\\')
    return path
1295878
def import_from_path(path):
    
    if path is None:
        return

    obj = locate(path)
    if obj is None:
        raise ImportError(
            "`{}` could not be imported".format(path)
        )

    return obj
146735
def from_path(cls, path: pathlib.Path) -> 'Directory':
        
        if not path.is_dir():
            raise ValueError('Path does not point to a directory')
        return Directory(path.name, {entity.name: Entity.from_path(entity)
                                     for entity in path.iterdir()})
884161
def get(self, path): # pylint: disable=W0221
    """"""
    path = path or ''
    path = path.lstrip('/')
    parts = path.split('/')
    if not parts[0]:
      parts = parts[1:]
    statDict = util.lookup(scales.getStats(), parts)

    if statDict is None:
      self.set_status(404)
      self.finish('Path not found.')
      return

    outputFormat = self.get_argument('format', default='html')
    query = self.get_argument('query', default=None)
    if outputFormat == 'json':
      formats.jsonFormat(self, statDict, query)
    elif outputFormat == 'prettyjson':
      formats.jsonFormat(self, statDict, query, pretty=True)
    else:
      formats.htmlHeader(self, '/' + path, self.serverName, query)
      formats.htmlFormat(self, tuple(parts), statDict, query)

    return None
419632
def get_object2(self, mpath, path=None, accept="*/*"):
        
        log.debug('GetObject %r', mpath)
        headers = {"Accept": accept}

        res, content = self._request(mpath, "GET", headers=headers)
        if res["status"] not in ("200", "304"):
            raise errors.MantaAPIError(res, content)
        if len(content) != int(res["content-length"]):
            raise errors.MantaError("content-length mismatch: expected %d, "
                                    "got %s" %
                                    (res["content-length"], content))
        if res.get("content-md5"):
            md5 = hashlib.md5(content)
            content_md5 = base64.b64encode(md5.digest()).decode("utf-8")
            if content_md5 != res["content-md5"]:
                raise errors.MantaError("content-md5 mismatch: expected %s, "
                                        "got %s" %
                                        (res["content-md5"], content_md5))
        if path is not None:
            f = io.open(path, 'wb')
            try:
                f.write(content)
            finally:
                f.close()
            return (res, None)
        else:
            return (res, content)
189896
def find(self, path=None, name=None):
        
        if path is None and name is None:
            # TODO: Correct error type
            raise ValueError("Path or name is required.")
            # Entries are sorted by version number, so the last will be the most recent
        # TODO: Reduce redundancy with RAFArchive
        if path:
            return self.entries_full[path.lower()][-1]
        else:
            return self.entries_name[name.lower()][-1][-1]
640923
function safeGet (obj, path) {
    // split ['c:chart'].row[0] into ['c:chart', 'row', 0]
    var paths = path.replace(/\[/g, '.').replace(/\]/g, '').replace(/'/g, '').split('.')

    for (var i = 0; i < paths.length; i++) {
      if (paths[i] === '') {
        // the first can be empty string if the path starts with ['chart:c']
        continue
      }

      var objReference = 'obj["' + paths[i] + '"]'
      // the last must be always array, also if accessor is number, we want to initialize as array
      var emptySafe = ((i === paths.length - 1) || !isNaN(paths[i + 1])) ? '[]' : '{}'
      new Function('obj', objReference + ' = ' + objReference + ' || ' + emptySafe)(obj)

      obj = new Function('obj', 'return ' + objReference)(obj)
    }

    return obj
  }
1068825
def get_namespace_by_url(self, url: str) -> Optional[Namespace]:
        """"""
        return self.session.query(Namespace).filter(Namespace.url == url).one_or_none()
442519
def get_object(self, path):
        """"""
        key = self.native_container.get_key(path)
        return self.obj_cls.from_key(self, key)
1026796
def fetch_path(self, name):
        

        with codecs.open(self.lookup_path(name), encoding='utf-8') as fd:
            return fd.read()
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;
      }
    }
  }
739636
def getkey(self, path, filename=None):
        
        scheme, keys = self.getkeys(path, filename=filename)
        try:
            key = next(keys)
        except StopIteration:
            raise FileNotFoundError("Could not find object for: '%s'" % path)

        # we expect to only have a single key returned
        nextKey = None
        try:
            nextKey = next(keys)
        except StopIteration:
            pass
        if nextKey:
            raise ValueError("Found multiple keys for: '%s'" % path)
        return scheme, key