data_models: refactor

This commit is contained in:
Sina Atalay 2024-04-30 15:18:13 +03:00
parent 900b4a0cc2
commit 9dbe516fb1
1 changed files with 2 additions and 11 deletions

View File

@ -1047,12 +1047,8 @@ class RenderCVDataModel(RenderCVBaseModel):
# yet. So, validate and return it: # yet. So, validate and return it:
return rendercv_design_validator.validate_python(design) return rendercv_design_validator.validate_python(design)
else: else:
theme_name: str = design["theme"] # type: ignore # then it means it is a custom theme, so initialize and validate it:
if not isinstance(theme_name, str): theme_name: str = str(design["theme"])
raise RuntimeError(
"This error shouldn't have been raised. Please open an issue on"
" GitHub."
)
# check if the theme name is valid: # check if the theme name is valid:
if not theme_name.isalpha(): if not theme_name.isalpha():
@ -1103,11 +1099,6 @@ class RenderCVDataModel(RenderCVBaseModel):
"theme", "theme",
path_to_init_file, path_to_init_file,
) )
if spec is None:
raise RuntimeError(
"This error shouldn't have been raised. Please open an issue on"
" GitHub."
)
theme_module = importlib.util.module_from_spec(spec) theme_module = importlib.util.module_from_spec(spec)
try: try: