Skip to content

Commit 208e78a

Browse files
Zuulopenstack-gerrit
authored andcommitted
Merge "Remove six"
2 parents bf0e5b9 + 335aa96 commit 208e78a

File tree

34 files changed

+73
-129
lines changed

34 files changed

+73
-129
lines changed

HACKING.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ Cloudkitty Specific Commandments
1414
- [C312] Use assertTrue(...) rather than assertEqual(True, ...).
1515
- [C313] Validate that logs are not translated.
1616
- [C314] str() and unicode() cannot be used on an exception.
17-
Remove or use six.text_type().
1817
- [C315] Translated messages cannot be concatenated. String should be
1918
included in translated message.
2019
- [C317] `oslo_` should be used instead of `oslo.`

cloudkitty/api/v1/controllers/collector.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
from oslo_log import log as logging
1717
import pecan
1818
from pecan import rest
19-
import six
2019
from wsme import types as wtypes
2120
import wsmeext.pecan as wsme_pecan
2221

@@ -47,7 +46,7 @@ def get_one(self, service):
4746
return collector_models.ServiceToCollectorMapping(
4847
**mapping.as_dict())
4948
except db_api.NoSuchMapping as e:
50-
pecan.abort(404, six.text_type(e))
49+
pecan.abort(404, e.args[0])
5150

5251
@wsme_pecan.wsexpose(collector_models.ServiceToCollectorMappingCollection,
5352
wtypes.text)
@@ -94,7 +93,7 @@ def delete(self, service):
9493
try:
9594
self._db.delete_mapping(service)
9695
except db_api.NoSuchMapping as e:
97-
pecan.abort(404, six.text_type(e))
96+
pecan.abort(404, e.args[0])
9897

9998

10099
class CollectorStateController(rest.RestController):

cloudkitty/api/v1/controllers/info.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
from oslo_log import log as logging
1818
import pecan
1919
from pecan import rest
20-
import six
2120
import voluptuous
2221
from wsme import types as wtypes
2322
import wsmeext.pecan as wsme_pecan
@@ -70,7 +69,7 @@ def get_one_metric(metric_name):
7069
policy.authorize(pecan.request.context, 'info:get_metric_info', {})
7170
metric = _find_metric(metric_name, metrics_conf)
7271
if not metric:
73-
pecan.abort(404, six.text_type(metric_name))
72+
pecan.abort(404, str(metric_name))
7473
info = metric.copy()
7574
info['metric_id'] = info['alt_name']
7675
return info_models.CloudkittyMetricInfo(**info)

cloudkitty/backend/__init__.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,8 @@
1515
#
1616
import abc
1717

18-
import six
1918

20-
21-
@six.add_metaclass(abc.ABCMeta)
22-
class BaseIOBackend(object):
19+
class BaseIOBackend(object, metaclass=abc.ABCMeta):
2320
def __init__(self, path):
2421
self.open(path)
2522

cloudkitty/collector/__init__.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
from oslo_config import cfg
2020
from oslo_log import log as logging
21-
import six
2221
from stevedore import driver
2322
from voluptuous import All
2423
from voluptuous import Any
@@ -153,8 +152,7 @@ def __init__(self, collector, resource):
153152
self.resource = resource
154153

155154

156-
@six.add_metaclass(abc.ABCMeta)
157-
class BaseCollector(object):
155+
class BaseCollector(object, metaclass=abc.ABCMeta):
158156
collector_name = None
159157

160158
def __init__(self, **kwargs):

cloudkitty/collector/gnocchi.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616
from datetime import timedelta
1717
import requests
1818

19-
import six
20-
2119
from gnocchiclient import auth as gauth
2220
from gnocchiclient import client as gclient
2321
from gnocchiclient import exceptions as gexceptions
@@ -93,7 +91,7 @@
9391
BASIC_AGGREGATION_METHODS.add("rate:%s" % agg)
9492

9593
EXTRA_AGGREGATION_METHODS_FOR_ARCHIVE_POLICY = set(
96-
(str(i) + 'pct' for i in six.moves.range(1, 100)))
94+
(str(i) + 'pct' for i in range(1, 100)))
9795

9896
for agg in list(EXTRA_AGGREGATION_METHODS_FOR_ARCHIVE_POLICY):
9997
EXTRA_AGGREGATION_METHODS_FOR_ARCHIVE_POLICY.add("rate:%s" % agg)
@@ -321,7 +319,7 @@ def _fetch_metric(self, metric_name, start, end,
321319
# FIXME(peschk_l): gnocchiclient seems to be raising a BadRequest
322320
# when it should be raising MetricNotFound
323321
if isinstance(e, gexceptions.BadRequest):
324-
if 'Metrics not found' not in six.text_type(e):
322+
if 'Metrics not found' not in e.args[0]:
325323
raise
326324
LOG.warning('[{scope}] Skipping this metric for the '
327325
'current cycle.'.format(scope=project_id, err=e))

cloudkitty/common/policy.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
from oslo_policy import opts as policy_opts
2424
from oslo_policy import policy
2525
from oslo_utils import excutils
26-
import six
2726

2827
from cloudkitty.common import policies
2928

@@ -53,7 +52,7 @@ def __init__(self, **kwargs):
5352
super(PolicyNotAuthorized, self).__init__(self.msg)
5453

5554
def __unicode__(self):
56-
return six.text_type(self.msg)
55+
return str(self.msg)
5756

5857

5958
def reset():

cloudkitty/db/api.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

1818
from oslo_config import cfg
1919
from oslo_db import api as db_api
20-
import six
2120

2221
_BACKEND_MAPPING = {'sqlalchemy': 'cloudkitty.db.sqlalchemy.api'}
2322
IMPL = db_api.DBAPI.from_config(cfg.CONF,
@@ -30,8 +29,7 @@ def get_instance():
3029
return IMPL
3130

3231

33-
@six.add_metaclass(abc.ABCMeta)
34-
class State(object):
32+
class State(object, metaclass=abc.ABCMeta):
3533
"""Base class for state tracking."""
3634

3735
@abc.abstractmethod
@@ -68,8 +66,7 @@ def set_metadata(self, name, metadata):
6866
"""
6967

7068

71-
@six.add_metaclass(abc.ABCMeta)
72-
class ModuleInfo(object):
69+
class ModuleInfo(object, metaclass=abc.ABCMeta):
7370
"""Base class for module info management."""
7471

7572
@abc.abstractmethod
@@ -114,8 +111,7 @@ def __init__(self, service):
114111
self.service = service
115112

116113

117-
@six.add_metaclass(abc.ABCMeta)
118-
class ServiceToCollectorMapping(object):
114+
class ServiceToCollectorMapping(object, metaclass=abc.ABCMeta):
119115
"""Base class for service to collector mapping."""
120116

121117
@abc.abstractmethod

cloudkitty/fetcher/__init__.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
# under the License.
1515
#
1616
import abc
17-
import six
1817

1918
from oslo_config import cfg
2019

@@ -27,8 +26,7 @@
2726
cfg.CONF.register_opts(fetcher_opts, 'fetcher')
2827

2928

30-
@six.add_metaclass(abc.ABCMeta)
31-
class BaseFetcher(object):
29+
class BaseFetcher(object, metaclass=abc.ABCMeta):
3230
"""CloudKitty tenants fetcher.
3331
3432
Provides Cloudkitty integration with a backend announcing ratable scopes.

cloudkitty/hacking/checks.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
import re
1818

1919
from hacking import core
20-
import six
2120

2221

2322
"""
@@ -150,7 +149,7 @@ def _find_name(self, node):
150149
if obj_name is None:
151150
return None
152151
return obj_name + '.' + method_name
153-
elif isinstance(node, six.string_types):
152+
elif isinstance(node, str):
154153
return node
155154
else: # could be Subscript, Call or many more
156155
return None
@@ -221,7 +220,7 @@ class CheckForStrUnicodeExc(BaseASTChecker):
221220
version = "1.0"
222221

223222
CHECK_DESC = ('C314 str() and unicode() cannot be used on an '
224-
'exception. Remove or use six.text_type()')
223+
'exception. Remove it.')
225224

226225
def __init__(self, tree, filename):
227226
super(CheckForStrUnicodeExc, self).__init__(tree, filename)

0 commit comments

Comments
 (0)