Merge "More cleanup following py2 removal"
This commit is contained in:
commit
7f2649bfb7
@ -23,7 +23,7 @@ import warnings
|
|||||||
|
|
||||||
from requests.exceptions import RequestException, SSLError
|
from requests.exceptions import RequestException, SSLError
|
||||||
import http.client as http_client
|
import http.client as http_client
|
||||||
from urllib.parse import quote as _quote, unquote
|
from urllib.parse import quote, unquote
|
||||||
from urllib.parse import urljoin, urlparse, urlunparse
|
from urllib.parse import urljoin, urlparse, urlunparse
|
||||||
from time import sleep, time
|
from time import sleep, time
|
||||||
|
|
||||||
@ -181,14 +181,6 @@ def parse_header_string(data):
|
|||||||
return unquoted
|
return unquoted
|
||||||
|
|
||||||
|
|
||||||
def quote(value, safe='/'):
|
|
||||||
"""
|
|
||||||
Patched version of urllib.quote that encodes utf8 strings before quoting.
|
|
||||||
On Python 3, call directly urllib.parse.quote().
|
|
||||||
"""
|
|
||||||
return _quote(value, safe=safe)
|
|
||||||
|
|
||||||
|
|
||||||
def encode_utf8(value):
|
def encode_utf8(value):
|
||||||
if type(value) in (int, float, bool):
|
if type(value) in (int, float, bool):
|
||||||
# As of requests 2.11.0, headers must be byte- or unicode-strings.
|
# As of requests 2.11.0, headers must be byte- or unicode-strings.
|
||||||
|
@ -2034,11 +2034,6 @@ class SwiftService:
|
|||||||
if headers is None:
|
if headers is None:
|
||||||
headers = {}
|
headers = {}
|
||||||
segment_results.sort(key=lambda di: di['segment_index'])
|
segment_results.sort(key=lambda di: di['segment_index'])
|
||||||
for seg in segment_results:
|
|
||||||
seg_loc = seg['segment_location'].lstrip('/')
|
|
||||||
if isinstance(seg_loc, str):
|
|
||||||
seg_loc = seg_loc.encode('utf-8')
|
|
||||||
|
|
||||||
manifest_data = json.dumps([
|
manifest_data = json.dumps([
|
||||||
{
|
{
|
||||||
'path': d['segment_location'],
|
'path': d['segment_location'],
|
||||||
|
@ -1938,8 +1938,6 @@ def add_default_args(parser):
|
|||||||
def main(arguments=None):
|
def main(arguments=None):
|
||||||
argv = sys_argv if arguments is None else arguments
|
argv = sys_argv if arguments is None else arguments
|
||||||
|
|
||||||
argv = [a if isinstance(a, str) else a.decode('utf-8') for a in argv]
|
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(
|
parser = argparse.ArgumentParser(
|
||||||
add_help=False, formatter_class=HelpFormatter, usage='''
|
add_help=False, formatter_class=HelpFormatter, usage='''
|
||||||
%(prog)s [--version] [--help] [--os-help] [--snet] [--verbose]
|
%(prog)s [--version] [--help] [--os-help] [--snet] [--verbose]
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
hacking>=1.1.0,<1.2.0;python_version<'3.0' # Apache-2.0
|
hacking>=3.2.0,<3.3.0 # Apache-2.0
|
||||||
hacking>=3.2.0,<3.3.0;python_version>='3.0' # Apache-2.0
|
|
||||||
|
|
||||||
coverage!=4.4,>=4.0 # Apache-2.0
|
coverage!=4.4,>=4.0 # Apache-2.0
|
||||||
keystoneauth1>=3.4.0 # Apache-2.0
|
keystoneauth1>=3.4.0 # Apache-2.0
|
||||||
stestr>=2.0.0,!=3.0.0 # Apache-2.0
|
stestr>=2.0.0,!=3.0.0 # Apache-2.0
|
||||||
openstacksdk>=0.11.0 # Apache-2.0
|
openstacksdk>=0.11.0 # Apache-2.0
|
||||||
|
@ -216,12 +216,11 @@ class TestOutputManager(unittest.TestCase):
|
|||||||
# The threads should have been cleaned up
|
# The threads should have been cleaned up
|
||||||
self.assertEqual(starting_thread_count, threading.active_count())
|
self.assertEqual(starting_thread_count, threading.active_count())
|
||||||
|
|
||||||
over_the = "over the '\u062a\u062a'\n"
|
|
||||||
self.assertEqual(''.join([
|
self.assertEqual(''.join([
|
||||||
'one-argument\n',
|
'one-argument\n',
|
||||||
'one fish, 88 fish\n',
|
'one fish, 88 fish\n',
|
||||||
'some\n', 'where\n',
|
'some\n', 'where\n',
|
||||||
over_the,
|
"over the '\u062a\u062a'\n",
|
||||||
'some raw bytes: \u062a\u062a',
|
'some raw bytes: \u062a\u062a',
|
||||||
' key: value\n',
|
' key: value\n',
|
||||||
' object: O\u0308bject\n'
|
' object: O\u0308bject\n'
|
||||||
|
@ -1622,7 +1622,7 @@ class TestShell(unittest.TestCase):
|
|||||||
with mock.patch('swiftclient.shell.SwiftService.delete') as mock_func:
|
with mock.patch('swiftclient.shell.SwiftService.delete') as mock_func:
|
||||||
with CaptureOutput() as out:
|
with CaptureOutput() as out:
|
||||||
mock_func.return_value = [res]
|
mock_func.return_value = [res]
|
||||||
swiftclient.shell.main(base_argv + [container.encode('utf-8')])
|
swiftclient.shell.main(base_argv + [container])
|
||||||
|
|
||||||
mock_func.assert_called_once_with(container=container)
|
mock_func.assert_called_once_with(container=container)
|
||||||
self.assertTrue(out.out.find(
|
self.assertTrue(out.out.find(
|
||||||
@ -1635,7 +1635,7 @@ class TestShell(unittest.TestCase):
|
|||||||
with mock.patch('swiftclient.shell.SwiftService.delete') as mock_func:
|
with mock.patch('swiftclient.shell.SwiftService.delete') as mock_func:
|
||||||
with CaptureOutput() as out:
|
with CaptureOutput() as out:
|
||||||
mock_func.return_value = [res]
|
mock_func.return_value = [res]
|
||||||
swiftclient.shell.main(base_argv + [container.encode('utf-8')])
|
swiftclient.shell.main(base_argv + [container])
|
||||||
|
|
||||||
mock_func.assert_called_once_with(container=container)
|
mock_func.assert_called_once_with(container=container)
|
||||||
self.assertTrue(out.out.find(
|
self.assertTrue(out.out.find(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user