File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- import collections
21import re
32from typing import List
43
@@ -75,27 +74,28 @@ def apigee_remove_proxy_from_product(product: dict, proxy_to_remove):
7574 return product
7675
7776
78- def apigee_teams_map (teamMembers : List [dict ], teams : List [dict ]):
79- joined = collections .defaultdict (dict )
80- for item in teamMembers + teams :
77+ def apigee_team_to_admin (team ):
78+ return next ((attr .get ('value' ) for attr in team ['attributes' ] if attr ['name' ] == 'ADMIN_EMAIL' ), None )
79+
80+
81+ def apigee_teams_map (team_members : List [dict ], teams : List [dict ]):
82+ from collections import defaultdict
83+ joined = defaultdict (dict )
84+ for item in team_members + teams :
8185 joined [item ['name' ]].update (item )
8286 full_teams = list (joined .values ())
8387
8488 return {
8589 team ['name' ]: {
86- "contact" : next (( attr . get ( 'value' ) for attr in team [ 'attributes' ] if attr [ 'name' ] == 'ADMIN_EMAIL' ), {} ),
90+ "contact" : apigee_team_to_admin ( team ),
8791 "members" : team ['members' ]
8892 }
8993 for team in full_teams
9094 }
9195
9296
9397def apigee_teams_to_point_of_contact (teams : List [dict ]):
94-
95- return {
96- next ((attr .get ('value' ) for attr in team ['attributes' ] if attr ['name' ] == 'ADMIN_EMAIL' ), {})
97- for team in teams
98- }
98+ return {apigee_team_to_admin (team ) for team in teams }
9999
100100
101101def apigee_teams_to_members (teams : List [dict ]):
You can’t perform that action at this time.
0 commit comments