Skip to content

Commit

Permalink
Enable flake8-commas plugin for ruff (#2334)
Browse files Browse the repository at this point in the history
  • Loading branch information
cutwater authored Oct 25, 2024
1 parent c18aff0 commit b36d7b0
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 14 deletions.
2 changes: 1 addition & 1 deletion galaxy_ng/app/access_control/statements/pulp.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@
"condition": "has_ansible_repo_perms:ansible.modify_ansible_repo_content"
},
{
"action": ["sync", ],
"action": ["sync"],
"principal": "authenticated",
"effect": "allow",
"condition": [
Expand Down
2 changes: 1 addition & 1 deletion galaxy_ng/app/api/v3/viewsets/namespace.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class NamespaceFilter(filterset.FilterSet):

class Meta:
model = models.Namespace
fields = ('name', 'company',)
fields = ('name', 'company')

def keywords_filter(self, queryset, name, value):

Expand Down
4 changes: 2 additions & 2 deletions galaxy_ng/app/migrations/0029_move_perms_to_roles.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ def get_object_group_permissions(group, Role, GroupRole, ContentType, Permission
if key in objects_with_perms:
objects_with_perms[key].append(permission_id)
else:
objects_with_perms[key] = [permission_id,]
objects_with_perms[key] = [permission_id]

# for each object permission that this group has, map it to a role.
for k in objects_with_perms:
Expand Down Expand Up @@ -302,7 +302,7 @@ def add_object_role_for_users_with_permission(role, permission, UserRole, Conten
user=User.objects.get(pk=user_id),
content_type=ContentType.objects.get(pk=content_type_id),
object_id=object_pk
)),
))
batch_create(UserRole, user_roles)

# Create any remaining roles
Expand Down
2 changes: 1 addition & 1 deletion galaxy_ng/app/tasks/namespaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,6 @@ def _add_namespace_metadata_to_repos(namespace_pk, repo_list):
for pk in repo_list:
add_and_remove(
pk,
add_content_units=[namespace_pk, ],
add_content_units=[namespace_pk],
remove_content_units=[]
)
2 changes: 1 addition & 1 deletion galaxy_ng/tests/integration/api/test_certified_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ def test_synclist_sync(sync_instance_crc, ansible_config):
[{
"namespace": synclist_collection["namespace"],
"name": synclist_collection["name"],
}, ]
}]
)["name"]

perform_sync(pah_client, crc_config, repo=repo)
Expand Down
6 changes: 3 additions & 3 deletions galaxy_ng/tests/unit/api/test_api_ui_auth_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def test_login_csrf_cookie_missing(self):

def test_login_invalid_password(self):
response: Response = self.client.post(
self.login_url, data={"username": "test1", "password": "invalid", }
self.login_url, data={"username": "test1", "password": "invalid"}
)
self.assertEqual(response.status_code, http_code.HTTP_403_FORBIDDEN)

Expand All @@ -62,7 +62,7 @@ def test_login_invalid_password(self):

def test_login_wrong_password(self):
response: Response = self.client.post(
self.login_url, data={"username": "test2", "password": "test1-secret", }
self.login_url, data={"username": "test2", "password": "test1-secret"}
)
self.assertEqual(response.status_code, http_code.HTTP_403_FORBIDDEN)

Expand Down Expand Up @@ -104,7 +104,7 @@ def test_login_empty_password(self):

def test_logout(self):
response: Response = self.client.post(
self.login_url, data={"username": "test1", "password": "test1-secret", }
self.login_url, data={"username": "test1", "password": "test1-secret"}
)
self.assertEqual(response.status_code, http_code.HTTP_204_NO_CONTENT)

Expand Down
2 changes: 1 addition & 1 deletion galaxy_ng/tests/unit/api/test_api_ui_container_remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def setUp(self):
self.container_group = self._create_group(
"",
"container_group",
users=[self.container_user, ],
users=[self.container_user],
roles=roles
)

Expand Down
8 changes: 4 additions & 4 deletions profiles/community/github_mock/flaskapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def create_tables():
for uinfo in USERS.values():
sql = "INSERT OR IGNORE INTO users (id, login, email, password) VALUES(?, ?, ?, ?)"
print(sql)
cursor.execute(sql, (uinfo['id'], uinfo['login'], uinfo['email'], uinfo['password'],))
cursor.execute(sql, (uinfo['id'], uinfo['login'], uinfo['email'], uinfo['password']))
conn.commit()

cursor.execute('''
Expand Down Expand Up @@ -430,7 +430,7 @@ def admin_add_user():
print(f'CREATING USER {login} with {password}')
sql = "INSERT OR IGNORE INTO users (id, login, email, password) VALUES(?, ?, ?, ?)"
print(sql)
cursor.execute(sql, (userid, login, email, password,))
cursor.execute(sql, (userid, login, email, password))
conn.commit()

conn.close()
Expand Down Expand Up @@ -502,7 +502,7 @@ def admin_modify_user(userid=None, login=None):
conn.commit()
cursor.execute(
'INSERT INTO users (id, login, password) VALUES (?,?,?)',
(new_userid, new_login, new_password,)
(new_userid, new_login, new_password)
)
conn.commit()
conn.close()
Expand All @@ -512,7 +512,7 @@ def admin_modify_user(userid=None, login=None):
cursor = conn.cursor()
cursor.execute(
'UPDATE users SET login=?, password=? WHERE id=?',
(new_login, new_password, udata['id'],)
(new_login, new_password, udata['id'])
)
conn.commit()
conn.close()
Expand Down
5 changes: 5 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ select = [
"B",
# flake8-comprehensions
"C4",
# flake8-commas
"COM",
# flake8-no-pep420
"INP",
# pyupgrade
Expand All @@ -128,6 +130,9 @@ extend-ignore = [
# B904 requires using `raise ... from ...` to explicitly tell what to do with "parent"
# exception. Would be nice to fix, but ignoring for now.
"B904",
# COM812 Trailing comma missing
# Too many changes to enforce
"COM812",
# UP032 Use f-string instead of `format` call.
# No need to replace all str.format usage with f-strings in entire codebase.
"UP032",
Expand Down

0 comments on commit b36d7b0

Please sign in to comment.