Skip to content

Commit

Permalink
Add AssociationProxy type, drop type-ignore
Browse files Browse the repository at this point in the history
  • Loading branch information
jdavcs committed Apr 2, 2024
1 parent f7f91a7 commit 0e84001
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/galaxy/model/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,10 @@
)
from sqlalchemy.exc import OperationalError
from sqlalchemy.ext import hybrid
from sqlalchemy.ext.associationproxy import association_proxy
from sqlalchemy.ext.associationproxy import (
association_proxy,
AssociationProxy,
)
from sqlalchemy.ext.orderinglist import ordering_list
from sqlalchemy.orm import (
aliased,
Expand Down Expand Up @@ -782,7 +785,7 @@ class User(Base, Dictifiable, RepresentById):
),
)

preferences = None
preferences: AssociationProxy[Any]

# attributes that will be accessed and returned when calling to_dict( view='collection' )
dict_collection_visible_keys = ["id", "email", "username", "deleted", "active", "last_password_change"]
Expand Down Expand Up @@ -11415,7 +11418,7 @@ def __repr__(self):

# Set up proxy so that this syntax is possible:
# <user_obj>.preferences[pref_name] = pref_value
User.preferences = association_proxy("_preferences", "value", creator=UserPreference) # type:ignore[assignment]
User.preferences = association_proxy("_preferences", "value", creator=UserPreference)

# Optimized version of getting the current Galaxy session.
# See https://github.com/sqlalchemy/sqlalchemy/discussions/7638 for approach
Expand Down

0 comments on commit 0e84001

Please sign in to comment.