Skip to content

Commit

Permalink
Refactor credentials management to improve type annotations and conso…
Browse files Browse the repository at this point in the history
…lidate imports
  • Loading branch information
arash77 committed Jan 21, 2025
1 parent 402e14c commit 398e969
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 16 deletions.
8 changes: 4 additions & 4 deletions lib/galaxy/managers/credentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
List,
Optional,
Tuple,
Union,
)

from sqlalchemy import select
Expand All @@ -16,12 +17,11 @@
)
from galaxy.model.base import transaction
from galaxy.model.scoped_session import galaxy_scoped_session
from galaxy.schema.credentials import (
CredentialsModelList,
SOURCE_TYPE,
)
from galaxy.schema.credentials import SOURCE_TYPE
from galaxy.schema.fields import DecodedDatabaseIdField

CredentialsModelList = List[Union[UserCredentials, CredentialsGroup, Variable, Secret]]


class CredentialsManager:
"""Manager object shared by controllers for interacting with credentials."""
Expand Down
10 changes: 0 additions & 10 deletions lib/galaxy/schema/credentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,17 @@
Dict,
List,
Optional,
Union,
)

from pydantic import RootModel
from typing_extensions import Literal

from galaxy.model import (
CredentialsGroup,
Secret,
UserCredentials,
Variable,
)
from galaxy.schema.fields import EncodedDatabaseIdField
from galaxy.schema.schema import Model

SOURCE_TYPE = Literal["tool"]


CredentialsModelList = List[Union[UserCredentials, CredentialsGroup, Variable, Secret]]


class CredentialResponse(Model):
id: EncodedDatabaseIdField
name: str
Expand Down
6 changes: 4 additions & 2 deletions lib/galaxy/webapps/galaxy/services/credentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,16 @@
RequestParameterInvalidException,
)
from galaxy.managers.context import ProvidesUserContext
from galaxy.managers.credentials import CredentialsManager
from galaxy.managers.credentials import (
CredentialsManager,
CredentialsModelList,
)
from galaxy.model import (
CredentialsGroup,
UserCredentials,
)
from galaxy.schema.credentials import (
CreateSourceCredentialsPayload,
CredentialsModelList,
SOURCE_TYPE,
UserCredentialsListResponse,
UserCredentialsResponse,
Expand Down

0 comments on commit 398e969

Please sign in to comment.