🔥 refactor(cache/base.py): remove empty pass statement in BaseCache abstract method

🔥 refactor(utils/validate.py): remove try-except block in create_function method
The pass statement in the BaseCache abstract method is redundant and can be removed. Similarly, the try-except block in the create_function method is not necessary as the exception is being suppressed.
This commit is contained in:
Gabriel Luiz Freitas Almeida 2023-06-16 14:22:14 -03:00
commit a099fd05ad
2 changed files with 2 additions and 5 deletions

View file

@ -27,7 +27,6 @@ class BaseCache(abc.ABC):
key: The key of the item.
value: The value to cache.
"""
pass
@abc.abstractmethod
def delete(self, key):

View file

@ -1,4 +1,5 @@
import ast
import contextlib
import importlib
import types
from typing import Dict
@ -147,11 +148,8 @@ def create_function(code, function_name):
code_obj = compile(
ast.Module(body=[function_code], type_ignores=[]), "<string>", "exec"
)
try:
with contextlib.suppress(Exception):
exec(code_obj, exec_globals, locals())
except Exception:
pass
exec_globals[function_name] = locals()[function_name]
# Return a function that imports necessary modules and calls the target function