Welcome to OSTools’s documentation!¶
Path¶
-
class
ostools.
Path
(envvar='PATH')[source]¶ This is a class for working with PATHs, like PATH or MANPATH.
It has the interface of a list. It loads the initial list from an environment variable, and converts each element into a
FilePath
, withexist_required
set to false.-
append
(item)[source]¶ This function functions like
list.append()
. It also converts theitem
into aFilePath
, withexist_required
set to false.
-
extend
(items)[source]¶ This function functions like
list.extend()
. It also converts each item into aFilePath
, withexist_required
set to false.
-
FilePath¶
-
class
ostools.
FilePath
(path='.', exist_required=True, ensure=None, lazy=False)[source]¶ This is a class similar to
pathlib.Path
.-
ensure
¶ str
– Whether to create the file or directory automatically. Can be either ‘dir’, to make it a directory, or ‘file’ to make it a file. It will be created before theFilePath.exist_required
check. This can be modified manually.
-
lazy
¶ bool
– Whether or not to runFilePath.ensure
andFilePath.exist_required
checks when accessing or modifyingFilePath.path()
. This can be modified manually.
-
OSTools Tutorial¶
Todo
Write tutorial!