rendercv.cli.printer
¶
The rendercv.cli.printer
module contains all the functions and classes that are used
to print nice-looking messages to the terminal.
LiveProgressReporter
¶
Bases: Live
This class is a wrapper around rich.live.Live
that provides the live progress
reporting functionality.
Parameters:
-
number_of_steps
(int
) –The number of steps to be finished.
-
end_message
(str
, default:'Your CV is rendered!'
) –The message to be printed when the progress is finished. Defaults to "Your CV is rendered!".
Source code in rendercv/cli/printer.py
__enter__()
¶
start_a_step(step_name)
¶
Start a step and update the progress bars.
Parameters:
-
step_name
(str
) –The name of the step.
Source code in rendercv/cli/printer.py
finish_the_current_step()
¶
Finish the current step and update the progress bars.
Source code in rendercv/cli/printer.py
warn_if_new_version_is_available()
¶
Check if a new version of RenderCV is available and print a warning message if there is a new version. Also, return True if there is a new version, and False otherwise.
Returns:
-
bool
–True if there is a new version, and False otherwise.
Source code in rendercv/cli/printer.py
welcome()
¶
Print a welcome message to the terminal.
Source code in rendercv/cli/printer.py
warning(text)
¶
Print a warning message to the terminal.
Parameters:
-
text
(str
) –The text of the warning message.
error(text=None, exception=None)
¶
Print an error message to the terminal and exit the program. If an exception is given, then print the exception's message as well. If neither text nor exception is given, then print an empty line and exit the program.
Parameters:
-
text
(Optional[str]
, default:None
) –The text of the error message.
-
exception
(Optional[Exception]
, default:None
) –An exception object. Defaults to None.
Source code in rendercv/cli/printer.py
information(text)
¶
Print an information message to the terminal.
Parameters:
-
text
(str
) –The text of the information message.
print_validation_errors(exception)
¶
Take a Pydantic validation error and print the error messages in a nice table.
Pydantic's ValidationError
object is a complex object that contains a lot of
information about the error. This function takes a ValidationError
object and
extracts the error messages, locations, and the input values. Then, it prints them
in a nice table with Rich.
Parameters:
-
exception
(ValidationError
) –The Pydantic validation error object.
Source code in rendercv/cli/printer.py
handle_and_print_raised_exceptions_without_exit(function)
¶
Return a wrapper function that handles exceptions. It does not exit the program after an exception is raised. It just prints the error message and continues the execution.
A decorator in Python is a syntactic convenience that allows a Python to interpret the code below:
as
which means that the function my_function
is modified by the handle_exceptions
.
Parameters:
-
function
(Callable
) –The function to be wrapped.
Returns:
-
Callable
–The wrapped function.
Source code in rendercv/cli/printer.py
242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 |
|
handle_and_print_raised_exceptions(function)
¶
Return a wrapper function that handles exceptions. It exits the program after an exception is raised.
A decorator in Python is a syntactic convenience that allows a Python to interpret the code below:
as
which means that the function my_function
is modified by the handle_exceptions
.
Parameters:
-
function
(Callable
) –The function to be wrapped.
Returns:
-
Callable
–The wrapped function.