tfds.core.Path

Abstract base class for pathlib.Path-like API.

See pathlib.Path documentation.

*args Paths to create

anchor The concatenation of the drive and root, or ''.
drive The drive prefix (letter or UNC path), if any.
name The final path component, if any.
parent The logical parent of the path.
parents A sequence of this path's logical parents.
parts An object providing sequence-like access to the components in the filesystem path.
root The root of the path, if any.
stem The final path component, minus its last suffix.
suffix The final component's last suffix, if any.

This includes the leading period. For example: '.txt'

suffixes A list of the final component's suffixes, if any.

These include the leading periods. For example: ['.tar', '.gz']

Methods

as_posix

Return the string representation of the path with forward (/) slashes.

as_uri

Return the path as a 'file' URI.

copy

Copy the current file to the given destination.

exists

Returns True if self exists.

expanduser

Returns a new path with expanded ~ and ~user constructs.

format

Apply str.format() to the path.

glob

Yields all matching files (of any kind).

is_absolute

True if the path is absolute (has both a root and, if applicable, a drive).

is_dir

Returns True if self is a dir.

is_file

Returns True if self is a file.

is_relative_to

Return True if the path is relative to another path or False.

is_reserved

Return True if the path contains one of the special names reserved by the system, if any.

iterdir

Iterates over the directory.

joinpath

Combine this path with one or several arguments, and return a new path representing either a subpath (if all arguments are relative paths) or a totally different path (if one of the arguments is anchored).

match

Return True if this path matches the given pattern.

mkdir

Create a new directory at this given path.

open

Opens the file.

read_bytes

Reads contents of self as bytes.

read_text

Reads contents of self as a string.

relative_to

Return the relative path to another path identified by the passed arguments. If the operation is not possible (because this is not a subpath of the other path), raise ValueError.

rename

Renames the path.

replace

Overwrites the destination path.

resolve

Returns the absolute path.

rglob

Yields all matching files recursively (of any kind).

rmdir

Remove the empty directory at this given path.

rmtree

Remove the directory, including all sub-files.

stat

Returns metadata for the file/directory.

touch

Create a file at this given path.

Remove this file or symbolic link.

with_name

Return a new path with the file name changed.

with_stem

Return a new path with the stem changed.

with_suffix

Return a new path with the file suffix changed. If the path has no suffix, add given suffix. If the given suffix is an empty string, remove the suffix from the path.

write_bytes

Writes content as bytes.

write_text

Writes content as str.

__eq__

Return self==value.

__ge__

Return self>=value.

__gt__

Return self>value.

__le__

Return self<=value.

__lt__

Return self<value.

__rtruediv__

__truediv__