Remove six

Remove six Replace the following items with Python 3 style code.
- six.moves
- six.text_type

Story: 2008305
Task: 41415
Change-Id: I072c09691e7f72f87a35eca4b748cedab3635fd8
This commit is contained in:
wangzihao 2020-12-14 15:19:06 +08:00
parent e3bfafdeb6
commit 576b650f60
3 changed files with 8 additions and 11 deletions

View File

@ -21,7 +21,6 @@ import threading
import time
from oslo_log import log
from six import moves
import ceilometer
from ceilometer import monasca_client as mon_client
@ -200,7 +199,7 @@ class MonascaPublisher(publisher.ConfigPublisherBase):
# Iterate over the retry_queue to eliminate
# metrics that have maxed out their retry attempts
for ctr in moves.xrange(retry_count):
for ctr in range(retry_count):
if self.retry_counter[ctr] > self.conf.monasca.max_retries:
if hasattr(self, 'archive_handler'):
self.archive_handler.publish_samples(

View File

@ -19,7 +19,6 @@ import datetime
from jsonpath_rw_ext import parser
from oslo_log import log
from oslo_utils import timeutils
import six
import yaml
from ceilometer import sample as sample_util
@ -135,7 +134,7 @@ class MonascaDataFilter(object):
if len(val_matches) > 0:
# resolve the find to the first match and get value
val = val_matches[0].value
if not isinstance(val, (str, six.text_type)) \
if not isinstance(val, str) \
and not isinstance(val, int):
# Don't support lists or dicts or ...
raise CeiloscaMappingDefinitionException(

View File

@ -25,7 +25,6 @@ import oslo_messaging as messaging
from oslo_messaging import notify # noqa
from oslo_messaging import rpc # noqa
from oslo_utils import timeutils
import six
LOG = logging.getLogger()
@ -210,8 +209,8 @@ def notifier(_id, transport, messages, wait_after_msg, timeout,
def _volume_payload(project_id, resource_id, load_date):
return {'user_id': u'abcd_01234_dcba',
'tenant_id': six.text_type(project_id),
'volume_id': six.text_type(resource_id),
'tenant_id': str(project_id),
'volume_id': str(resource_id),
'size': 1024,
'availablity_zone': u'nova',
'display_name': u'simulator',
@ -232,14 +231,14 @@ def _instance_payload(project_id, resource_id, load_date):
'type': u'fixed',
'version': 4}],
'image_ref_url': u'http://10.0.2.15:9292/images/UUID',
'instance_id': six.text_type(resource_id),
'instance_id': str(resource_id),
'instance_type': u'm1.xlarge',
'instance_type_id': 2,
'launched_at': load_date + str(timeutils.utcnow())[-15:-7],
'memory_mb': 512,
'state': u'active',
'state_description': u'',
'tenant_id': six.text_type(project_id),
'tenant_id': str(project_id),
'user_id': u'abcd_01234_dcba',
'reservation_id': u'1e3ce043029547f1a61c1996d1a531a3',
'vcpus': 10,
@ -256,7 +255,7 @@ def _instance_payload(project_id, resource_id, load_date):
def _image_payload(project_id, resource_id, load_date):
return {'id': six.text_type(resource_id),
return {'id': str(resource_id),
'name': u'myImage',
'status': u'active',
'created_at': load_date + str(timeutils.utcnow())[-15:-7],
@ -265,7 +264,7 @@ def _image_payload(project_id, resource_id, load_date):
'min_ram': 4096,
'protected': u'',
'checksum': u'',
'owner': six.text_type(project_id),
'owner': str(project_id),
'disk_format': u'',
'container_format': u'',
'size': 1000000,