From 9dbe516fb143bcc088b258bf5102530c32e5c101 Mon Sep 17 00:00:00 2001 From: Sina Atalay Date: Tue, 30 Apr 2024 15:18:13 +0300 Subject: [PATCH] data_models: refactor --- rendercv/data_models.py | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/rendercv/data_models.py b/rendercv/data_models.py index 0411387..a28cef6 100644 --- a/rendercv/data_models.py +++ b/rendercv/data_models.py @@ -1047,12 +1047,8 @@ class RenderCVDataModel(RenderCVBaseModel): # yet. So, validate and return it: return rendercv_design_validator.validate_python(design) else: - theme_name: str = design["theme"] # type: ignore - if not isinstance(theme_name, str): - raise RuntimeError( - "This error shouldn't have been raised. Please open an issue on" - " GitHub." - ) + # then it means it is a custom theme, so initialize and validate it: + theme_name: str = str(design["theme"]) # check if the theme name is valid: if not theme_name.isalpha(): @@ -1103,11 +1099,6 @@ class RenderCVDataModel(RenderCVBaseModel): "theme", 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) try: