parameters: (arch)
return_statement: return changed
docstring: Drops <sb> and <cb> of any <segment> types with length="longline",
      since we now assume longlines have full switch block/connection block
      populations
docstring_summary: Drops <sb> and <cb> of any <segment> types with length="longline",
      since we now assume longlines have full switch block/connection block
      populations
docstring_tokens: Drops <sb > and <cb > of any <segment > types with length = longline since we now assume longlines have full switch block / connection block populations
function: def remove_longline_sb_cb(arch):
      """
      Drops <sb> and <cb> of any <segment> types with length="longline",
      since we now assume longlines have full switch block/connection block
      populations
      """
  
      longline_segment_tags = arch.findall(".//segment[@length='longline']")
  
      changed = False
      for longline_segment_tag in longline_segment_tags:
          assert longline_segment_tag.tag == "segment"
          assert longline_segment_tag.attrib["length"] == "longline"
  
          child_sb_tags = longline_segment_tag.findall("./sb")
          child_cb_tags = longline_segment_tag.findall("./cb")
  
          for cb_sb_tag in child_sb_tags + child_cb_tags:
              assert cb_sb_tag.tag == "cb" or cb_sb_tag.tag == "sb"
              print(
                  "Warning: Removing invalid {} tag for longline segment".format(cb_sb_tag.tag),
                  file=sys.stderr,
              )
              longline_segment_tag.remove(cb_sb_tag)
              changed = True
  
      return changed
function_tokens: def remove_longline_sb_cb ( arch ) : longline_segment_tags = arch . findall ( ".//segment[@length='longline']" ) changed = False for longline_segment_tag in longline_segment_tags : assert longline_segment_tag . tag == "segment" assert longline_segment_tag . attrib [ "length" ] == "longline" child_sb_tags = longline_segment_tag . findall ( "./sb" ) child_cb_tags = longline_segment_tag . findall ( "./cb" ) for cb_sb_tag in child_sb_tags + child_cb_tags : assert cb_sb_tag . tag == "cb" or cb_sb_tag . tag == "sb" print ( "Warning: Removing invalid {} tag for longline segment" . format ( cb_sb_tag . tag ) , file = sys . stderr , ) longline_segment_tag . remove ( cb_sb_tag ) changed = True return changed