This method MUST retain the state of the current instance, and return
an instance that contains the specified path.
493052
function it_retains_the_original_state_of_the_instance_duplicated_with_new_path()
    {
        $original_uri = (string) $this->getWrappedObject();

        $new_path = $this->withPath("/quux/quuz");

        $this->__toString()->shouldReturn($original_uri);
    }
1089822
function () {
      var path = Immutable.List();
      for (var i = 0; i < arguments.length; i++) {
        path = path.concat(arguments[i]);
      }
      return this.state.getIn(path);
    }
229104
def open_instance_resource(self, path: FilePath, mode: str='rb') -> IO[AnyStr]:
        
        return open(self.instance_path / file_path_to_path(path), mode)
613589
def get_object(self, path):
        """"""
        obj = self.native_container.get_object(path)
        return self.obj_cls.from_obj(self, obj)
853586
static Path makeRelative(Path path) {
    if (!path.isAbsolute()) {
      return path;
    }          
    String p = path.toUri().getPath();
    String relative = p.substring(1, p.length());
    return new Path(relative);
  }
406027
def has_path(self, path, method=None):
        
        method = self._normalize_method_name(method)

        path_dict = self.get_path(path)
        path_dict_exists = path_dict is not None
        if method:
            return path_dict_exists and method in path_dict
        return path_dict_exists
109697
public static Instance findInstanceByPath( Instance rootInstance, String instancePath ) {

		Application tempApplication = new Application( new ApplicationTemplate());
		if( rootInstance != null )
			tempApplication.getRootInstances().add( rootInstance );

		return findInstanceByPath( tempApplication, instancePath );
	}
427167
def get_instance(cls, state):
        """"""
        if cls.instance is None:
            cls.instance = UserStorageHandler(state)
        return cls.instance
997845
def path(self) -> Tuple[InstanceKey]:
        """"""
        res = []
        inst: InstanceNode = self
        while inst.parinst:
            res.insert(0, inst._key)
            inst = inst.parinst
        return tuple(res)
432862
def initialize_path(self, path_num=None):
        
        self.state = copy(self.initial_state)
        return self.state
660122
function (path) {
      var state = this.getState();
      path = this.formatURL(path);

      if (!state || state.path !== path) {
        this.pushState(path);
      }
    }
964779
def keep_path(self, path):
        
        if len(path.addr_trace) < 2:
            return True

        return self.should_take_exit(path.addr_trace[-2], path.addr_trace[-1])
1078273
def from_path(cls, path: pathlib.Path) -> 'Entity':
        
        if path.is_file():
            return File.from_path(path)
        return Directory.from_path(path)
473444
def path(self, path):
        """"""

        # pylint: disable=attribute-defined-outside-init
        self._path = copy_.copy(path)

        # The provided path is shallow copied; it does not have any attributes
        # with mutable types.

        # We perform this check after the initialization to avoid errors
        # in test tools that show the object with repr().
        assert isinstance(path, CIMClassName) or path is None
1267530
def _path_exists(path):
    """"""
    return os.path.exists(path) or os.path.islink(path)
33607
def Get(self, path, rootpy=True, **kwargs):
        
        thing = super(_DirectoryBase, self).Get(path)
        if not thing:
            raise DoesNotExist

        # Ensure that the file we took the object from is alive at least as
        # long as the object being taken from it.

        # Note, Python does *not* own `thing`, it is ROOT's responsibility to
        # delete it in the C++ sense. (SetOwnership is False). However, ROOT
        # will delete the object when the TFile's destructor is run.
        # Therefore, when `thing` goes out of scope and the file referred to
        # by `this` has no references left, the file is destructed and calls
        # `thing`'s delete.

        # (this is thanks to the fact that weak referents (used by keepalive)
        #  are notified when they are dead).

        keepalive(thing, self)

        if rootpy:
            return asrootpy(thing, **kwargs)
        return thing
312611
function(path) {
		this.assertNotDestroyed('get', path);
		path = parsePath(path);

		switch (path[0]) {
			case '$this':
				if (path.length === 1)
					return this.data;
				break;
			case '$parent':
				this.assertHasParent(path);
				return this.parent.get(path.slice(1));
				break;
			case '$env':
				return this.env.get(path.slice(1));
		}
		return utils.getProp(this.data, path);
	}