-
Notifications
You must be signed in to change notification settings - Fork 0
/
contents.py
59 lines (40 loc) · 987 Bytes
/
contents.py
1
2
3
4
5
6
7
8
9
10
11
12
13
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
from pathlib import Path
import yaml
from pydantic import BaseModel, AnyUrl
class Social(BaseModel):
username: str
url: AnyUrl
class Contact(BaseModel):
email: str
phone: str
class BioSection(BaseModel):
name: str
location: str
nationality: str
contact: Contact
github: Social
linkedin: Social
class LanguageItem(BaseModel):
name: str
level: str
class EducationItem(BaseModel):
institution: str
degree: str
years: str
class WorkItem(BaseModel):
company: str
title: str
years: str
description: str
class SkillListItem(BaseModel):
label: str
items: list[str]
class CVContents(BaseModel):
bio: BioSection
language: list[LanguageItem]
education: list[EducationItem]
work: list[WorkItem]
skills: list[SkillListItem]
def load_cv(contents_yaml_path: Path) -> CVContents:
with open(contents_yaml_path) as f:
return CVContents.model_validate(yaml.safe_load(f))