notice
This is unreleased documentation for Rasa Documentation Main/Unreleased version.
For the latest released documentation, see the latest version (3.x).
rasa.utils.io
WriteRow Objects
Describes a csv writer supporting a writerow
method (workaround for typing).
writerow
Write the given row.
Arguments:
row
- the entries of a row as a list of strings
configure_colored_logging
Configures coloredlogs library for specified loglevel.
Arguments:
loglevel
- The loglevel to configure the library for
enable_async_loop_debugging
Enables debugging on an event loop.
Arguments:
event_loop
- The event loop to enable debugging onslow_callback_duration
- The threshold at which a callback should be alerted as slow.
pickle_dump
Saves object to file.
Arguments:
filename
- the filename to save the object toobj
- the object to store
pickle_load
Loads an object from a file.
Arguments:
filename
- the filename to load the object fromReturns
- the loaded object
create_temporary_file
Creates a tempfile.NamedTemporaryFile object for data.
create_temporary_directory
Creates a tempfile.TemporaryDirectory.
create_path
Makes sure all directories in the 'file_path' exists.
file_type_validator
Creates a Validator
class which can be used with questionary
to validate
file paths.
not_empty_validator
Creates a Validator
class which can be used with questionary
to validate
that the user entered something other than whitespace.
create_validator
Helper method to create Validator
classes from callable functions. Should be
removed when questionary supports Validator
objects.
json_unpickle
Unpickle an object from file using json.
Arguments:
file_name
- the file to load the object fromencode_non_string_keys
- If set toTrue
then jsonpickle will encode non-string dictionary keys instead of coercing them into strings viarepr()
.Returns
- the object
json_pickle
Pickle an object to a file using json.
Arguments:
file_name
- the file to store the object toobj
- the object to storeencode_non_string_keys
- If set toTrue
then jsonpickle will encode non-string dictionary keys instead of coercing them into strings viarepr()
.
get_emoji_regex
Returns regex to identify emojis.
are_directories_equal
Compares two directories recursively.
Files in each directory are assumed to be equal if their names and contents are equal.
Arguments:
dir1
- The first directory.dir2
- The second directory.
Returns:
True
if they are equal, False
otherwise.