File isinstance-instead-type.patch of Package python-hug
From 7aa46f91604d123406266d2ae86292ba401a0fc2 Mon Sep 17 00:00:00 2001
From: Sebastian Wagner <swagner@intevation.de>
Date: Wed, 18 Sep 2024 12:16:38 +0200
Subject: [PATCH] use isinstance instead of type ==
---
hug/input_format.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/hug/input_format.py b/hug/input_format.py
index c1565f84..204f31f8 100644
--- a/hug/input_format.py
+++ b/hug/input_format.py
@@ -73,11 +73,11 @@ def multipart(body, content_length=0, **header_params):
"""Converts multipart form data into native Python objects"""
header_params.setdefault("CONTENT-LENGTH", content_length)
if header_params and "boundary" in header_params:
- if type(header_params["boundary"]) is str:
+ if isinstance(header_params["boundary"], str):
header_params["boundary"] = header_params["boundary"].encode()
form = parse_multipart((body.stream if hasattr(body, "stream") else body), header_params)
for key, value in form.items():
- if type(value) is list and len(value) == 1:
+ if isinstance(value, list) and len(value) == 1:
form[key] = value[0]
return form