forked from loafle/openapi-generator-original
[python] Convert unicode to six.u (#6881)
`unicode` does not exist in py3, therefore since six is already imported switch to using `six.u` so that `unicode` is used on py2 and `str` is used on py3.
This commit is contained in:
parent
7b269eaf4a
commit
b6699f6068
@ -44,7 +44,7 @@ def _deserialize_primitive(data, klass):
|
||||
try:
|
||||
value = klass(data)
|
||||
except UnicodeEncodeError:
|
||||
value = unicode(data)
|
||||
value = six.u(data)
|
||||
except TypeError:
|
||||
value = data
|
||||
return value
|
||||
|
@ -540,7 +540,7 @@ class ApiClient(object):
|
||||
try:
|
||||
return klass(data)
|
||||
except UnicodeEncodeError:
|
||||
return unicode(data) # noqa: F821
|
||||
return six.u(data)
|
||||
except TypeError:
|
||||
return data
|
||||
|
||||
|
@ -273,10 +273,10 @@ configuration.password = 'YOUR_PASSWORD'
|
||||
|
||||
# create an instance of the API class
|
||||
api_instance = petstore_api.FakeApi(petstore_api.ApiClient(configuration))
|
||||
number = 3.4 # float | None
|
||||
number = 8.14 # float | None
|
||||
double = 1.2 # float | None
|
||||
pattern_without_delimiter = 'pattern_without_delimiter_example' # str | None
|
||||
byte = 'byte_example' # str | None
|
||||
byte = 'B' # str | None
|
||||
integer = 56 # int | None (optional)
|
||||
int32 = 56 # int | None (optional)
|
||||
int64 = 789 # int | None (optional)
|
||||
|
@ -541,7 +541,7 @@ class ApiClient(object):
|
||||
try:
|
||||
return klass(data)
|
||||
except UnicodeEncodeError:
|
||||
return unicode(data) # noqa: F821
|
||||
return six.u(data)
|
||||
except TypeError:
|
||||
return data
|
||||
|
||||
|
@ -273,10 +273,10 @@ configuration.password = 'YOUR_PASSWORD'
|
||||
|
||||
# create an instance of the API class
|
||||
api_instance = petstore_api.FakeApi(petstore_api.ApiClient(configuration))
|
||||
number = 3.4 # float | None
|
||||
number = 8.14 # float | None
|
||||
double = 1.2 # float | None
|
||||
pattern_without_delimiter = 'pattern_without_delimiter_example' # str | None
|
||||
byte = 'byte_example' # str | None
|
||||
byte = 'B' # str | None
|
||||
integer = 56 # int | None (optional)
|
||||
int32 = 56 # int | None (optional)
|
||||
int64 = 789 # int | None (optional)
|
||||
|
@ -529,7 +529,7 @@ class ApiClient(object):
|
||||
try:
|
||||
return klass(data)
|
||||
except UnicodeEncodeError:
|
||||
return unicode(data) # noqa: F821
|
||||
return six.u(data)
|
||||
except TypeError:
|
||||
return data
|
||||
|
||||
|
@ -273,10 +273,10 @@ configuration.password = 'YOUR_PASSWORD'
|
||||
|
||||
# create an instance of the API class
|
||||
api_instance = petstore_api.FakeApi(petstore_api.ApiClient(configuration))
|
||||
number = 3.4 # float | None
|
||||
number = 8.14 # float | None
|
||||
double = 1.2 # float | None
|
||||
pattern_without_delimiter = 'pattern_without_delimiter_example' # str | None
|
||||
byte = 'byte_example' # str | None
|
||||
byte = 'B' # str | None
|
||||
integer = 56 # int | None (optional)
|
||||
int32 = 56 # int | None (optional)
|
||||
int64 = 789 # int | None (optional)
|
||||
|
@ -541,7 +541,7 @@ class ApiClient(object):
|
||||
try:
|
||||
return klass(data)
|
||||
except UnicodeEncodeError:
|
||||
return unicode(data) # noqa: F821
|
||||
return six.u(data)
|
||||
except TypeError:
|
||||
return data
|
||||
|
||||
|
@ -44,7 +44,7 @@ def _deserialize_primitive(data, klass):
|
||||
try:
|
||||
value = klass(data)
|
||||
except UnicodeEncodeError:
|
||||
value = unicode(data)
|
||||
value = six.u(data)
|
||||
except TypeError:
|
||||
value = data
|
||||
return value
|
||||
|
@ -44,7 +44,7 @@ def _deserialize_primitive(data, klass):
|
||||
try:
|
||||
value = klass(data)
|
||||
except UnicodeEncodeError:
|
||||
value = unicode(data)
|
||||
value = six.u(data)
|
||||
except TypeError:
|
||||
value = data
|
||||
return value
|
||||
|
Loading…
x
Reference in New Issue
Block a user