diff --git a/adjutant/actions/v1/resources.py b/adjutant/actions/v1/resources.py index a723bba..1c4f360 100644 --- a/adjutant/actions/v1/resources.py +++ b/adjutant/actions/v1/resources.py @@ -16,8 +16,6 @@ from adjutant.actions.v1.base import BaseAction, ProjectMixin from django.conf import settings from adjutant.actions import openstack_clients, user_store -import six - class NewDefaultNetworkAction(BaseAction, ProjectMixin): """ @@ -294,7 +292,7 @@ class SetProjectQuotaAction(BaseAction): # update quota for each openstack service regions_dict = self.settings.get('regions', {}) - for region_name, region_settings in six.iteritems(regions_dict): + for region_name, region_settings in regions_dict.items(): quota_size = region_settings.get('quota_size') quota_settings = settings.PROJECT_QUOTA_SIZES.get(quota_size, {}) if not quota_settings: @@ -302,7 +300,7 @@ class SetProjectQuotaAction(BaseAction): "Project quota not defined for size '%s' in region %s." % ( quota_size, region_name)) continue - for service_name, values in six.iteritems(quota_settings): + for service_name, values in quota_settings.items(): updater_class = self._quota_updaters.get(service_name) if not updater_class: self.add_note("No quota updater found for %s. Ignoring" % diff --git a/adjutant/actions/v1/users.py b/adjutant/actions/v1/users.py index 34f5ef3..c73d8a8 100644 --- a/adjutant/actions/v1/users.py +++ b/adjutant/actions/v1/users.py @@ -15,8 +15,6 @@ from django.conf import settings from django.db import models -import six - from adjutant.actions import user_store from adjutant.actions.v1.base import ( UserNameAction, UserIdAction, UserMixin, ProjectMixin) @@ -177,7 +175,7 @@ class ResetUserPasswordAction(UserNameAction, UserMixin): roles = id_manager.get_all_roles(self.user) user_roles = [] - for roles in six.itervalues(roles): + for roles in roles.values(): user_roles.extend(role.name for role in roles) if set(self.blacklist) & set(user_roles): diff --git a/adjutant/api/v1/tests/__init__.py b/adjutant/api/v1/tests/__init__.py index ec906c7..4980944 100644 --- a/adjutant/api/v1/tests/__init__.py +++ b/adjutant/api/v1/tests/__init__.py @@ -15,7 +15,6 @@ import mock import copy -import six from django.conf import settings from django.test.utils import override_settings @@ -110,7 +109,7 @@ class FakeManager(object): roles = temp_cache['projects'][project.name].roles users = [] - for user_id, user_roles in six.iteritems(roles): + for user_id, user_roles in roles.items(): user = self.get_user(user_id) user.roles = [] @@ -248,7 +247,7 @@ class FakeManager(object): def update_project(self, project, **kwargs): project = self._project_from_id(project) - for key, arg in six.iteritems(kwargs): + for key, arg in kwargs.items(): if arg is not None: setattr(project, key, arg) return project @@ -319,7 +318,7 @@ class modify_dict_settings(override_settings): self.operations = args[0] else: assert not args - self.operations = list(six.iteritems(kwargs)) + self.operations = list(kwargs.items()) super(override_settings, self).__init__() def save_options(self, test_func): diff --git a/adjutant/api/v1/utils.py b/adjutant/api/v1/utils.py index 980bcb5..2105cf6 100644 --- a/adjutant/api/v1/utils.py +++ b/adjutant/api/v1/utils.py @@ -14,7 +14,6 @@ import hashlib import json -import six from datetime import timedelta from smtplib import SMTPException @@ -162,8 +161,7 @@ def create_notification(task, notes, error=False, engines=True): class_conf = settings.TASK_SETTINGS.get( task.task_type, settings.DEFAULT_TASK_SETTINGS) - for note_engine, conf in six.iteritems( - class_conf.get('notifications', {})): + for note_engine, conf in (class_conf.get('notifications', {})).items(): if error: conf = conf.get('error', {}) else: @@ -215,8 +213,8 @@ def parse_filters(func, *args, **kwargs): cleaned_filters = {} try: filters = json.loads(filters) - for field, operations in six.iteritems(filters): - for operation, value in six.iteritems(operations): + for field, operations in filters.items(): + for operation, value in operations.items(): cleaned_filters['%s__%s' % (field, operation)] = value except (ValueError, AttributeError): return Response( diff --git a/adjutant/utils.py b/adjutant/utils.py index ff67245..7592550 100644 --- a/adjutant/utils.py +++ b/adjutant/utils.py @@ -12,7 +12,6 @@ # License for the specific language governing permissions and limitations # under the License. -import six from copy import deepcopy @@ -27,7 +26,7 @@ def dict_merge(a, b): if not isinstance(b, dict): return b result = deepcopy(a) - for k, v in six.iteritems(b): + for k, v in b.items(): if k in result and isinstance(result[k], dict): result[k] = dict_merge(result[k], v) else: @@ -41,7 +40,7 @@ def setup_task_settings(task_defaults, action_defaults, task_settings): settings for each task_type. """ new_task_settings = {} - for task, settings in six.iteritems(task_settings): + for task, settings in task_settings.items(): task_setting = deepcopy(task_defaults) task_setting['action_settings'] = deepcopy(action_defaults) new_task_settings[task] = dict_merge(task_setting, settings)