Repository: activeloopai/Hub
File: deeplake/api/dataset.py (Python)

Code before:
                    )
                    check_integrity = False

            if check_integrity:
                integrity_check(ret)

            verbose = dataset_kwargs.get("verbose")
            path = dataset_kwargs.get("path")
            if verbose:
                logger.info(f"{path} loaded successfully.")
        else:
            ret = get_local_dataset(**dataset_kwargs)
        return ret

    @staticmethod
    def rename(
        old_path: Union[str, pathlib.Path],
        new_path: Union[str, pathlib.Path],
        creds: Optional[Union[dict, str]] = None,
        token: Optional[str] = None,
    ) -> Dataset:
        """Renames dataset at ``old_path`` to ``new_path``.

        Examples:
            >>> deeplake.rename("hub://username/image_ds", "new_ds")
            >>> deeplake.rename("hub://username/image_ds", "hub://username/new_ds")
            >>> deeplake.rename("s3://mybucket/my_ds", "s3://mybucket/renamed_ds")

        Args:
            old_path (str, pathlib.Path): The path to the dataset to be renamed.
            new_path (str, pathlib.Path): Path to the dataset after renaming.
            creds (dict, str, optional): The string ``ENV`` or a dictionary containing credentials used to access the dataset at the path.
                - If 'aws_access_key_id', 'aws_secret_access_key', 'aws_session_token' are present, these take precedence over credentials present in the environment or in credentials file. Currently only works with s3 paths.
                - It supports 'aws_access_key_id', 'aws_secret_access_key', 'aws_session_token', 'endpoint_url', 'aws_region', 'profile_name' as keys.
                - If 'ENV' is passed, credentials are fetched from the environment variables. This is also the case when creds is not passed for cloud datasets. For datasets connected to hub cloud, specifying 'ENV' will override the credentials fetched from Activeloop and use local ones.
            token (str, optional): Activeloop token, used for fetching credentials to the dataset at path if it is a Deep Lake dataset. This is optional, tokens are normally autogenerated.

        Returns:
            Dataset: The renamed Dataset.

        Raises:
            DatasetHandlerError: If a Dataset does not exist at the given path or if new path is to a different directory.
        """

        old_path = convert_pathlib_to_string_if_needed(old_path)
        new_path = convert_pathlib_to_string_if_needed(new_path)

        if ":" in old_path and ":" not in new_path:
            new_path = old_path.rsplit("/", 1)[0] + "/" + new_path

        if creds is None:

Review comment (suggestion):
@nvoxland To me this doesn't make sense unless you do a copy. Changing an org means moving the storage, at least in come cases. Therefore, how do you rename the entire path?

I feel like the rename methods should only change the name hub://org/name

Code after:
                    )
                    check_integrity = False

            if check_integrity:
                integrity_check(ret)

            verbose = dataset_kwargs.get("verbose")
            path = dataset_kwargs.get("path")
            if verbose:
                logger.info(f"{path} loaded successfully.")
        else:
            ret = get_local_dataset(**dataset_kwargs)
        return ret

    @staticmethod
    def rename(
        path: Union[str, pathlib.Path],
        new_name: str,
        token: Optional[str] = None,
    ) -> Dataset:
        """Renames managed dataset at ``path`` to ``new_name``.

        Examples:
            >>> deeplake.rename("hub://org_id/image_ds", "new_ds") ## New dataset path is `hub://org_id/new_ds`

        Args:
            path (str, pathlib.Path): The path to the dataset to be renamed.
            new_name (str, pathlib.Path): New name of the dataset.
            token (str, optional): Activeloop token for accessing the dataset

        Returns:
            Dataset: The renamed Dataset.

        Raises:
            RenameError: If a Dataset does not exist at the given path or if new path is not a managed dataset.
        """

        if not path.startswith("hub://"):
            raise RenameError("Rename is not available for non-managed datasets")

        feature_report_path(path, "rename", {}, token=token)

        ds = deeplake.load(path, verbose=False, token=token)
        ds.rename(new_name)

        return ds

    @staticmethod
    @spinner
    def delete(
        path: Union[str, pathlib.Path],