forked from loafle/openapi-generator-original
python: use isinstance instead of type() (#16516)
Use of `isinstance` is preferred (and validated by common linters).
This commit is contained in:
parent
4b7a808a9f
commit
1b32088c2d
@ -234,7 +234,7 @@ class ApiClient:
|
||||
# data needs deserialization or returns HTTP data (deserialized) only
|
||||
if _preload_content or _return_http_data_only:
|
||||
response_type = response_types_map.get(str(response_data.status), None)
|
||||
if not response_type and type(response_data.status) == int and 100 <= response_data.status <= 599:
|
||||
if not response_type and isinstance(response_data.status, int) and 100 <= response_data.status <= 599:
|
||||
# if not found, look for '1XX', '2XX', etc.
|
||||
response_type = response_types_map.get(str(response_data.status)[0] + "XX", None)
|
||||
|
||||
|
@ -227,7 +227,7 @@ class ApiClient:
|
||||
# data needs deserialization or returns HTTP data (deserialized) only
|
||||
if _preload_content or _return_http_data_only:
|
||||
response_type = response_types_map.get(str(response_data.status), None)
|
||||
if not response_type and type(response_data.status) == int and 100 <= response_data.status <= 599:
|
||||
if not response_type and isinstance(response_data.status, int) and 100 <= response_data.status <= 599:
|
||||
# if not found, look for '1XX', '2XX', etc.
|
||||
response_type = response_types_map.get(str(response_data.status)[0] + "XX", None)
|
||||
|
||||
|
@ -227,7 +227,7 @@ class ApiClient:
|
||||
# data needs deserialization or returns HTTP data (deserialized) only
|
||||
if _preload_content or _return_http_data_only:
|
||||
response_type = response_types_map.get(str(response_data.status), None)
|
||||
if not response_type and type(response_data.status) == int and 100 <= response_data.status <= 599:
|
||||
if not response_type and isinstance(response_data.status, int) and 100 <= response_data.status <= 599:
|
||||
# if not found, look for '1XX', '2XX', etc.
|
||||
response_type = response_types_map.get(str(response_data.status)[0] + "XX", None)
|
||||
|
||||
|
@ -226,7 +226,7 @@ class ApiClient:
|
||||
# data needs deserialization or returns HTTP data (deserialized) only
|
||||
if _preload_content or _return_http_data_only:
|
||||
response_type = response_types_map.get(str(response_data.status), None)
|
||||
if not response_type and type(response_data.status) == int and 100 <= response_data.status <= 599:
|
||||
if not response_type and isinstance(response_data.status, int) and 100 <= response_data.status <= 599:
|
||||
# if not found, look for '1XX', '2XX', etc.
|
||||
response_type = response_types_map.get(str(response_data.status)[0] + "XX", None)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user