Skip to content

[Python] Avoid pep8 violation #4316

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from Nov 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from __future__ import absolute_import

import datetime
from dateutil.parser import parse
import json
import mimetypes
from multiprocessing.pool import ThreadPool
Expand Down Expand Up @@ -584,7 +585,6 @@ class ApiClient(object):
:return: date.
"""
try:
from dateutil.parser import parse
return parse(string).date()
except ImportError:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR made the import mandatory. Should this ImportError handling get removed?

return string
Expand All @@ -603,7 +603,6 @@ class ApiClient(object):
:return: datetime.
"""
try:
from dateutil.parser import parse
return parse(string)
except ImportError:
return string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from __future__ import absolute_import

import datetime
from dateutil.parser import parse
import json
import mimetypes
from multiprocessing.pool import ThreadPool
Expand Down Expand Up @@ -577,7 +578,6 @@ def __deserialize_date(self, string):
:return: date.
"""
try:
from dateutil.parser import parse
return parse(string).date()
except ImportError:
return string
Expand All @@ -596,7 +596,6 @@ def __deserialize_datetime(self, string):
:return: datetime.
"""
try:
from dateutil.parser import parse
return parse(string)
except ImportError:
return string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from __future__ import absolute_import

import datetime
from dateutil.parser import parse
import json
import mimetypes
from multiprocessing.pool import ThreadPool
Expand Down Expand Up @@ -579,7 +580,6 @@ def __deserialize_date(self, string):
:return: date.
"""
try:
from dateutil.parser import parse
return parse(string).date()
except ImportError:
return string
Expand All @@ -598,7 +598,6 @@ def __deserialize_datetime(self, string):
:return: datetime.
"""
try:
from dateutil.parser import parse
return parse(string)
except ImportError:
return string
Expand Down
3 changes: 1 addition & 2 deletions samples/client/petstore/python/petstore_api/api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from __future__ import absolute_import

import datetime
from dateutil.parser import parse
import json
import mimetypes
from multiprocessing.pool import ThreadPool
Expand Down Expand Up @@ -577,7 +578,6 @@ def __deserialize_date(self, string):
:return: date.
"""
try:
from dateutil.parser import parse
return parse(string).date()
except ImportError:
return string
Expand All @@ -596,7 +596,6 @@ def __deserialize_datetime(self, string):
:return: datetime.
"""
try:
from dateutil.parser import parse
return parse(string)
except ImportError:
return string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from __future__ import absolute_import

import datetime
from dateutil.parser import parse
import json
import mimetypes
from multiprocessing.pool import ThreadPool
Expand Down Expand Up @@ -577,7 +578,6 @@ def __deserialize_date(self, string):
:return: date.
"""
try:
from dateutil.parser import parse
return parse(string).date()
except ImportError:
return string
Expand All @@ -596,7 +596,6 @@ def __deserialize_datetime(self, string):
:return: datetime.
"""
try:
from dateutil.parser import parse
return parse(string)
except ImportError:
return string
Expand Down