@@ -40,13 +40,12 @@ def __init__(self, *, group: OktaGroup | str, group_changes: OktaGroup, current_
4040
4141 def execute (self ) -> OktaGroup :
4242 # Update group type if it's being modified
43- # Ignore Ruff because we don't want to include subclasses with an isinstance comparison
44- if type (self .group ) != type (self .group_changes ): # noqa: E721
43+ if type (self .group ) is not type (self .group_changes ):
4544 group_id = self .group .id
4645 old_group_type = self .group .type
4746
4847 # Clean-up the old child table row
49- if type (self .group ) == RoleGroup :
48+ if type (self .group ) is RoleGroup :
5049 # End all group attachments to this role and all group memberships via the role grant
5150 active_role_associated_groups = RoleGroupMap .query .filter (
5251 db .or_ (
@@ -63,7 +62,7 @@ def execute(self) -> OktaGroup:
6362 db .session .commit ()
6463
6564 db .session .execute (delete (RoleGroup .__table__ ).where (RoleGroup .__table__ .c .id == group_id ))
66- elif type (self .group ) == AppGroup :
65+ elif type (self .group ) is AppGroup :
6766 # Bail if this is the owner group for the app
6867 # which cannot have its type changed
6968 if self .group .is_owner :
@@ -96,7 +95,7 @@ def execute(self) -> OktaGroup:
9695 self .group = OktaGroup .query .filter (OktaGroup .deleted_at .is_ (None )).filter (OktaGroup .id == group_id ).first ()
9796
9897 # Create new child table row
99- if type (self .group_changes ) == RoleGroup :
98+ if type (self .group_changes ) is RoleGroup :
10099 # Convert any group memberships and ownerships via a role to direct group memberships and ownerships
101100 active_group_users_from_role = (
102101 OktaUserGroupMember .query .filter (
@@ -153,7 +152,7 @@ def execute(self) -> OktaGroup:
153152 ).execute ()
154153
155154 db .session .execute (insert (RoleGroup .__table__ ).values (id = group_id ))
156- elif type (self .group_changes ) == AppGroup :
155+ elif type (self .group_changes ) is AppGroup :
157156 db .session .execute (
158157 insert (AppGroup .__table__ ).values (
159158 id = group_id ,
@@ -170,7 +169,7 @@ def execute(self) -> OktaGroup:
170169 db .session .expunge_all ()
171170
172171 # Add all app tags to this new app group, after we've updated the group type
173- if type (self .group_changes ) == AppGroup :
172+ if type (self .group_changes ) is AppGroup :
174173 app_tag_maps = (
175174 AppTagMap .query .options (joinedload (AppTagMap .active_tag ))
176175 .filter (
0 commit comments