rendercv.cli.utilities
¶
The rendercv.cli.utilities
module contains utility functions that are required by CLI.
set_or_update_a_value(dictionary, key, value, sub_dictionary=None)
¶
Set or update a value in a dictionary for the given key. For example, a key can
be cv.sections.education.3.institution
and the value can be "Bogazici University".
Parameters:
-
dictionary
(dict
) –The dictionary to set or update the value.
-
key
(str
) –The key to set or update the value.
-
value
(Any
) –The value to set or update.
-
sub_dictionary
(BaseModel | dict | list
, default:None
) –The sub dictionary to set or update the value. This is used for recursive calls. Defaults to None.
Source code in rendercv/cli/utilities.py
set_or_update_values(dictionary, key_and_values)
¶
Set or update values in a dictionary for the given keys. It uses the
set_or_update_a_value
function to set or update the values.
Parameters:
-
dictionary
(dict
) –The dictionary to set or update the values.
-
key_and_values
(dict[str, str]
) –The key and value pairs to set or update.
Source code in rendercv/cli/utilities.py
copy_files(paths, new_path)
¶
Copy files to the given path. If there are multiple files, then rename the new path by adding a number to the end of the path.
Parameters:
-
paths
(list[Path]
) –The paths of the files to be copied.
-
new_path
(Path
) –The path to copy the files to.
Source code in rendercv/cli/utilities.py
get_latest_version_number_from_pypi()
¶
Get the latest version number of RenderCV from PyPI.
Returns:
-
Optional[str]
–Optional[str]: The latest version number of RenderCV from PyPI. Returns None if the version number cannot be fetched.
Source code in rendercv/cli/utilities.py
get_error_message_and_location_and_value_from_a_custom_error(error_string)
¶
Look at a string and figure out if it's a custom error message that has been
sent from rendercv.data.reader.read_input_file
. If it is, then return the custom
message, location, and the input value.
This is done because sometimes we raise an error about a specific field in the model validation level, but Pydantic doesn't give us the exact location of the error because it's a model-level error. So, we raise a custom error with three string arguments: message, location, and input value. Those arguments then combined into a string by Python. This function is used to parse that custom error message and return the three values.
Parameters:
-
error_string
(str
) –The error message.
Returns:
-
tuple[Optional[str], Optional[str], Optional[str]]
–tuple[Optional[str], Optional[str], Optional[str]]: The custom message, location, and the input value.
Source code in rendercv/cli/utilities.py
copy_templates(folder_name, copy_to, new_folder_name=None)
¶
Copy one of the folders found in rendercv.templates
to copy_to
.
Parameters:
-
folder_name
(str
) –The name of the folder to be copied.
-
copy_to
(Path
) –The path to copy the folder to.
Returns:
-
Optional[Path]
–Optional[pathlib.Path]: The path to the copied folder.
Source code in rendercv/cli/utilities.py
parse_render_command_override_arguments(extra_arguments)
¶
Parse extra arguments given to the render
command as data model key and value
pairs and return them as a dictionary.
Parameters:
-
extra_arguments
(Context
) –The extra arguments context.
Returns:
-
dict[str, str]
–dict["str", "str"]: The key and value pairs.
Source code in rendercv/cli/utilities.py
get_default_render_command_cli_arguments()
¶
Get the default values of the render
command's CLI arguments.
Returns:
-
dict
(dict
) –The default values of the
render
command's CLI arguments.
Source code in rendercv/cli/utilities.py
update_render_command_settings_of_the_input_file(input_file_as_a_dict, render_command_cli_arguments)
¶
Update the input file's rendercv_settings.render_command
field with the given
(non-default) values of the render
command's CLI arguments.
Parameters:
-
input_file_as_a_dict
(dict
) –The input file as a dictionary.
-
render_command_cli_arguments
(dict
) –The command line arguments of the
render
command.
Returns:
-
dict
(dict
) –The updated input file as a dictionary.