Py3: Replace six.integer_types with int
In Python 3, six.integer_types is (int,). In most places, the alias can be simply replaced with int. In other places, it was possible to simplify the code by unpacking the tuple. See: https://pagure.io/freeipa/issue/7715 Signed-off-by: Christian Heimes <cheimes@redhat.com> Reviewed-By: Florence Blanc-Renaud <frenaud@redhat.com>
This commit is contained in:
1 parent
964a9bdcec
commit
ea396528b7
8 files changed
+21
-25
No files matched your search
+2
-3
@@ -22,7 +22,6 @@ import datetime
|
||||
import email.utils
|
||||
from calendar import timegm
|
||||
|
||||
import six
|
||||
# pylint: disable=import-error
|
||||
from six.moves.urllib.parse import urlparse
|
||||
# pylint: enable=import-error
|
||||
@@ -392,7 +391,7 @@ class Cookie:
|
||||
self._timestamp = None
|
||||
elif isinstance(value, datetime.datetime):
|
||||
self._timestamp = value
|
||||
elif isinstance(value, (six.integer_types, float)):
|
||||
elif isinstance(value, (int, float)):
|
||||
self._timestamp = datetime.datetime.utcfromtimestamp(value)
|
||||
elif isinstance(value, str):
|
||||
self._timestamp = Cookie.parse_datetime(value)
|
||||
@@ -418,7 +417,7 @@ class Cookie:
|
||||
self._expires = None
|
||||
elif isinstance(value, datetime.datetime):
|
||||
self._expires = value
|
||||
elif isinstance(value, (six.integer_types, float)):
|
||||
elif isinstance(value, (int, float)):
|
||||
self._expires = datetime.datetime.utcfromtimestamp(value)
|
||||
elif isinstance(value, str):
|
||||
self._expires = Cookie.parse_datetime(value)
|
||||
|
||||
Reference in new issue
Block a user