Skip to content

Commit

Permalink
Support tox4, update style to match Black 23.1a1
Browse files Browse the repository at this point in the history
This aligns code with psf/black#3302

Depends-On: https://review.opendev.org/866943
Change-Id: Icfbca2fab8adeb677b980d01f797f194f580838e
  • Loading branch information
dalees committed Jan 4, 2023
1 parent a84d0da commit 6b1856b
Show file tree
Hide file tree
Showing 27 changed files with 1 addition and 44 deletions.
1 change: 0 additions & 1 deletion adjutant/actions/migrations/0001_initial.py
Expand Up @@ -6,7 +6,6 @@


class Migration(migrations.Migration):

dependencies = [
("api", "0001_initial"),
]
Expand Down
1 change: 0 additions & 1 deletion adjutant/actions/migrations/0002_action_auto_approve.py
Expand Up @@ -4,7 +4,6 @@


class Migration(migrations.Migration):

dependencies = [
("actions", "0001_initial"),
]
Expand Down
1 change: 0 additions & 1 deletion adjutant/actions/migrations/0003_auto_20190610_0205.py
Expand Up @@ -5,7 +5,6 @@


class Migration(migrations.Migration):

dependencies = [
("actions", "0002_action_auto_approve"),
]
Expand Down
1 change: 0 additions & 1 deletion adjutant/actions/migrations/0004_auto_20190610_0209.py
Expand Up @@ -6,7 +6,6 @@


class Migration(migrations.Migration):

dependencies = [
("tasks", "0001_initial"),
("actions", "0003_auto_20190610_0205"),
Expand Down
Expand Up @@ -4,7 +4,6 @@


class Migration(migrations.Migration):

dependencies = [
("actions", "0004_auto_20190610_0209"),
]
Expand Down
1 change: 0 additions & 1 deletion adjutant/actions/v1/misc.py
Expand Up @@ -100,7 +100,6 @@ def _build_default_email_group(group_name):


class SendAdditionalEmailAction(BaseAction):

serializer = serializers.SendAdditionalEmailSerializer

config_group = groups.DynamicNameConfigGroup(
Expand Down
1 change: 0 additions & 1 deletion adjutant/actions/v1/resources.py
Expand Up @@ -294,7 +294,6 @@ class UpdateProjectQuotasAction(BaseAction, QuotaMixin):
)

def _get_email(self):

if CONF.identity.username_is_email:
return self.action.task.keystone_user["username"]
else:
Expand Down
1 change: 0 additions & 1 deletion adjutant/actions/v1/users.py
Expand Up @@ -322,7 +322,6 @@ def _validate_user_roles(self):
return True

def _validate_role_permissions(self):

id_manager = user_store.IdentityManager()

current_user_roles = id_manager.get_roles(
Expand Down
1 change: 0 additions & 1 deletion adjutant/api/migrations/0001_initial.py
Expand Up @@ -7,7 +7,6 @@


class Migration(migrations.Migration):

dependencies = []

operations = [
Expand Down
1 change: 0 additions & 1 deletion adjutant/api/migrations/0002_auto_20160815_2249.py
Expand Up @@ -4,7 +4,6 @@


class Migration(migrations.Migration):

dependencies = [
("api", "0001_initial"),
]
Expand Down
1 change: 0 additions & 1 deletion adjutant/api/migrations/0003_task_approved_by.py
Expand Up @@ -5,7 +5,6 @@


class Migration(migrations.Migration):

dependencies = [
("api", "0002_auto_20160815_2249"),
]
Expand Down
1 change: 0 additions & 1 deletion adjutant/api/migrations/0004_auto_20160929_0317.py
Expand Up @@ -4,7 +4,6 @@


class Migration(migrations.Migration):

dependencies = [
("api", "0003_task_approved_by"),
]
Expand Down
1 change: 0 additions & 1 deletion adjutant/api/migrations/0005_auto_20190610_0209.py
Expand Up @@ -5,7 +5,6 @@


class Migration(migrations.Migration):

atomic = False

dependencies = [
Expand Down
1 change: 0 additions & 1 deletion adjutant/api/migrations/0006_auto_20190610_0209.py
Expand Up @@ -6,7 +6,6 @@


class Migration(migrations.Migration):

dependencies = [
("tasks", "0001_initial"),
("actions", "0003_auto_20190610_0205"),
Expand Down
1 change: 0 additions & 1 deletion adjutant/api/migrations/0007_auto_20190610_0209.py
Expand Up @@ -6,7 +6,6 @@


class Migration(migrations.Migration):

dependencies = [
("tasks", "0001_initial"),
("actions", "0003_auto_20190610_0205"),
Expand Down
1 change: 0 additions & 1 deletion adjutant/api/migrations/0008_auto_20190610_0209.py
Expand Up @@ -5,7 +5,6 @@


class Migration(migrations.Migration):

dependencies = [
("api", "0005_auto_20190610_0209"),
("tasks", "0001_initial"),
Expand Down
5 changes: 0 additions & 5 deletions adjutant/api/v1/openstack.py
Expand Up @@ -29,7 +29,6 @@


class UserList(tasks.InviteUser):

url = r"^openstack/users/?$"

config_group = groups.DynamicNameConfigGroup(
Expand Down Expand Up @@ -176,7 +175,6 @@ def get(self, request):


class UserDetail(BaseDelegateAPI):

url = r"^openstack/users/(?P<user_id>\w+)/?$"

config_group = groups.DynamicNameConfigGroup(
Expand Down Expand Up @@ -263,7 +261,6 @@ def delete(self, request, user_id):


class UserRoles(BaseDelegateAPI):

url = r"^openstack/users/(?P<user_id>\w+)/roles/?$"

config_group = groups.DynamicNameConfigGroup(
Expand Down Expand Up @@ -338,7 +335,6 @@ def _edit_user(self, request, user_id, remove_role=False, format=None):


class RoleList(BaseDelegateAPI):

url = r"^openstack/roles/?$"

@utils.mod_or_admin
Expand Down Expand Up @@ -490,7 +486,6 @@ def get(self, request):

@utils.mod_or_admin
def post(self, request):

request.data["project_id"] = request.keystone_user["project_id"]
self.project_id = request.keystone_user["project_id"]

Expand Down
5 changes: 0 additions & 5 deletions adjutant/api/v1/tasks.py
Expand Up @@ -29,7 +29,6 @@


class CreateProjectAndUser(BaseDelegateAPI):

url = r"^actions/CreateProjectAndUser/?$"

config_group = groups.DynamicNameConfigGroup(
Expand Down Expand Up @@ -84,7 +83,6 @@ def post(self, request, format=None):


class InviteUser(BaseDelegateAPI):

url = r"^actions/InviteUser/?$"

task_type = "invite_user_to_project"
Expand Down Expand Up @@ -118,7 +116,6 @@ def post(self, request, format=None):


class ResetPassword(BaseDelegateAPI):

url = r"^actions/ResetPassword/?$"

task_type = "reset_user_password"
Expand Down Expand Up @@ -164,7 +161,6 @@ def post(self, request, format=None):


class EditUser(BaseDelegateAPI):

url = r"^actions/EditUser/?$"

task_type = "edit_user_roles"
Expand All @@ -186,7 +182,6 @@ def post(self, request, format=None):


class UpdateEmail(BaseDelegateAPI):

url = r"^actions/UpdateEmail/?$"

task_type = "update_user_email"
Expand Down
4 changes: 0 additions & 4 deletions adjutant/api/v1/tests/test_api_taskview.py
Expand Up @@ -860,7 +860,6 @@ def test_update_email_task_send_email_current_name_not_email(self):
self.assertEqual(len(mail.outbox), 3)

def test_update_email_task_invalid_email(self):

user = fake_clients.FakeUser(
name="test@example.com", password="123", email="test@example.com"
)
Expand Down Expand Up @@ -897,7 +896,6 @@ def test_update_email_task_invalid_email(self):
},
)
def test_update_email_pre_existing_user_with_email(self):

user = fake_clients.FakeUser(
name="test@example.com", password="123", email="test@example.com"
)
Expand Down Expand Up @@ -940,7 +938,6 @@ def test_update_email_pre_existing_user_with_email(self):
},
)
def test_update_email_user_with_email_username_not_email(self):

user = fake_clients.FakeUser(
name="test", password="123", email="test@example.com"
)
Expand Down Expand Up @@ -1006,7 +1003,6 @@ def test_update_email_task_not_authenticated(self):
},
)
def test_update_email_task_username_not_email(self):

user = fake_clients.FakeUser(
name="test_user", password="123", email="test@example.com"
)
Expand Down
1 change: 0 additions & 1 deletion adjutant/api/views.py
Expand Up @@ -48,7 +48,6 @@ class SingleVersionView(APIView):
"""

def get(self, request):

version = _VERSIONS.get(self.version, {}).copy()
if not version:
return Response({"error": "Not Found"}, status=404)
Expand Down
1 change: 0 additions & 1 deletion adjutant/common/openstack_clients.py
Expand Up @@ -42,7 +42,6 @@ def get_auth_session():
"""Returns a global auth session to be shared by all clients"""
global client_auth_session
if not client_auth_session:

auth = v3.Password(
username=CONF.identity.auth.username,
password=CONF.identity.auth.password,
Expand Down
4 changes: 0 additions & 4 deletions adjutant/common/tests/fake_clients.py
Expand Up @@ -217,7 +217,6 @@ def list_users(self, project):

for assignment in identity_cache["role_assignments"]:
if assignment.scope["project"]["id"] == project.id:

user = users.get(assignment.user["id"])
if not user:
user = self.get_user(assignment.user["id"])
Expand Down Expand Up @@ -315,7 +314,6 @@ def get_roles(self, user, project, inherited=False):
assignment.user["id"] == user.id
and assignment.scope["project"]["id"] == project.id
):

if (
assignment.scope.get("OS-INHERIT:inherited_to") and not inherited
) or (
Expand Down Expand Up @@ -735,13 +733,11 @@ def __getattr__(self, name):

class FakeTroveClient(object):
class FakeTroveQuotaManager(object):

FakeTroveResource = namedtuple(
"FakeTroveResource", ["resource", "in_use", "reserved", "limit"]
)

def __init__(self, region):

global trove_cache
self.region = region
if region not in trove_cache:
Expand Down
1 change: 0 additions & 1 deletion adjutant/common/user_store.py
Expand Up @@ -143,7 +143,6 @@ def list_inherited_users(self, project):
def create_user(
self, name, password, email, created_on, domain=None, default_project=None
):

user = self.ks_client.users.create(
name=name,
password=password,
Expand Down
1 change: 0 additions & 1 deletion adjutant/tasks/migrations/0001_initial.py
Expand Up @@ -8,7 +8,6 @@


class Migration(migrations.Migration):

dependencies = [
("api", "0005_auto_20190610_0209"),
]
Expand Down
1 change: 0 additions & 1 deletion adjutant/tasks/migrations/0002_auto_20190619_0613.py
Expand Up @@ -6,7 +6,6 @@


class Migration(migrations.Migration):

dependencies = [
("tasks", "0001_initial"),
]
Expand Down
3 changes: 0 additions & 3 deletions adjutant/tasks/v1/base.py
Expand Up @@ -28,7 +28,6 @@


def make_task_config(task_class):

config_group = groups.DynamicNameConfigGroup()
config_group.register_child_config(
fields.BoolConfig(
Expand Down Expand Up @@ -245,7 +244,6 @@ def _create_task_hash(self, action_list):
return hashlib.sha256(str(hashable_list).encode("utf-8")).hexdigest()

def _handle_duplicates(self, hash_key):

duplicate_tasks = Task.objects.filter(
hash_key=hash_key, completed=0, cancelled=0
)
Expand Down Expand Up @@ -468,7 +466,6 @@ def clear_tokens(self):
token.delete()

def submit(self, token_data=None, keystone_user=None):

self.confirm_state(approved=True, completed=False, cancelled=False)

required_fields = set()
Expand Down
3 changes: 1 addition & 2 deletions tox.ini
@@ -1,6 +1,5 @@
[tox]
envlist = py3,pep8,black_check,cover_report
skipsdist = True
minversion = 3.1.1
ignore_basepython_conflict = True

Expand All @@ -15,7 +14,7 @@ commands =
find adjutant -type f -name "*.pyc" -delete
adjutant-api test {posargs}
setenv = VIRTUAL_ENV={envdir}
whitelist_externals =
allowlist_externals =
find

[testenv:pep8]
Expand Down

0 comments on commit 6b1856b

Please sign in to comment.