social_network
¶
available_social_networks = get_args(SocialNetworkName.__value__)
module-attribute
¶
url_dictionary = {'LinkedIn': 'https://linkedin.com/in/', 'GitHub': 'https://github.com/', 'GitLab': 'https://gitlab.com/', 'IMDB': 'https://imdb.com/name/', 'Instagram': 'https://instagram.com/', 'ORCID': 'https://orcid.org/', 'StackOverflow': 'https://stackoverflow.com/users/', 'ResearchGate': 'https://researchgate.net/profile/', 'YouTube': 'https://youtube.com/@', 'Google Scholar': 'https://scholar.google.com/citations?user=', 'Telegram': 'https://t.me/', 'WhatsApp': 'https://wa.me/', 'Leetcode': 'https://leetcode.com/u/', 'X': 'https://x.com/', 'Bluesky': 'https://bsky.app/profile/', 'Reddit': 'https://reddit.com/user/'}
module-attribute
¶
url_validator = pydantic.TypeAdapter[pydantic.HttpUrl](pydantic.HttpUrl)
module-attribute
¶
SocialNetworkName = Literal['LinkedIn', 'GitHub', 'GitLab', 'IMDB', 'Instagram', 'ORCID', 'Mastodon', 'StackOverflow', 'ResearchGate', 'YouTube', 'Google Scholar', 'Telegram', 'WhatsApp', 'Leetcode', 'X', 'Bluesky', 'Reddit']
¶
SocialNetwork
¶
Bases: BaseModelWithoutExtraKeys
model_config = pydantic.ConfigDict(extra='forbid', validate_default=True)
class-attribute
instance-attribute
¶
network = pydantic.Field()
class-attribute
instance-attribute
¶
url
cached
property
¶
Generate profile URL from network and username.
Why
Users provide network+username for brevity. Property generates full URLs with platform-specific logic (e.g., Mastodon domain extraction).
Returns:
-
str–Complete profile URL.
username = pydantic.Field(examples=['john_doe', '@johndoe@mastodon.social', '12345/john-doe'])
class-attribute
instance-attribute
¶
check_username(username, info)
classmethod
¶
Validate username format per network's requirements.
Why
Different platforms have specific username formats (e.g., Mastodon needs @user@domain, StackOverflow needs id/name). Early validation prevents broken URL generation.
Parameters:
-
username(str) –Username to validate.
-
info(ValidationInfo) –Validation context containing network field.
Returns:
-
str–Validated username.
Source code in src/rendercv/schema/models/cv/social_network.py
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 | |
validate_generated_url()
¶
Validate generated URL is well-formed.
Why
URL generation from username might produce invalid URLs if username format is wrong. Post-validation check catches edge cases.
Returns:
-
SocialNetwork–Validated social network instance.