def port_standard(standard_annotations, sel, sample, extractors):
 new_annotations = []
 for annotation in standard_annotations:
  if (not annotation.get('tagid')):
   continue
  element = find_element(annotation, sel)
  if (element is None):
   continue
  selector = find_generalized_css_selector(element, sel)
  if (not selector):
   continue
  annotation['accept_selectors'] = [selector]
  annotation['selector'] = selector
  annotation['reject_selectors'] = []
  annotation = _add_annotation_data(annotation, sample, extractors)
  for (_id, data) in annotation.get('data', {}).items():
   a = copy.deepcopy(annotation)
   a['id'] = gen_predictable_id(_id, a['id'])
   a['data'] = {gen_predictable_id(a['id'], 1): data}
   new_annotations.append(a)
 return new_annotations

def port_standard ( standard_annotations , sel , sample , extractors ) : new_annotations = [ ] for annotation in standard_annotations : if ( not annotation . get ( 'tagid' ) ) : continue element = find_element ( annotation , sel ) if ( element is None ) : continue selector = find_generalized_css_selector ( element , sel ) if ( not selector ) : continue annotation [ 'accept_selectors' ] = [ selector ] annotation [ 'selector' ] = selector annotation [ 'reject_selectors' ] = [ ] annotation = _add_annotation_data ( annotation , sample , extractors ) for ( _id , data ) in annotation . get ( 'data' , { } ) . items ( ) : a = copy . deepcopy ( annotation ) a [ 'id' ] = gen_predictable_id ( _id , a [ 'id' ] ) a [ 'data' ] = { gen_predictable_id ( a [ 'id' ] , 1 ) : data } new_annotations . append ( a ) return new_annotations
add accept selectors for existing annotations .