Python 3: Fix basestring, long and StringIO
* The basestring type was removed in Python 3: replace it with six.string_types. * Replace StringIO.StringIO with six.StringIO * Replace (int, long) with six.integer_types Change-Id: Ic0d443b0bdd00fb18452e79ffae07b9be0fa8116
This commit is contained in:
parent
c0217a4845
commit
a60096769c
@ -297,11 +297,11 @@ def parse_and_validate_input(req_body, req_path):
|
||||
for ek in sorted(extraneous_keys))))
|
||||
continue
|
||||
|
||||
if not isinstance(seg_dict['path'], basestring):
|
||||
if not isinstance(seg_dict['path'], six.string_types):
|
||||
errors.append("Index %d: \"path\" must be a string" % seg_index)
|
||||
continue
|
||||
if not (seg_dict['etag'] is None or
|
||||
isinstance(seg_dict['etag'], basestring)):
|
||||
isinstance(seg_dict['etag'], six.string_types)):
|
||||
errors.append(
|
||||
"Index %d: \"etag\" must be a string or null" % seg_index)
|
||||
continue
|
||||
|
@ -284,7 +284,7 @@ def _resp_status_property():
|
||||
return '%s %s' % (self.status_int, self.title)
|
||||
|
||||
def setter(self, value):
|
||||
if isinstance(value, (int, long)):
|
||||
if isinstance(value, six.integer_types):
|
||||
self.status_int = value
|
||||
self.explanation = self.title = RESPONSE_REASONS[value][0]
|
||||
else:
|
||||
|
@ -964,7 +964,7 @@ def decode_timestamps(encoded, explicit=False):
|
||||
# TODO: some tests, e.g. in test_replicator, put float timestamps values
|
||||
# into container db's, hence this defensive check, but in real world
|
||||
# this may never happen.
|
||||
if not isinstance(encoded, basestring):
|
||||
if not isinstance(encoded, six.string_types):
|
||||
ts = Timestamp(encoded)
|
||||
return ts, ts, ts
|
||||
|
||||
|
@ -17,8 +17,8 @@
|
||||
import os
|
||||
import json
|
||||
import mock
|
||||
from six import StringIO
|
||||
import unittest
|
||||
from StringIO import StringIO
|
||||
from test.unit import with_tempdir
|
||||
|
||||
from swift.cli.ring_builder_analyzer import parse_scenario, run_scenario
|
||||
|
Loading…
Reference in New Issue
Block a user