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
200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 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 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 |
|
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
355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 |
|
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.