<commit_before>## \example bonds.py
## Show how to extract bonds from a file.
import RMF


def print_bonds(node, bf, obf):
    if bf.get_is(node):
        bd = bf.get(node)
        print "bond", bd.get_bonded()
    elif obf.get_is(node):
        bd = obf.get(node)
        print "old-style bond", bd.get_bonded()
    else:
        for c in node.get_children():
            print_bonds(c, bf, obf)

fh = RMF.open_rmf_file_read_only(RMF.get_example_path("simple.rmf3"))
fh.set_current_frame(RMF.FrameID(0))
bf = RMF.BondConstFactory(fh)
# bonds are now stored in a more efficient manner, but for backwards
# compatibility...
obf = RMF.OldBondConstFactory(fh)

print_bonds(fh.get_root_node(), bf, obf)<commit_msg>remove used of backward compat functionality<commit_after># \example bonds.py
# Show how to extract bonds from a file.
import RMF


def print_bonds(node, bf):
    if bf.get_is(node):
        bd = bf.get(node)
        print "bond", bd.get_bonded()
    else:
        for c in node.get_children():
            print_bonds(c, bf, obf)

fh = RMF.open_rmf_file_read_only(RMF.get_example_path("simple.rmf3"))
fh.set_current_frame(RMF.FrameID(0))
bf = RMF.BondConstFactory(fh)

print_bonds(fh.get_root_node(), bf)
{'fraction_non_alphanumeric': 0.1242798353909465, 'fraction_numerical': 0.0032921810699588477, 'mean_word_length': 3.520446096654275, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1256016', 'n_tokens_mistral': 485, 'n_tokens_neox': 464, 'n_words': 105}