Skip to content

Commit ddfa611

Browse files
committed
reduced complexity
1 parent a265238 commit ddfa611

File tree

1 file changed

+16
-20
lines changed

1 file changed

+16
-20
lines changed

services/web/server/src/simcore_service_webserver/application_settings.py

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -409,26 +409,22 @@ def _enable_only_if_dev_features_allowed(cls, data: Any) -> Any:
409409
data.get("WEBSERVER_DEV_FEATURES_ENABLED", False)
410410
)
411411

412-
if not dev_features_allowed:
413-
for field_name, field in cls.model_fields.items():
414-
if field.json_schema_extra:
415-
json_schema: dict[str, Any] = {}
416-
if callable(field.json_schema_extra):
417-
field.json_schema_extra(json_schema)
418-
else:
419-
json_schema = field.json_schema_extra
420-
421-
assert isinstance(json_schema, dict) # nosec
422-
423-
if json_schema.get(_X_DEV_FEATURE_FLAG):
424-
_logger.warning(
425-
"'%s' is still under development and will be forcibly disabled [WEBSERVER_DEV_FEATURES_ENABLED=%s].",
426-
field_name,
427-
dev_features_allowed,
428-
)
429-
data[field_name] = (
430-
None if field_name and is_nullable(field) else False
431-
)
412+
if dev_features_allowed:
413+
return data
414+
415+
for field_name, field in cls.model_fields.items():
416+
json_schema = field.json_schema_extra or {}
417+
if callable(field.json_schema_extra):
418+
json_schema = {}
419+
field.json_schema_extra(json_schema)
420+
421+
if json_schema.get(_X_DEV_FEATURE_FLAG):
422+
_logger.warning(
423+
"'%s' is still under development and will be forcibly disabled [WEBSERVER_DEV_FEATURES_ENABLED=%s].",
424+
field_name,
425+
dev_features_allowed,
426+
)
427+
data[field_name] = None if is_nullable(field) else False
432428

433429
return data
434430

0 commit comments

Comments
 (0)