diff --git a/galaxy_ng/app/api/exceptions.py b/galaxy_ng/app/api/exceptions.py index e57d31d631..e1bd4a64c6 100644 --- a/galaxy_ng/app/api/exceptions.py +++ b/galaxy_ng/app/api/exceptions.py @@ -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) diff --git a/galaxy_ng/app/api/ui/v1/serializers/__init__.py b/galaxy_ng/app/api/ui/v1/serializers/__init__.py index 41277b389d..77f18271da 100644 --- a/galaxy_ng/app/api/ui/v1/serializers/__init__.py +++ b/galaxy_ng/app/api/ui/v1/serializers/__init__.py @@ -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', ) diff --git a/galaxy_ng/app/api/ui/v1/views/__init__.py b/galaxy_ng/app/api/ui/v1/views/__init__.py index 41801572e7..7ece3744ac 100644 --- a/galaxy_ng/app/api/ui/v1/views/__init__.py +++ b/galaxy_ng/app/api/ui/v1/views/__init__.py @@ -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", ) diff --git a/galaxy_ng/app/api/ui/v1/views/feature_flags.py b/galaxy_ng/app/api/ui/v1/views/feature_flags.py index ab77b0565d..36af2048ba 100644 --- a/galaxy_ng/app/api/ui/v1/views/feature_flags.py +++ b/galaxy_ng/app/api/ui/v1/views/feature_flags.py @@ -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? diff --git a/galaxy_ng/app/api/ui/v1/viewsets/__init__.py b/galaxy_ng/app/api/ui/v1/viewsets/__init__.py index fcbc9cfd87..f21c5b8ce3 100644 --- a/galaxy_ng/app/api/ui/v1/viewsets/__init__.py +++ b/galaxy_ng/app/api/ui/v1/viewsets/__init__.py @@ -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', ) diff --git a/galaxy_ng/app/api/v1/viewsets/__init__.py b/galaxy_ng/app/api/v1/viewsets/__init__.py index a839b334e3..5d09205c6c 100644 --- a/galaxy_ng/app/api/v1/viewsets/__init__.py +++ b/galaxy_ng/app/api/v1/viewsets/__init__.py @@ -21,13 +21,13 @@ __all__ = ( - "LegacyNamespacesViewSet", "LegacyNamespaceOwnersViewSet", "LegacyNamespaceProvidersViewSet", - "LegacyUsersViewSet", - "LegacyRolesViewSet", - "LegacyRolesSyncViewSet", + "LegacyNamespacesViewSet", "LegacyRoleContentViewSet", - "LegacyRoleVersionsViewSet", "LegacyRoleImportsViewSet", + "LegacyRoleVersionsViewSet", + "LegacyRolesSyncViewSet", + "LegacyRolesViewSet", + "LegacyUsersViewSet", ) diff --git a/galaxy_ng/app/api/v3/serializers/__init__.py b/galaxy_ng/app/api/v3/serializers/__init__.py index 9b0d83e854..a9cfc2a8ca 100644 --- a/galaxy_ng/app/api/v3/serializers/__init__.py +++ b/galaxy_ng/app/api/v3/serializers/__init__.py @@ -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", ) diff --git a/galaxy_ng/app/api/v3/serializers/execution_environment.py b/galaxy_ng/app/api/v3/serializers/execution_environment.py index 0df204b650..569f9f6b25 100644 --- a/galaxy_ng/app/api/v3/serializers/execution_environment.py +++ b/galaxy_ng/app/api/v3/serializers/execution_environment.py @@ -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": { diff --git a/galaxy_ng/app/api/v3/serializers/task.py b/galaxy_ng/app/api/v3/serializers/task.py index 91b2cf674a..11980135d2 100644 --- a/galaxy_ng/app/api/v3/serializers/task.py +++ b/galaxy_ng/app/api/v3/serializers/task.py @@ -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 @@ -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 { diff --git a/galaxy_ng/app/api/v3/views/__init__.py b/galaxy_ng/app/api/v3/views/__init__.py index d45120e8e2..85a660c178 100644 --- a/galaxy_ng/app/api/v3/views/__init__.py +++ b/galaxy_ng/app/api/v3/views/__init__.py @@ -5,4 +5,4 @@ from .sync import ContainerSyncRemoteView -__all__ = ("TokenView", "SyncRemoteView", "ExcludesView", "NotFoundView", "ContainerSyncRemoteView") +__all__ = ("ContainerSyncRemoteView", "ExcludesView", "NotFoundView", "SyncRemoteView", "TokenView") diff --git a/galaxy_ng/app/api/v3/views/excludes.py b/galaxy_ng/app/api/v3/views/excludes.py index 634a05d1ed..0dfe631e42 100644 --- a/galaxy_ng/app/api/v3/views/excludes.py +++ b/galaxy_ng/app/api/v3/views/excludes.py @@ -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): diff --git a/galaxy_ng/app/api/v3/viewsets/__init__.py b/galaxy_ng/app/api/v3/viewsets/__init__.py index 059488e4b8..236933f60b 100644 --- a/galaxy_ng/app/api/v3/viewsets/__init__.py +++ b/galaxy_ng/app/api/v3/viewsets/__init__.py @@ -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", ) diff --git a/galaxy_ng/app/dynaconf_hooks.py b/galaxy_ng/app/dynaconf_hooks.py index f84f5faf2a..dbc0b725e5 100644 --- a/galaxy_ng/app/dynaconf_hooks.py +++ b/galaxy_ng/app/dynaconf_hooks.py @@ -15,7 +15,7 @@ import logging import os import re -from typing import Any, Dict, List +from typing import Any import ldap import pkg_resources @@ -34,7 +34,7 @@ ) -def post(settings: Dynaconf, run_dynamic: bool = True, run_validate: bool = True) -> Dict[str, Any]: +def post(settings: Dynaconf, run_dynamic: bool = True, run_validate: bool = True) -> dict[str, Any]: """The dynaconf post hook is called after all the settings are loaded and set. Post hook is necessary when a setting key depends conditionally on a previouslys et variable. @@ -82,7 +82,7 @@ def post(settings: Dynaconf, run_dynamic: bool = True, run_validate: bool = True return data -def configure_keycloak(settings: Dynaconf) -> Dict[str, Any]: +def configure_keycloak(settings: Dynaconf) -> dict[str, Any]: """Configure keycloak settings for galaxy. This function returns a dictionary that will be merged to the settings. @@ -209,7 +209,7 @@ def configure_keycloak(settings: Dynaconf) -> Dict[str, Any]: return data -def configure_socialauth(settings: Dynaconf) -> Dict[str, Any]: +def configure_socialauth(settings: Dynaconf) -> dict[str, Any]: """Configure social auth settings for galaxy. This function returns a dictionary that will be merged to the settings. @@ -272,7 +272,7 @@ def configure_socialauth(settings: Dynaconf) -> Dict[str, Any]: return data -def configure_logging(settings: Dynaconf) -> Dict[str, Any]: +def configure_logging(settings: Dynaconf) -> dict[str, Any]: data = { "GALAXY_ENABLE_API_ACCESS_LOG": settings.get( "GALAXY_ENABLE_API_ACCESS_LOG", @@ -370,7 +370,7 @@ def configure_logging(settings: Dynaconf) -> Dict[str, Any]: return data -def configure_cors(settings: Dynaconf) -> Dict[str, Any]: +def configure_cors(settings: Dynaconf) -> dict[str, Any]: """This adds CORS Middleware, useful to access swagger UI on dev environment""" if os.getenv("DEV_SOURCE_PATH", None) is None: @@ -384,7 +384,7 @@ def configure_cors(settings: Dynaconf) -> Dict[str, Any]: return data -def configure_pulp_ansible(settings: Dynaconf) -> Dict[str, Any]: +def configure_pulp_ansible(settings: Dynaconf) -> dict[str, Any]: # Translate the galaxy default base path to the pulp ansible default base path. distro_path = settings.get("GALAXY_API_DEFAULT_DISTRIBUTION_BASE_PATH", "published") @@ -397,7 +397,7 @@ def configure_pulp_ansible(settings: Dynaconf) -> Dict[str, Any]: } -def configure_authentication_classes(settings: Dynaconf, data: Dict[str, Any]) -> Dict[str, Any]: +def configure_authentication_classes(settings: Dynaconf, data: dict[str, Any]) -> dict[str, Any]: # GALAXY_AUTHENTICATION_CLASSES is used to configure the galaxy api authentication # pretty much everywhere (on prem, cloud, dev environments, CI environments etc). # We need to set the REST_FRAMEWORK__DEFAULT_AUTHENTICATION_CLASSES variable so that @@ -442,10 +442,10 @@ def configure_authentication_classes(settings: Dynaconf, data: Dict[str, Any]) - return data -def configure_password_validators(settings: Dynaconf) -> Dict[str, Any]: +def configure_password_validators(settings: Dynaconf) -> dict[str, Any]: """Configure the password validators""" GALAXY_MINIMUM_PASSWORD_LENGTH: int = settings.get("GALAXY_MINIMUM_PASSWORD_LENGTH", 9) - AUTH_PASSWORD_VALIDATORS: List[Dict[str, Any]] = settings.AUTH_PASSWORD_VALIDATORS + AUTH_PASSWORD_VALIDATORS: list[dict[str, Any]] = settings.AUTH_PASSWORD_VALIDATORS # NOTE: Dynaconf can't add or merge on dicts inside lists. # So we need to traverse the list to change it until the RFC is implemented # https://github.com/rochacbruno/dynaconf/issues/299#issuecomment-900616706 @@ -455,7 +455,7 @@ def configure_password_validators(settings: Dynaconf) -> Dict[str, Any]: return {"AUTH_PASSWORD_VALIDATORS": AUTH_PASSWORD_VALIDATORS} -def configure_api_base_path(settings: Dynaconf) -> Dict[str, Any]: +def configure_api_base_path(settings: Dynaconf) -> dict[str, Any]: """Set the pulp api root under the galaxy api root.""" galaxy_api_root = settings.get("GALAXY_API_PATH_PREFIX") @@ -463,7 +463,7 @@ def configure_api_base_path(settings: Dynaconf) -> Dict[str, Any]: return {"API_ROOT": pulp_api_root} -def configure_ldap(settings: Dynaconf) -> Dict[str, Any]: +def configure_ldap(settings: Dynaconf) -> dict[str, Any]: """Configure ldap settings for galaxy. This function returns a dictionary that will be merged to the settings. """ @@ -571,7 +571,7 @@ def configure_ldap(settings: Dynaconf) -> Dict[str, Any]: return data -def configure_authentication_backends(settings: Dynaconf, data: Dict[str, Any]) -> Dict[str, Any]: +def configure_authentication_backends(settings: Dynaconf, data: dict[str, Any]) -> dict[str, Any]: """Configure authentication backends for galaxy. This adds backends in the following order: @@ -611,7 +611,7 @@ def configure_authentication_backends(settings: Dynaconf, data: Dict[str, Any]) return data -def configure_renderers(settings) -> Dict[str, Any]: +def configure_renderers(settings) -> dict[str, Any]: """ Add CustomBrowsableAPI only for community (galaxy.ansible.com, galaxy-stage, galaxy-dev)" """ @@ -625,7 +625,7 @@ def configure_renderers(settings) -> Dict[str, Any]: return {} -def configure_legacy_roles(settings: Dynaconf) -> Dict[str, Any]: +def configure_legacy_roles(settings: Dynaconf) -> dict[str, Any]: """Set the feature flag for legacy roles from the setting""" data = {} legacy_roles = settings.get("GALAXY_ENABLE_LEGACY_ROLES", False) @@ -660,7 +660,7 @@ def validate(settings: Dynaconf) -> None: settings.validators.validate() -def configure_dynamic_settings(settings: Dynaconf) -> Dict[str, Any]: +def configure_dynamic_settings(settings: Dynaconf) -> dict[str, Any]: """Dynaconf 3.2.2 allows registration of hooks on methods `get` and `as_dict` For galaxy this enables the Dynamic Settings feature, which triggers a @@ -785,7 +785,7 @@ def alter_hostname_settings( } -def configure_dab_required_settings(settings: Dynaconf) -> Dict[str, Any]: +def configure_dab_required_settings(settings: Dynaconf) -> dict[str, Any]: dab_settings = get_dab_settings( installed_apps=[*settings.INSTALLED_APPS, 'ansible_base.jwt_consumer'], rest_framework=settings.REST_FRAMEWORK, diff --git a/galaxy_ng/app/models/__init__.py b/galaxy_ng/app/models/__init__.py index 3c5fc93aa2..cbef82a4ce 100644 --- a/galaxy_ng/app/models/__init__.py +++ b/galaxy_ng/app/models/__init__.py @@ -24,27 +24,27 @@ __all__ = ( # aiindex "AIIndexDenyList", - # auth - "Group", - "User", # collectionimport "CollectionImport", - # config - "Setting", # container "ContainerDistribution", "ContainerDistroReadme", "ContainerNamespace", "ContainerRegistryRemote", "ContainerRegistryRepos", + # auth + "Group", # namespace "Namespace", "NamespaceLink", # organization "Organization", - "Team", + # config + "Setting", # synclist "SyncList", + "Team", + "User", ) permission_registry.register( diff --git a/galaxy_ng/app/models/auth.py b/galaxy_ng/app/models/auth.py index bd315274c7..0d84ea12f0 100644 --- a/galaxy_ng/app/models/auth.py +++ b/galaxy_ng/app/models/auth.py @@ -9,10 +9,10 @@ log = logging.getLogger(__name__) __all__ = ( - "SYSTEM_SCOPE", "RH_PARTNER_ENGINEER_GROUP", - "User", + "SYSTEM_SCOPE", "Group", + "User", ) diff --git a/galaxy_ng/app/tasks/settings_cache.py b/galaxy_ng/app/tasks/settings_cache.py index 9796f1bbab..7fcc42bc52 100644 --- a/galaxy_ng/app/tasks/settings_cache.py +++ b/galaxy_ng/app/tasks/settings_cache.py @@ -2,12 +2,13 @@ Tasks related to the settings cache management. """ import logging +import redis + from functools import wraps -from typing import Any, Callable, Dict, Optional +from typing import Any, Callable, Optional from uuid import uuid4 from django.conf import settings -from redis import ConnectionError, Redis from galaxy_ng.app.models.config import Setting from django.db.utils import OperationalError @@ -23,9 +24,9 @@ def get_redis_connection(): redis_url = settings.get("REDIS_URL") if _conn is None: if redis_url is not None: - _conn = Redis.from_url(redis_url, decode_responses=True) + _conn = redis.Redis.from_url(redis_url, decode_responses=True) elif redis_host is not None: - _conn = Redis( + _conn = redis.Redis( host=redis_host, port=settings.get("REDIS_PORT") or 6379, db=settings.get("REDIS_DB", 0), @@ -41,7 +42,7 @@ def get_redis_connection(): return _conn -conn: Optional[Redis] = get_redis_connection() +conn: Optional[redis.Redis] = get_redis_connection() def connection_error_wrapper( @@ -55,7 +56,7 @@ def dispatch(func, *args, **kwargs): return default() try: return func(*args, **kwargs) - except (ConnectionError, TypeError) as e: + except (redis.ConnectionError, TypeError) as e: # TypeError is raised when an invalid port number for the Redis connection is configured logging.error(f"Redis connection error: {e}") return default() @@ -105,7 +106,7 @@ def release_lock(lock_name: str, token: str): @connection_error_wrapper -def update_setting_cache(data: Dict[str, Any]) -> int: +def update_setting_cache(data: dict[str, Any]) -> int: """Takes a python dictionary and write to Redis as a hashmap using Redis connection""" if conn is None: @@ -120,7 +121,7 @@ def update_setting_cache(data: Dict[str, Any]) -> int: @connection_error_wrapper(default=dict) -def get_settings_from_cache() -> Dict[str, Any]: +def get_settings_from_cache() -> dict[str, Any]: """Reads settings from Redis cache and returns a python dictionary""" if conn is None: return {} diff --git a/galaxy_ng/tests/integration/utils/__init__.py b/galaxy_ng/tests/integration/utils/__init__.py index 37b4727f84..3315ce261d 100644 --- a/galaxy_ng/tests/integration/utils/__init__.py +++ b/galaxy_ng/tests/integration/utils/__init__.py @@ -51,45 +51,45 @@ __all__ = ( - "get_client", - "ansible_galaxy", - "copy_collection_version", - "create_local_signature_for_tarball", + "AnsibleDistroAndRepo", + "CapturingGalaxyError", + "CollectionInspector", + "GithubAdminClient", + "PulpObjectBase", "SocialGithubClient", + "TaskWaitingTimeout", "UIClient", - "CollectionInspector", + "ansible_galaxy", "build_collection", - "upload_artifact", - "modify_artifact", - "get_collections_namespace_path", - "get_collection_full_path", - "set_certification", - "get_all_collections_by_repo", - "get_all_repository_collection_versions", - "TaskWaitingTimeout", - "CapturingGalaxyError", - "generate_namespace", - "get_all_namespaces", - "generate_unused_namespace", - "create_unused_namespace", "cleanup_namespace", - "wait_for_task", - "wait_for_task_ui_client", - "is_docker_installed", - "uuid4", - "url_safe_join", - "wait_for_url", - "delete_group", + "clear_certified", + "copy_collection_version", + "create_local_signature_for_tarball", + "create_unused_namespace", "create_user", + "delete_all_collections", + "delete_group", "delete_user", - "set_synclist", - "clear_certified", - "perform_sync", + "gen_string", + "generate_namespace", + "generate_unused_namespace", + "get_all_collections_by_repo", + "get_all_namespaces", + "get_all_repository_collection_versions", + "get_client", + "get_collection_full_path", + "get_collections_namespace_path", + "is_docker_installed", "iterate_all", + "modify_artifact", + "perform_sync", + "set_certification", + "set_synclist", + "upload_artifact", + "url_safe_join", + "uuid4", "wait_for_all_tasks", - "gen_string", - "AnsibleDistroAndRepo", - "delete_all_collections", - "PulpObjectBase", - "GithubAdminClient", + "wait_for_task", + "wait_for_task_ui_client", + "wait_for_url", ) diff --git a/galaxy_ng/tests/integration/utils/collections.py b/galaxy_ng/tests/integration/utils/collections.py index 1a24762917..98d67dfaa7 100644 --- a/galaxy_ng/tests/integration/utils/collections.py +++ b/galaxy_ng/tests/integration/utils/collections.py @@ -9,7 +9,7 @@ import json import time import uuid -from typing import List, Union +from typing import Union from ansible.galaxy.api import _urljoin import yaml @@ -731,7 +731,7 @@ def setup_multipart(path: str, data: dict) -> dict: def add_multipart_field( - boundary: bytes, buffer: List[bytes], name: Union[str, bytes], value: Union[str, bytes] + boundary: bytes, buffer: list[bytes], name: Union[str, bytes], value: Union[str, bytes] ): if isinstance(name, str): name = name.encode("utf8") diff --git a/galaxy_ng/tests/integration/utils/legacy.py b/galaxy_ng/tests/integration/utils/legacy.py index c177698b2a..3a0c9603bc 100644 --- a/galaxy_ng/tests/integration/utils/legacy.py +++ b/galaxy_ng/tests/integration/utils/legacy.py @@ -28,7 +28,7 @@ def wait_for_v1_task(task_id=None, resp=None, api_client=None, check=True): state = None counter = 0 - while state is None or state == 'RUNNING' and counter <= 500: + while state is None or (state == 'RUNNING' and counter <= 500): counter += 1 task_resp = api_client(poll_url, method='GET') state = task_resp['results'][0]['state'] diff --git a/galaxy_ng/tests/integration/utils/vault_loading.py b/galaxy_ng/tests/integration/utils/vault_loading.py index 2a8c59b7b5..1c484385a3 100644 --- a/galaxy_ng/tests/integration/utils/vault_loading.py +++ b/galaxy_ng/tests/integration/utils/vault_loading.py @@ -1,5 +1,4 @@ import logging -from typing import Dict from hvac import Client from hvac.exceptions import InvalidPath @@ -46,7 +45,7 @@ def from_settings(cls, settings): client = None return cls(mountpoint=mountpoint, client=client, settings=settings) - loaded_secrets: Dict[str, Dict[str, object]] + loaded_secrets: dict[str, dict[str, object]] def __init__(self, mountpoint: str, client: Client, settings): self._client = client diff --git a/lint_requirements.txt b/lint_requirements.txt index 7c41d673c8..484bef93d5 100644 --- a/lint_requirements.txt +++ b/lint_requirements.txt @@ -1,4 +1,4 @@ check-manifest flake8 yamllint -ruff==0.7.1 +ruff diff --git a/pyproject.toml b/pyproject.toml index c024cd3b33..3aa2bc8556 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -152,10 +152,6 @@ extend-ignore = [ # UP032 Use f-string instead of `format` call. # No need to replace all str.format usage with f-strings in entire codebase. "UP032", - # PT004,PT005 are incorrect and deprecated - # See https://github.com/astral-sh/ruff/issues/8796 - "PT004", - "PT005", # PT009 Use a regular `assert` instead of unittest-style # Ignoring, since we have mixed pytest and legacy unittest styled tests "PT009",