<commit_before>"""Blink a LED on GPIO on an interval."""
import argparse
import time

import RPi.GPIO as GPIO


def main():
    """Main script execution."""
    parser = argparse.ArgumentParser(description='LED light blinking script.')
    parser.add_argument('--pin', type=int, default=25, help='GPIO pin number')
    parser.add_argument('--interval', type=int, default=1,
                        help='Time in seconds to blink')
    args = parser.parse_args()

    GPIO.setwarnings(False)
    GPIO.setmode(GPIO.BCM)
    GPIO.setup(args.pin, GPIO.OUT)

    while True:
        GPIO.output(args.pin, GPIO.HIGH)
        time.sleep(args.interval)
        GPIO.output(args.pin, GPIO.LOW)
        time.sleep(args.interval)

if __name__ == '__main__':
    main()
<commit_msg>Turn off LED when script is ended<commit_after>"""Blink a LED on GPIO on an interval."""
import argparse
import signal
import sys
import time

import RPi.GPIO as GPIO

PIN = None


def cleanup(sig, frame):
    """Disable the LED on script shutdown."""
    if PIN is not None:
        GPIO.output(PIN, GPIO.LOW)
    sys.exit(0)


def main():
    """Main script execution."""
    parser = argparse.ArgumentParser(description='LED light blinking script.')
    parser.add_argument('--pin', type=int, default=25, help='GPIO pin number')
    parser.add_argument('--interval', type=int, default=1,
                        help='Time in seconds to blink')
    args = parser.parse_args()
    global PIN
    PIN = args.pin

    # When user's end the program, leave the pin `off`.
    signal.signal(signal.SIGINT, cleanup)

    GPIO.setwarnings(False)
    GPIO.setmode(GPIO.BCM)
    GPIO.setup(args.pin, GPIO.OUT)

    while True:
        GPIO.output(args.pin, GPIO.HIGH)
        time.sleep(args.interval)
        GPIO.output(args.pin, GPIO.LOW)
        time.sleep(args.interval)

if __name__ == '__main__':
    main()

{'fraction_non_alphanumeric': 0.1288604898828541, 'fraction_numerical': 0.003727369542066028, 'mean_word_length': 2.930962343096234, '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': '4004956', 'n_tokens_mistral': 594, 'n_tokens_neox': 578, 'n_words': 160}