def from_path(cls, path: pathlib.Path) -> 'Entity':
        """
        Create an entity from a local path.

        :param path: The path to the entity, either a file or directory.
        :return: An entity instance representing the path.
        """
        if path.is_file():
            return File.from_path(path)
        return Directory.from_path(path)