def watch_node(node_label, filename, title):
    """Follow changes to a particular label.

    \b
    NODE_LABEL: Label for the node you wish to watch. e.g. 1026-5-a
    FILENAME: XML file containing the regulation
    TITLE: Title number"""

    initial_tree, builder = tree_and_builder(filename, title)
    initial_node = find(initial_tree, node_label)
    if initial_node:
        click.echo("> " + builder.doc_number)
        click.echo("\t" + pretty_change(
            {'action': 'POST', 'node': node_to_dict(initial_node)}))

    # search for label
    for version, changes in builder.changes_in_sequence():
        if node_label in changes:
            click.echo("> " + version)
            for change in changes[node_label]:
                click.echo("\t" + pretty_change(change))
Exemple #2
0
def watch_node(node_label, filename, title):
    """Follow changes to a particular label.

    \b
    NODE_LABEL: Label for the node you wish to watch. e.g. 1026-5-a
    FILENAME: XML file containing the regulation
    TITLE: Title number"""

    initial_tree, builder = tree_and_builder(filename, title)
    initial_node = find(initial_tree, node_label)
    if initial_node:
        click.echo("> " + builder.doc_number)
        click.echo("\t" + pretty_change({
            'action': 'POST',
            'node': node_to_dict(initial_node)
        }))

    # search for label
    for version, changes in builder.changes_in_sequence():
        if node_label in changes:
            click.echo("> " + version)
            for change in changes[node_label]:
                click.echo("\t" + pretty_change(change))
    pass

from regparser.builder import tree_and_builder
from regparser.notice.changes import node_to_dict, pretty_change
from regparser.tree.struct import find


if __name__ == "__main__":
    parser = argparse.ArgumentParser(description="Node Watcher")
    parser.add_argument(
        'node_label',
        help='Label for the node you wish to watch. e.g. 1026-5-a')
    parser.add_argument('filename',
                        help='XML file containing the regulation')
    parser.add_argument('title', type=int, help='Title number')
    args = parser.parse_args()

    initial_tree, builder = tree_and_builder(args.filename, args.title)
    initial_node = find(initial_tree, args.node_label)
    if initial_node:
        print("> " + builder.doc_number)
        print("\t" + pretty_change(
            {'action': 'POST', 'node': node_to_dict(initial_node)}))

    # search for label
    for version, changes in builder.changes_in_sequence():
        if args.node_label in changes:
            print("> " + version)
            for change in changes[args.node_label]:
                print("\t" + pretty_change(change))
Exemple #4
0
    pass

from regparser.builder import tree_and_builder
from regparser.notice.changes import node_to_dict, pretty_change
from regparser.tree.struct import find

if __name__ == "__main__":
    parser = argparse.ArgumentParser(description="Node Watcher")
    parser.add_argument(
        'node_label',
        help='Label for the node you wish to watch. e.g. 1026-5-a')
    parser.add_argument('filename', help='XML file containing the regulation')
    parser.add_argument('title', type=int, help='Title number')
    args = parser.parse_args()

    initial_tree, builder = tree_and_builder(args.filename, args.title)
    initial_node = find(initial_tree, args.node_label)
    if initial_node:
        print("> " + builder.doc_number)
        print("\t" + pretty_change({
            'action': 'POST',
            'node': node_to_dict(initial_node)
        }))

    # search for label
    for version, changes in builder.changes_in_sequence():
        if args.node_label in changes:
            print("> " + version)
            for change in changes[args.node_label]:
                print("\t" + pretty_change(change))