Merge lp:~stevenk/launchpad/bulk-eid-to-obj into lp:launchpad
Proposed by
Steve Kowalik
Status: | Merged |
---|---|
Approved by: | Steve Kowalik |
Approved revision: | no longer in the source branch. |
Merged at revision: | 16687 |
Proposed branch: | lp:~stevenk/launchpad/bulk-eid-to-obj |
Merge into: | lp:launchpad |
Diff against target: |
154 lines (+61/-24) 3 files modified
lib/lp/services/auditor/client.py (+8/-4) lib/lp/services/enterpriseid.py (+23/-10) lib/lp/services/tests/test_enterpriseid.py (+30/-10) |
To merge this branch: | bzr merge lp:~stevenk/launchpad/bulk-eid-to-obj |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
William Grant | code | Approve | |
Review via email: mp+171705@code.launchpad.net |
Commit message
Destroy enterpriseid_
Description of the change
Destroy enterpriseid_
To post a comment you must log in.
20 + eids = [] entries' ]: [entry[ 'actor' ], entry['object']])
21 + for entry in logs['log-
22 + eids.extend(
This should probably be a set; there will likely be many dupes.
76 +def enterpriseids_ to_objects( eids):
77 + """Given a list of SOA Enterprise IDs, return a dict that maps the ID to
78 + its concrete object."""
That's a prolix and non-compliant docstring. "Dereference multiple SOA Enterprise IDs.", maybe?
79 + map_id_to_obj = {}
80 + obj_id_to_eid = defaultdict(dict)
Aren't those "eid_to_obj" and "dbid_to_eid"? map_id_to_obj also isn't needed until right at the end; I'd define it there for readability.
89 + type_ids[ scheme[ 1]].append( int(scheme[ 2])) to_eid[ scheme[ 1]][int( scheme[ 2])] = eid
90 + obj_id_
These are redundant. type_ids[foo] is just obj_id_ to_eid[ foo].keys( ). Dropping type_ids also has the side-effect of eliminating dupes.
92 + for kind in types:
This could just iterate over obj_id_to_eid instead, to get just the types relevant to this query.
137 + def test_enterprise ids_to_ objects( self):
This probably wants to also test for multiple classes.