rendercv.data.models.curriculum_vitae¶
The rendercv.data.models.curriculum_vitae module contains the data model of the cv
field of the input file.
SectionBase
¶
Bases: RenderCVBaseModelWithoutExtraKeys
This class is the parent class of all the section types. It is being used
in RenderCV internally, and it is not meant to be used directly by the users.
It is used by rendercv.data_models.utilities.create_a_section_model function to
create a section model based on any entry type.
Source code in src/rendercv/data/models/curriculum_vitae.py
SocialNetwork
¶
Bases: RenderCVBaseModelWithoutExtraKeys
This class is the data model of a social network.
Source code in src/rendercv/data/models/curriculum_vitae.py
url
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 src/rendercv/data/models/curriculum_vitae.py
check_url()
¶
Validate the URL of the social network.
Source code in src/rendercv/data/models/curriculum_vitae.py
CurriculumVitae
¶
Bases: RenderCVBaseModelWithExtraKeys
This class is the data model of the cv field.
Source code in src/rendercv/data/models/curriculum_vitae.py
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 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 | |
connections
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, str | None]]–The connections of the person.
sections
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_photo_path(value)
classmethod
¶
Cast photo to Path and make the path absolute
Source code in src/rendercv/data/models/curriculum_vitae.py
update_curriculum_vitae(value, info)
classmethod
¶
Update the curriculum_vitae dictionary.
Source code in src/rendercv/data/models/curriculum_vitae.py
serialize_phone(phone)
¶
Serialize the phone number.
Source code in src/rendercv/data/models/curriculum_vitae.py
validate_url(url)
¶
Validate a URL.
Parameters:
-
url(str) –The URL to validate.
Returns:
-
str–The validated URL.
create_a_section_validator(entry_type)
¶
Create a section model based on the entry type. See Pydantic's documentation about dynamic model creation for more information.
The section model is used to validate a section.
Parameters:
-
entry_type(type) –The entry type to create the section model. It's not an instance of the entry type, but the entry type itself.
Returns:
-
type[SectionBase]–The section validator (a Pydantic model).
Source code in src/rendercv/data/models/curriculum_vitae.py
get_characteristic_entry_attributes(entry_types)
¶
Get the characteristic attributes of the entry types.
Parameters:
-
entry_types(tuple[type]) –The entry types to get their characteristic attributes. These are not instances of the entry types, but the entry types themselves.
strtype should not be included in this list.
Returns:
-
dict[type, set[str]]–The characteristic attributes of the entry types.
Source code in src/rendercv/data/models/curriculum_vitae.py
get_entry_type_name_and_section_validator(entry, entry_types)
¶
Get the entry type name and the section validator based on the entry.
It takes an entry (as a dictionary or a string) and a list of entry types. Then it determines the entry type and creates a section validator based on the entry type.
Parameters:
-
entry(dict[str, str | list[str]] | str | type | None) –The entry to determine its type.
-
entry_types(tuple[type]) –The entry types to determine the entry type. These are not instances of the entry types, but the entry types themselves.
strtype should not be included in this list.
Returns:
-
tuple[str, type[SectionBase]]–The entry type name and the section validator.
Source code in src/rendercv/data/models/curriculum_vitae.py
validate_a_section(sections_input, entry_types)
¶
Validate a list of entries (a section) based on the entry types.
Sections input is a list of entries. Since there are multiple entry types, it is not
possible to validate it directly. Firstly, the entry type is determined with the
get_entry_type_name_and_section_validator function. If the entry type cannot be
determined, an error is raised. If the entry type is determined, the rest of the
list is validated with the section validator.
Parameters:
-
sections_input(list[Any]) –The sections input to validate.
-
entry_types(tuple[type]) –The entry types to determine the entry type. These are not instances of the entry types, but the entry types themselves.
strtype should not be included in this list.
Returns:
-
list[Entry]–The validated sections input.
Source code in src/rendercv/data/models/curriculum_vitae.py
validate_a_social_network_username(username, network)
¶
Check if the username field in the SocialNetwork model is provided correctly.
Parameters:
-
username(str) –The username to validate.
Returns:
-
str–The validated username.