Filesystem parameters¶
-
class
versuchung.files.
File
(default_filename='')[source]¶ Can be used as: input parameter and output parameter
The File type represents the content of a single file. Its contents can be read and written most easily with the
value
property.Alternatively, the method
write()
appends new content if the parameter append is set to True.NB: The content of the file is flushed only after the experiment finishes. Use
flush()
to force writing the buffered data to disk before the experiment finishes.-
copy_contents
(filename)[source]¶ Read the given file and replace the current .value with the files content.
Flushes automatically afterwards.
-
path
¶ Returns: string – path to the file/directory
-
value
¶ This attribute can be read and written and represent the content of the specified file
-
-
class
versuchung.files.
Directory
(default_filename='')[source]¶ Can be used as: input parameter and output parameter
Represents the contents of directory. It can also be used with the with-keyword to change the current working directory temporarily to this directory:
with directory as dir: # Do something with adjusted current working directory print os.curdir
-
mirror_directory
(*args, **kwargs)¶ Copies the contents of the given directory to this directory.
The include closure is a function, which checks for every (absolute) path in the origin directory, if it is mirrored. If it is None, all files are included.
-
new_file
(*args, **kwargs)¶ Generate a new
File
in the directory. It will be flushed automatically if the experiment is over.
-
path
¶ Returns: string – path to the file/directory
-
value
¶ Returns: list – directories and files in given directory
-