Remove usage of six
The repo is python 3 only, remove six usage. Change-Id: I8c0b0446a88a12b5da8c6502f8eee75ed1793095
This commit is contained in:
parent
60699c1b06
commit
ab3eb972bf
@ -1,6 +1,5 @@
|
|||||||
docutils==0.11
|
docutils==0.11
|
||||||
dulwich==0.15.0
|
dulwich==0.15.0
|
||||||
PyYAML==3.10.0
|
PyYAML==3.10.0
|
||||||
six==1.9.0
|
|
||||||
Sphinx==1.6.1
|
Sphinx==1.6.1
|
||||||
stestr==2.0.0
|
stestr==2.0.0
|
||||||
|
@ -13,7 +13,6 @@
|
|||||||
from docutils import nodes
|
from docutils import nodes
|
||||||
from docutils.parsers import rst
|
from docutils.parsers import rst
|
||||||
from docutils.statemachine import ViewList
|
from docutils.statemachine import ViewList
|
||||||
import six
|
|
||||||
from sphinx.util import logging
|
from sphinx.util import logging
|
||||||
from sphinx.util.nodes import nested_parse_with_titles
|
from sphinx.util.nodes import nested_parse_with_titles
|
||||||
|
|
||||||
@ -37,7 +36,7 @@ def _format_option_help(options):
|
|||||||
for l in _multi_line_string(opt.help, ' '):
|
for l in _multi_line_string(opt.help, ' '):
|
||||||
yield l
|
yield l
|
||||||
yield ''
|
yield ''
|
||||||
if isinstance(opt.default, six.string_types) and '\n' in opt.default:
|
if isinstance(opt.default, str) and '\n' in opt.default:
|
||||||
# Multi-line string
|
# Multi-line string
|
||||||
yield ' Defaults to'
|
yield ' Defaults to'
|
||||||
yield ''
|
yield ''
|
||||||
|
@ -14,7 +14,6 @@ import collections
|
|||||||
import logging
|
import logging
|
||||||
import os.path
|
import os.path
|
||||||
|
|
||||||
import six
|
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
from reno import scanner
|
from reno import scanner
|
||||||
@ -107,7 +106,7 @@ class Loader(object):
|
|||||||
|
|
||||||
for section_name, section_content in content.items():
|
for section_name, section_content in content.items():
|
||||||
if section_name == self._config.prelude_section_name:
|
if section_name == self._config.prelude_section_name:
|
||||||
if not isinstance(section_content, six.string_types):
|
if not isinstance(section_content, str):
|
||||||
LOG.warning(
|
LOG.warning(
|
||||||
('The %s section of %s '
|
('The %s section of %s '
|
||||||
'does not parse as a single string. '
|
'does not parse as a single string. '
|
||||||
@ -115,7 +114,7 @@ class Loader(object):
|
|||||||
(self._config.prelude_section_name, filename),
|
(self._config.prelude_section_name, filename),
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
if isinstance(section_content, six.string_types):
|
if isinstance(section_content, str):
|
||||||
# A single string is OK, but wrap it with a list
|
# A single string is OK, but wrap it with a list
|
||||||
# so the rest of the code can treat the data model
|
# so the rest of the code can treat the data model
|
||||||
# consistently.
|
# consistently.
|
||||||
@ -129,7 +128,7 @@ class Loader(object):
|
|||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
for item in section_content:
|
for item in section_content:
|
||||||
if not isinstance(item, six.string_types):
|
if not isinstance(item, str):
|
||||||
LOG.warning(
|
LOG.warning(
|
||||||
('The item %r in the %s section of %s '
|
('The item %r in the %s section of %s '
|
||||||
'parses as a %s instead of a string. '
|
'parses as a %s instead of a string. '
|
||||||
|
@ -24,7 +24,6 @@ from distutils import cmd
|
|||||||
from distutils import errors
|
from distutils import errors
|
||||||
from distutils import log
|
from distutils import log
|
||||||
|
|
||||||
import six
|
|
||||||
|
|
||||||
from reno import cache
|
from reno import cache
|
||||||
from reno import config
|
from reno import config
|
||||||
@ -108,7 +107,7 @@ class BuildReno(cmd.Command):
|
|||||||
if val is None:
|
if val is None:
|
||||||
setattr(self, option, default)
|
setattr(self, option, default)
|
||||||
return default
|
return default
|
||||||
elif not isinstance(val, six.string_types):
|
elif not isinstance(val, str):
|
||||||
raise errors.DistutilsOptionError("'%s' must be a %s (got `%s`)"
|
raise errors.DistutilsOptionError("'%s' must be a %s (got `%s`)"
|
||||||
% (option, what, val))
|
% (option, what, val))
|
||||||
return val
|
return val
|
||||||
|
@ -17,7 +17,6 @@ import textwrap
|
|||||||
|
|
||||||
import fixtures
|
import fixtures
|
||||||
import mock
|
import mock
|
||||||
import six
|
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
from reno import config
|
from reno import config
|
||||||
@ -73,7 +72,7 @@ class TestValidate(base.TestCase):
|
|||||||
This is a single string.
|
This is a single string.
|
||||||
'''))
|
'''))
|
||||||
print(type(note_bodies['issues']))
|
print(type(note_bodies['issues']))
|
||||||
self.assertIsInstance(note_bodies['issues'], six.string_types)
|
self.assertIsInstance(note_bodies['issues'], str)
|
||||||
ldr = self._make_loader(note_bodies)
|
ldr = self._make_loader(note_bodies)
|
||||||
parse_results = ldr.parse_note_file('note1', None)
|
parse_results = ldr.parse_note_file('note1', None)
|
||||||
self.assertIsInstance(parse_results['issues'], list)
|
self.assertIsInstance(parse_results['issues'], list)
|
||||||
|
@ -13,7 +13,6 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import mock
|
import mock
|
||||||
import six
|
|
||||||
|
|
||||||
from reno.tests import base
|
from reno.tests import base
|
||||||
from reno import utils
|
from reno import utils
|
||||||
@ -28,7 +27,7 @@ class TestGetRandomString(base.TestCase):
|
|||||||
randrange.return_value = ord('a')
|
randrange.return_value = ord('a')
|
||||||
actual = utils.get_random_string()
|
actual = utils.get_random_string()
|
||||||
expected = '61' * 8 # hex for ord('a')
|
expected = '61' * 8 # hex for ord('a')
|
||||||
self.assertIsInstance(actual, six.text_type)
|
self.assertIsInstance(actual, str)
|
||||||
self.assertEqual(expected, actual)
|
self.assertEqual(expected, actual)
|
||||||
|
|
||||||
@mock.patch('random.randrange')
|
@mock.patch('random.randrange')
|
||||||
@ -38,5 +37,5 @@ class TestGetRandomString(base.TestCase):
|
|||||||
randrange.return_value = ord('a')
|
randrange.return_value = ord('a')
|
||||||
actual = utils.get_random_string()
|
actual = utils.get_random_string()
|
||||||
expected = '62' * 8 # hex for ord('b')
|
expected = '62' * 8 # hex for ord('b')
|
||||||
self.assertIsInstance(actual, six.text_type)
|
self.assertIsInstance(actual, str)
|
||||||
self.assertEqual(expected, actual)
|
self.assertEqual(expected, actual)
|
||||||
|
@ -23,11 +23,11 @@ LOG = logging.getLogger(__name__)
|
|||||||
def get_random_string(nbytes=8):
|
def get_random_string(nbytes=8):
|
||||||
"""Return a fixed-length random string
|
"""Return a fixed-length random string
|
||||||
|
|
||||||
:rtype: six.text_type
|
:rtype: str
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
# NOTE(dhellmann): Not all systems support urandom().
|
# NOTE(dhellmann): Not all systems support urandom().
|
||||||
# hexlify returns six.binary_type, decode to convert to six.text_type.
|
# hexlify returns binary, decode to convert to str.
|
||||||
val = binascii.hexlify(os.urandom(nbytes)).decode('utf-8')
|
val = binascii.hexlify(os.urandom(nbytes)).decode('utf-8')
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print('ERROR, perhaps urandom is not supported: %s' % e)
|
print('ERROR, perhaps urandom is not supported: %s' % e)
|
||||||
|
@ -4,5 +4,4 @@
|
|||||||
|
|
||||||
pbr
|
pbr
|
||||||
PyYAML>=3.10
|
PyYAML>=3.10
|
||||||
six>=1.9.0
|
|
||||||
dulwich>=0.15.0 # Apache-2.0
|
dulwich>=0.15.0 # Apache-2.0
|
||||||
|
Loading…
Reference in New Issue
Block a user