only use subkeys when they are an object
This commit is contained in:
parent
415405c2b2
commit
c95fd5f257
|
@ -476,10 +476,10 @@ def get_request_params(
|
||||||
|
|
||||||
device, params, size = pipeline_from_json(server, data, default_pipeline)
|
device, params, size = pipeline_from_json(server, data, default_pipeline)
|
||||||
|
|
||||||
border = build_border(data.get("border", data))
|
border = build_border(get_dict_or_self(data, "border"))
|
||||||
upscale = build_upscale(data.get("upscale", data))
|
upscale = build_upscale(get_dict_or_self(data, "upscale"))
|
||||||
highres = build_highres(data.get("highres", data))
|
highres = build_highres(get_dict_or_self(data, "highres"))
|
||||||
experimental = build_experimental(data.get("experimental", data))
|
experimental = build_experimental(get_dict_or_self(data, "experimental"))
|
||||||
|
|
||||||
return RequestParams(
|
return RequestParams(
|
||||||
device,
|
device,
|
||||||
|
@ -490,3 +490,12 @@ def get_request_params(
|
||||||
highres=highres,
|
highres=highres,
|
||||||
experimental=experimental,
|
experimental=experimental,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def get_dict_or_self(dict: Dict[str, Any], key: str) -> Any:
|
||||||
|
if key in dict:
|
||||||
|
value = dict[key]
|
||||||
|
if isinstance(value, dict):
|
||||||
|
return value
|
||||||
|
|
||||||
|
return dict
|
||||||
|
|
Loading…
Reference in New Issue