<commit_before>#!/usr/bin/env python2

import argparse
import yaml
import sys

parser = argparse.ArgumentParser(
        description='Insert a key-value pair into each mapping '
        'in a YAML sequence of mappings')
parser.add_argument('key', help='Add this key')
parser.add_argument('value', help='with this value')
args = parser.parse_args()

# Load YAML from standard in
data = yaml.safe_load(sys.stdin)

if type(data) is list:
    for d in data:
        d[args.key] = args.value
    print(yaml.safe_dump(data, default_flow_style=False))

else:
    print("Error: data is not a YAML sequence")
    sys.exit(1)
<commit_msg>add document start indicator<commit_after>#!/usr/bin/env python2

import argparse
import yaml
import sys

parser = argparse.ArgumentParser(
        description='Insert a key-value pair into each mapping '
        'in a YAML sequence of mappings')
parser.add_argument('key', help='Add this key')
parser.add_argument('value', help='with this value')
args = parser.parse_args()

# Load YAML from standard in
data = yaml.safe_load(sys.stdin)

if type(data) is list:
    for d in data:
        d[args.key] = args.value

    print "---"
    print(yaml.safe_dump(data, default_flow_style=False))

else:
    print("Error: data is not a YAML sequence")
    sys.exit(1)

{'fraction_non_alphanumeric': 0.11413043478260869, 'fraction_numerical': 0.003105590062111801, 'mean_word_length': 3.845864661654135, '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': '3333017', 'n_tokens_mistral': 427, 'n_tokens_neox': 411, 'n_words': 126}