megfile.smart_path module

class megfile.smart_path.SmartPath(path: str | BasePath | PathLike | int, *other_paths: str | BasePath | PathLike)[source]

Bases: BasePath

absolute(*args, **kwargs)
abspath(*args, **kwargs)

Return a normalized absolute version of the path.

access(*args, **kwargs)

Return True if the path has access permission described by mode.

property anchor
as_posix(*args, **kwargs)
as_uri(*args, **kwargs)
chmod(*args, **kwargs)
cwd(*args, **kwargs)
property drive
exists(*args, **kwargs)

Whether the path points to an existing file or directory.

expanduser(*args, **kwargs)
classmethod from_uri(path: str)[source]
getmtime(*args, **kwargs)

Return the time of last modification.

getsize(*args, **kwargs)

Return the size, in bytes.

glob(*args, **kwargs)

Return files whose paths match the glob pattern.

glob_stat(*args, **kwargs)

Return an iterator of files with stat whose paths match the glob pattern.

group(*args, **kwargs)
home(*args, **kwargs)
iglob(*args, **kwargs)

Return an iterator of files whose paths match the glob pattern.

is_absolute(*args, **kwargs)

Return True if the path is an absolute pathname.

is_block_device(*args, **kwargs)
is_char_device(*args, **kwargs)
is_dir(*args, **kwargs)

Return True if the path points to a directory.

is_fifo(*args, **kwargs)
is_file(*args, **kwargs)

Return True if the path points to a regular file.

is_mount(*args, **kwargs)

Return True if the path is a mount point.

is_relative_to(*args, **kwargs)
is_reserved(*args, **kwargs)
is_socket(*args, **kwargs)
iterdir(*args, **kwargs)
joinpath(*args, **kwargs)

Join or or more path.

lchmod(*args, **kwargs)
listdir(*args, **kwargs)

Return the names of the entries in the directory the path points to.

load(*args, **kwargs)

Read all content in binary.

lstat(*args, **kwargs)
match(*args, **kwargs)
md5(*args, **kwargs)
mkdir(*args, **kwargs)

Create a directory.

property name
open(*args, **kwargs)

Open the file with mode.

owner(*args, **kwargs)
property parent
property parents
property parts
property protocol: str
read_bytes(*args, **kwargs)
read_text(*args, **kwargs)
realpath(*args, **kwargs)

Return the canonical path of the path.

classmethod register(path_class, override_ok: bool = False)[source]
relative_to(*args, **kwargs)
relpath(*args, **kwargs)

Return the relative path.

remove(*args, **kwargs)

Remove (delete) the file.

rename(*args, **kwargs)
replace(*args, **kwargs)
resolve(*args, **kwargs)

Alias of realpath.

rglob(*args, **kwargs)
rmdir(*args, **kwargs)

Remove (delete) the directory.

property root
samefile(*args, **kwargs)
save(*args, **kwargs)

Write the opened binary stream to the path.

scan(*args, **kwargs)

Iterate through the files in the directory.

scan_stat(*args, **kwargs)

Iterate through the files in the directory, with file stat.

scandir(*args, **kwargs)

Return an iterator of FileEntry objects corresponding to the entries in the directory.

stat(*args, **kwargs)

Get the status of the path.

property stem
property suffix
property suffixes
touch(*args, **kwargs)

Remove (delete) the file.

utime(*args, **kwargs)
walk(*args, **kwargs)

Generate the file names in a directory tree by walking the tree.

with_name(*args, **kwargs)
with_stem(*args, **kwargs)
with_suffix(*args, **kwargs)
write_bytes(*args, **kwargs)
write_text(*args, **kwargs)
megfile.smart_path.get_traditional_path(path: str | BasePath | PathLike) str[source]