components/policy/tools/template_writers/writers/gpo_editor_writer.py
def _RemovePoliciesFromList(self, policy_list, policies_to_remove):
    '''Remove policies_to_remove from groups and the top-level list.'''
    # We only compare the 'name' property.
    policies_to_remove = set([p['name'] for p in policies_to_remove])

    # Remove from top-level list.
    policy_list[:] = [
        p for p in policy_list if p['name'] not in policies_to_remove
    ]

    # Remove from groups.
    for group in policy_list:
      if group['type'] != 'group':
        continue
      group['policies'] = [
          p for p in group['policies'] if p['name'] not in policies_to_remove
      ]

    # Remove empty groups.
    policy_list[:] = [
        p for p in policy_list if p['type'] != 'group' or p['policies']
    ]
Remove policies_to_remove from groups and the top-level list.
Remove policies_to_remove from groups and the top-level list.
Remove policies_to_remove from groups and the top - level list .
def _RemovePoliciesFromList(self, policy_list, policies_to_remove):
    policies_to_remove = set([p['name'] for p in policies_to_remove])
    policy_list[:] = [
        p for p in policy_list if p['name'] not in policies_to_remove
    ]
    for group in policy_list:
      if group['type'] != 'group':
        continue
      group['policies'] = [
          p for p in group['policies'] if p['name'] not in policies_to_remove
      ]
    policy_list[:] = [
        p for p in policy_list if p['type'] != 'group' or p['policies']
    ]
def _RemovePoliciesFromList ( self , policy_list , policies_to_remove ) : policies_to_remove = set ( [ p [ 'name' ] for p in policies_to_remove ] ) policy_list [ : ] = [ p for p in policy_list if p [ 'name' ] not in policies_to_remove ] for group in policy_list : if group [ 'type' ] != 'group' : continue group [ 'policies' ] = [ p for p in group [ 'policies' ] if p [ 'name' ] not in policies_to_remove ] policy_list [ : ] = [ p for p in policy_list if p [ 'type' ] != 'group' or p [ 'policies' ] ]
Remove policies_to_remove from groups and the top-level list.
Remove policies_to_remove from groups and the top - level list .
'''Remove policies_to_remove from groups and the top-level list.''' # We only compare the 'name' property. # Remove from top-level list. # Remove from groups. # Remove empty groups.
self
policy_list
policies_to_remove