data_models: refactor

This commit is contained in:
Sina Atalay 2024-04-28 19:21:20 +03:00
parent d184ff4190
commit 53bc1c4ee2
1 changed files with 7 additions and 6 deletions

View File

@ -1187,6 +1187,13 @@ def get_a_sample_data_model(
Returns: Returns:
RenderCVDataModel: A sample data model. RenderCVDataModel: A sample data model.
""" """
# check if the theme is valid:
if theme not in available_themes:
raise ValueError(
f"The theme should be one of the following: {", ".join(available_themes)}!"
f" The provided theme is \"{theme}\"."
)
name = name.encode().decode("unicode-escape") name = name.encode().decode("unicode-escape")
sections = { sections = {
"summary": [ "summary": [
@ -1394,12 +1401,6 @@ def get_a_sample_data_model(
sections=sections, # type: ignore sections=sections, # type: ignore
) )
if theme not in available_themes:
raise ValueError(
f"The theme should be one of the following: {available_themes}! The"
f" provided theme is {theme}."
)
if theme == "classic": if theme == "classic":
design = ClassicThemeOptions(theme="classic", show_timespan_in=["Experience"]) design = ClassicThemeOptions(theme="classic", show_timespan_in=["Experience"])
else: else: