rendercv.data
¶
The rendercv.data
package contains the necessary classes and functions for
- Parsing and validating a YAML input file
- Computing some properties based on a YAML input file (like converting ISO dates to plain English, URLs of social networks, etc.)
- Generating a JSON Schema for RenderCV's data format
- Generating a sample YAML input file
The validators and data format of RenderCV are written using Pydantic.
BulletEntry
¶
Bases: RenderCVBaseModelWithExtraKeys
This class is the data model of BulletEntry
.
Source code in rendercv/data/models/entry_types.py
CurriculumVitae
¶
Bases: RenderCVBaseModelWithExtraKeys
This class is the data model of the cv
field.
Source code in rendercv/data/models/curriculum_vitae.py
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 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 |
|
connections: list[dict[str, Optional[str]]]
cached
property
¶
Return all the connections of the person as a list of dictionaries and cache
connections
as an attribute of the instance. The connections are used in the
header of the CV.
Returns:
-
list[dict[str, Optional[str]]]
–The connections of the person.
sections: list[SectionBase]
cached
property
¶
Compute the sections of the CV based on the input sections.
The original sections
input is a dictionary where the keys are the section titles
and the values are the list of entries in that section. This function converts the
input sections to a list of SectionBase
objects. This makes it easier to work with
the sections in the rest of the code.
Returns:
-
list[SectionBase]
–The computed sections.
update_curriculum_vitae(value, info)
classmethod
¶
Update the curriculum_vitae
dictionary.
Source code in rendercv/data/models/curriculum_vitae.py
EducationEntry
¶
Bases: EntryBase
, EducationEntryBase
This class is the data model of EducationEntry
. EducationEntry
class is
created by combining the EntryBase
and EducationEntryBase
classes to have the
fields in the correct order.
Source code in rendercv/data/models/entry_types.py
ExperienceEntry
¶
Bases: EntryBase
, ExperienceEntryBase
This class is the data model of ExperienceEntry
. ExperienceEntry
class is
created by combining the EntryBase
and ExperienceEntryBase
classes to have the
fields in the correct order.
Source code in rendercv/data/models/entry_types.py
LocaleCatalog
¶
Bases: RenderCVBaseModelWithoutExtraKeys
This class is the data model of the locale catalog. The values of each field
updates the locale_catalog
dictionary.
Source code in rendercv/data/models/locale_catalog.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 |
|
update_locale_catalog(value, info)
classmethod
¶
Update the locale_catalog
dictionary.
Source code in rendercv/data/models/locale_catalog.py
NormalEntry
¶
Bases: EntryBase
, NormalEntryBase
This class is the data model of NormalEntry
. NormalEntry
class is created by
combining the EntryBase
and NormalEntryBase
classes to have the fields in the
correct order.
Source code in rendercv/data/models/entry_types.py
OneLineEntry
¶
Bases: RenderCVBaseModelWithExtraKeys
This class is the data model of OneLineEntry
.
Source code in rendercv/data/models/entry_types.py
PublicationEntry
¶
Bases: EntryWithDate
, PublicationEntryBase
This class is the data model of PublicationEntry
. PublicationEntry
class is
created by combining the EntryWithDate
and PublicationEntryBase
classes to have
the fields in the correct order.
Source code in rendercv/data/models/entry_types.py
RenderCommandSettings
¶
Bases: RenderCVBaseModelWithoutExtraKeys
This class is the data model of the render
command's settings.
Source code in rendercv/data/models/rendercv_settings.py
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 |
|
replace_placeholders(value)
classmethod
¶
Replaces the placeholders in a string with the corresponding values.
Source code in rendercv/data/models/rendercv_settings.py
convert_string_to_path(value)
classmethod
¶
Converts a string to a pathlib.Path
object by replacing the placeholders
with the corresponding values. If the path is not an absolute path, it is
converted to an absolute path by prepending the current working directory.
Source code in rendercv/data/models/rendercv_settings.py
RenderCVDataModel
¶
Bases: RenderCVBaseModelWithoutExtraKeys
This class binds both the CV and the design information together.
Source code in rendercv/data/models/rendercv_data_model.py
initialize_locale_catalog(locale_catalog)
classmethod
¶
Even if the locale catalog is not provided, initialize it with the default values.
Source code in rendercv/data/models/rendercv_data_model.py
RenderCVSettings
¶
Bases: RenderCVBaseModelWithoutExtraKeys
This class is the data model of the RenderCV settings.
Source code in rendercv/data/models/rendercv_settings.py
SocialNetwork
¶
Bases: RenderCVBaseModelWithoutExtraKeys
This class is the data model of a social network.
Source code in rendercv/data/models/curriculum_vitae.py
url: str
cached
property
¶
Return the URL of the social network and cache url
as an attribute of the
instance.
check_username(username, info)
classmethod
¶
Check if the username is provided correctly.
Source code in rendercv/data/models/curriculum_vitae.py
check_url()
¶
Validate the URL of the social network.
Source code in rendercv/data/models/curriculum_vitae.py
create_a_sample_data_model(name='John Doe', theme='classic')
¶
Return a sample data model for new users to start with.
Parameters:
-
name
(str
, default:'John Doe'
) –The name of the person. Defaults to "John Doe".
Returns:
-
RenderCVDataModel
–A sample data model.
Source code in rendercv/data/generator.py
create_a_sample_yaml_input_file(input_file_path=None, name='John Doe', theme='classic')
¶
Create a sample YAML input file and return it as a string. If the input file path is provided, then also save the contents to the file.
Parameters:
-
input_file_path
(Optional[Path]
, default:None
) –The path to save the input file. Defaults to None.
-
name
(str
, default:'John Doe'
) –The name of the person. Defaults to "John Doe".
-
theme
(str
, default:'classic'
) –The theme of the CV. Defaults to "classic".
Returns:
-
str
–The sample YAML input file as a string.
Source code in rendercv/data/generator.py
generate_json_schema()
¶
Generate the JSON schema of RenderCV.
JSON schema is generated for the users to make it easier for them to write the input file. The JSON Schema of RenderCV is saved in the root directory of the repository and distributed to the users with the JSON Schema Store.
Returns:
-
dict
–The JSON schema of RenderCV.
Source code in rendercv/data/generator.py
generate_json_schema_file(json_schema_path)
¶
Generate the JSON schema of RenderCV and save it to a file.
Parameters:
-
json_schema_path
(Path
) –The path to save the JSON schema.
Source code in rendercv/data/generator.py
format_date(date, date_style=None)
¶
Formats a Date
object to a string in the following format: "Jan 2021". The
month names are taken from the locale_catalog
dictionary from the
rendercv.data_models.models
module.
Parameters:
-
date
(date
) –The date to format.
-
date_style
(Optional[str]
, default:None
) –The style of the date string. If not provided, the default date style from the
locale_catalog
dictionary will be used.
Returns:
-
str
–The formatted date.
Source code in rendercv/data/models/computers.py
read_a_yaml_file(file_path_or_contents)
¶
Read a YAML file and return its content as a dictionary. The YAML file can be given as a path to the file or as the contents of the file as a string.
Parameters:
-
file_path_or_contents
(Path | str
) –The path to the YAML file or the contents of the YAML file as a string.
Returns:
-
dict
–The content of the YAML file as a dictionary.
Source code in rendercv/data/reader.py
read_input_file(file_path_or_contents)
¶
Read the input file (YAML or JSON) and return them as an instance of
RenderCVDataModel
, which is a Pydantic data model of RenderCV's data format.
Parameters:
-
file_path_or_contents
(Path | str
) –The path to the input file or the contents of the input file as a string.
Returns:
-
RenderCVDataModel
–The data model.
Source code in rendercv/data/reader.py
validate_input_dictionary_and_return_the_data_model(input_dictionary)
¶
Validate the input dictionary by creating an instance of RenderCVDataModel
,
which is a Pydantic data model of RenderCV's data format.
Parameters:
-
input_dictionary
(dict
) –The input dictionary.
Returns:
-
RenderCVDataModel
–The data model.