mirror of
https://github.com/lllyasviel/Fooocus.git
synced 2026-08-16 13:13:16 +02:00
fix: prevent strange type conversions by providing expected type
This commit is contained in:
@@ -30,8 +30,11 @@ def get_files_from_folder(folder_path, extensions=None, name_filter=None):
|
||||
|
||||
def try_eval_env_var(value: str, expected_type=None):
|
||||
try:
|
||||
value_eval = literal_eval(value.title())
|
||||
if expected_type is not None and type(value_eval) is not expected_type:
|
||||
value_eval = value
|
||||
if expected_type is bool:
|
||||
value_eval = value.title()
|
||||
value_eval = literal_eval(value_eval)
|
||||
if expected_type is not None and not isinstance(value_eval, expected_type):
|
||||
return value
|
||||
return value_eval
|
||||
except:
|
||||
|
||||
Reference in New Issue
Block a user