Skip to content

Commit

Permalink
Ruff 0.8.0 failures (#2371)
Browse files Browse the repository at this point in the history
* unpin ruff
* extend ignore
* fix A004
* fix UP006
* fix UP031
* fix UP035
* fix RUF022
  • Loading branch information
jerabekjiri authored Nov 26, 2024
1 parent 4bed70a commit fc573b7
Show file tree
Hide file tree
Showing 22 changed files with 150 additions and 163 deletions.
2 changes: 1 addition & 1 deletion galaxy_ng/app/api/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def _handle_drf_api_exception(exc):
if getattr(exc, 'auth_header', None):
headers['WWW-Authenticate'] = exc.auth_header
if getattr(exc, 'wait', None):
headers['Retry-After'] = '%d' % exc.wait
headers['Retry-After'] = str(exc.wait)

title = exc.__class__.default_detail
errors = _get_errors(exc.detail, status=exc.status_code, title=title)
Expand Down
30 changes: 15 additions & 15 deletions galaxy_ng/app/api/ui/v1/serializers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,29 +37,29 @@
)

__all__ = (
# auth
'LoginSerializer',
# collection
'CollectionDetailSerializer',
'CollectionListSerializer',
'CollectionVersionSerializer',
'CollectionVersionDetailSerializer',
'CollectionVersionBaseSerializer',
# imports
'ImportTaskDetailSerializer',
'ImportTaskListSerializer',
'CollectionVersionDetailSerializer',
'CollectionVersionSerializer',
# container
'ContainerRegistryRemoteSerializer',
'ContainerRemoteSerializer',
# current_user
'CurrentUserSerializer',
# user
'UserSerializer',
# synclist
'SyncListSerializer',
'SyncListCollectionSummarySerializer',
# distribution
'DistributionSerializer',
# container
'ContainerRegistryRemoteSerializer',
'ContainerRemoteSerializer',
# imports
'ImportTaskDetailSerializer',
'ImportTaskListSerializer',
# auth
'LoginSerializer',
# Search
'SearchResultsSerializer',
'SyncListCollectionSummarySerializer',
# synclist
'SyncListSerializer',
# user
'UserSerializer',
)
43 changes: 17 additions & 26 deletions galaxy_ng/app/api/ui/v1/views/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,37 +25,28 @@


__all__ = (
# auth
"LoginView",
"LogoutView",

# feature_flags
"FeatureFlagsView",

# controller
"ControllerListView",

# settings
"SettingsView",

# landing_page
"LandingPageView",

# AI/Wisdom
"AIDenyIndexAddView",
"AIDenyIndexDetailView",
"AIDenyIndexListView",
# Signing
"CollectionSignView",
# sync
"ContainerSyncRegistryView",

# controller
"ControllerListView",
# feature_flags
"FeatureFlagsView",
# index_execution_environments
"IndexRegistryEEView",

# Signing
"CollectionSignView",

# AI/Wisdom
"AIDenyIndexAddView",
"AIDenyIndexListView",
"AIDenyIndexDetailView",

# landing_page
"LandingPageView",
# auth
"LoginView",
"LogoutView",
# Search
"SearchListView",
# settings
"SettingsView",

)
2 changes: 1 addition & 1 deletion galaxy_ng/app/api/ui/v1/views/feature_flags.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def _load_conditional_signing_flags(flags):
# Is the system enabled to accept signature uploads?
can_upload = flags.setdefault(
"can_upload_signatures",
enabled and require_upload or bool(settings.get("GALAXY_SIGNATURE_UPLOAD_ENABLED"))
(enabled and require_upload) or bool(settings.get("GALAXY_SIGNATURE_UPLOAD_ENABLED"))
)

# Is the system configured with a Signing Service to create signatures?
Expand Down
28 changes: 14 additions & 14 deletions galaxy_ng/app/api/ui/v1/viewsets/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,24 +26,24 @@
)

__all__ = (
'NamespaceViewSet',
'MyNamespaceViewSet',
'MySyncListViewSet',
'CollectionViewSet',
'CollectionVersionViewSet',
'APIRootView',
'CollectionImportViewSet',
'CollectionRemoteViewSet',
'TagsViewSet',
'CollectionVersionViewSet',
'CollectionViewSet',
'CollectionsTagsViewSet',
'RolesTagsViewSet',
'ContainerRegistryRemoteViewSet',
'ContainerRemoteViewSet',
'CurrentUserViewSet',
'UserViewSet',
'SyncListViewSet',
'APIRootView',
'GroupViewSet',
'GroupUserViewSet',
'DistributionViewSet',
'GroupUserViewSet',
'GroupViewSet',
'MyDistributionViewSet',
'ContainerRegistryRemoteViewSet',
'ContainerRemoteViewSet',
'MyNamespaceViewSet',
'MySyncListViewSet',
'NamespaceViewSet',
'RolesTagsViewSet',
'SyncListViewSet',
'TagsViewSet',
'UserViewSet',
)
10 changes: 5 additions & 5 deletions galaxy_ng/app/api/v1/viewsets/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@


__all__ = (
"LegacyNamespacesViewSet",
"LegacyNamespaceOwnersViewSet",
"LegacyNamespaceProvidersViewSet",
"LegacyUsersViewSet",
"LegacyRolesViewSet",
"LegacyRolesSyncViewSet",
"LegacyNamespacesViewSet",
"LegacyRoleContentViewSet",
"LegacyRoleVersionsViewSet",
"LegacyRoleImportsViewSet",
"LegacyRoleVersionsViewSet",
"LegacyRolesSyncViewSet",
"LegacyRolesViewSet",
"LegacyUsersViewSet",
)
18 changes: 9 additions & 9 deletions galaxy_ng/app/api/v3/serializers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,19 @@
__all__ = (
# collection
"CollectionUploadSerializer",
"ContainerManifestDetailSerializer",
"ContainerManifestSerializer",
"ContainerReadmeSerializer",
"ContainerRepositoryHistorySerializer",
# execution_environment
"ContainerRepositorySerializer",
"ContainerTagSerializer",
# group
"GroupSummarySerializer",
# namespace
"NamespaceSerializer",
"NamespaceSummarySerializer",
# group
"GroupSummarySerializer",
# task
"TaskSerializer",
"TaskSummarySerializer",
# execution_environment
"ContainerRepositorySerializer",
"ContainerTagSerializer",
"ContainerManifestSerializer",
"ContainerManifestDetailSerializer",
"ContainerReadmeSerializer",
"ContainerRepositoryHistorySerializer",
)
4 changes: 2 additions & 2 deletions galaxy_ng/app/api/v3/serializers/execution_environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,9 @@ def get_pulp(self, distro):
remote = ui_serializers.ContainerRemoteSerializer(
repo.remote.cast(), context=self.context).data

sign_state = repo.content.filter(
sign_state = (repo.content.filter(
pulp_type="container.signature"
).count() > 0 and "signed" or "unsigned"
).count() > 0 and "signed") or "unsigned"

return {
"repository": {
Expand Down
4 changes: 2 additions & 2 deletions galaxy_ng/app/api/v3/serializers/task.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import logging
from typing import Any, Dict, Optional
from typing import Any, Optional
from rest_framework import serializers
from rest_framework.reverse import reverse
from drf_spectacular.utils import extend_schema_field
Expand All @@ -21,7 +21,7 @@ class TaskSerializer(serializers.ModelSerializer):
started_at = serializers.DateTimeField()
finished_at = serializers.DateTimeField()

@extend_schema_field(Optional[Dict[str, Any]])
@extend_schema_field(Optional[dict[str, Any]])
def get_worker(self, obj):
if obj.worker:
return {
Expand Down
2 changes: 1 addition & 1 deletion galaxy_ng/app/api/v3/views/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
from .sync import ContainerSyncRemoteView


__all__ = ("TokenView", "SyncRemoteView", "ExcludesView", "NotFoundView", "ContainerSyncRemoteView")
__all__ = ("ContainerSyncRemoteView", "ExcludesView", "NotFoundView", "SyncRemoteView", "TokenView")
4 changes: 2 additions & 2 deletions galaxy_ng/app/api/v3/views/excludes.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ def get_synclist_excludes(base_path):

def serialize_collection_queryset(queryset):
"""Serialize a Queryset in to a JSONable format."""
return queryset is not None and [
return (queryset is not None and [
{
"name": "{collection.namespace}.{collection.name}".format(collection=collection)
}
for collection in queryset.all()
] or []
]) or []


class RequirementsFileRenderer(BaseRenderer):
Expand Down
18 changes: 9 additions & 9 deletions galaxy_ng/app/api/v3/viewsets/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,18 @@
# collection
"CollectionArtifactDownloadView",
"CollectionUploadViewSet",
"CollectionVersionMoveViewSet",
"CollectionVersionCopyViewSet",
"CollectionVersionMoveViewSet",
"ContainerReadmeViewSet",
"ContainerRepositoryHistoryViewSet",
"ContainerRepositoryManifestViewSet",
# execution_environments
"ContainerRepositoryViewSet",
"ContainerTagViewset",
# namespace
"NamespaceViewSet",
# task
"TaskViewSet",
# sync
"SyncConfigViewSet",
# execution_environments
"ContainerRepositoryViewSet",
"ContainerRepositoryManifestViewSet",
"ContainerRepositoryHistoryViewSet",
"ContainerReadmeViewSet",
"ContainerTagViewset",
# task
"TaskViewSet",
)
Loading

0 comments on commit fc573b7

Please sign in to comment.