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

from time import sleep
import socket
import sys
import os
import time
import argparse
import logging
logging.basicConfig(level=logging.DEBUG)

from ice import ICE
ice = ICE()

parser = argparse.ArgumentParser()
parser.description = "Helper script to set ICE power rails"

parser.add_argument("SERIAL", help="Path to ICE serial device")
parser.add_argument("-1", "--V1P2",  help="Set 1.2V rail val (0=off)", type=float)
parser.add_argument("-0", "--V0P6",  help="Set 0.6V rail val (0=off)", type=float)
parser.add_argument("-b", "--VBATT", help="Set VBatt rail val (0=off)", type=float)

args = parser.parse_args()

ice.connect(args.SERIAL)

try:
    if args.V1P2 == 0:
        logging.info("Turning off 1.2V")
        ice.power_set_onoff(ICE.POWER_1P2, False)
    else:
        logging.info("Turning on 1.2V to " + str(args.V1P2))
        ice.power_set_voltage(ICE.POWER_1P2, args.V1P2)
        ice.power_set_onoff(ICE.POWER_1P2, True)
except AttributeError:
    pass

try:
    if args.V0P6 == 0:
        logging.info("Turning off 0.6V")
        ice.power_set_onoff(ICE.POWER_0P6, False)
    else:
        logging.info("Turning on 0.6V to " + str(args.V0P6))
        ice.power_set_voltage(ICE.POWER_0P6, args.V0P6)
        ice.power_set_onoff(ICE.POWER_0P6, True)
except AttributeError:
    pass

try:
    if args.VBATT == 0:
        logging.info("Turning off VBatt")
        ice.power_set_onoff(ICE.POWER_VBATT, False)
    else:
        logging.info("Turning on VBatt to " + str(args.VBATT))
        ice.power_set_voltage(ICE.POWER_VBATT, args.VBATT)
        ice.power_set_onoff(ICE.POWER_VBATT, True)
except AttributeError:
    pass<commit_msg>So that's how the argparse works<commit_after>#!/usr/bin/env python

from time import sleep
import socket
import sys
import os
import time
import argparse
import logging
logging.basicConfig(level=logging.DEBUG)

from ice import ICE
ice = ICE()

parser = argparse.ArgumentParser()
parser.description = "Helper script to set ICE power rails"

parser.add_argument("SERIAL", help="Path to ICE serial device")
parser.add_argument("-1", "--V1P2",  help="Set 1.2V rail val (0=off)", type=float)
parser.add_argument("-0", "--V0P6",  help="Set 0.6V rail val (0=off)", type=float)
parser.add_argument("-b", "--VBATT", help="Set VBatt rail val (0=off)", type=float)

args = parser.parse_args()

ice.connect(args.SERIAL)

if args.V1P2 is not None:
    if args.V1P2 == 0:
        logging.info("Turning off 1.2V")
        ice.power_set_onoff(ICE.POWER_1P2, False)
    else:
        logging.info("Turning on 1.2V to " + str(args.V1P2))
        ice.power_set_voltage(ICE.POWER_1P2, args.V1P2)
        ice.power_set_onoff(ICE.POWER_1P2, True)

if args.V0P6 is not None:
    if args.V0P6 == 0:
        logging.info("Turning off 0.6V")
        ice.power_set_onoff(ICE.POWER_0P6, False)
    else:
        logging.info("Turning on 0.6V to " + str(args.V0P6))
        ice.power_set_voltage(ICE.POWER_0P6, args.V0P6)
        ice.power_set_onoff(ICE.POWER_0P6, True)

if args.VBATT is not None:
    if args.VBATT == 0:
        logging.info("Turning off VBatt")
        ice.power_set_onoff(ICE.POWER_VBATT, False)
    else:
        logging.info("Turning on VBatt to " + str(args.VBATT))
        ice.power_set_voltage(ICE.POWER_VBATT, args.VBATT)
        ice.power_set_onoff(ICE.POWER_VBATT, True)

{'fraction_non_alphanumeric': 0.13021454112038142, 'fraction_numerical': 0.029797377830750895, 'mean_word_length': 3.4700399467376832, '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': '1066170', 'n_tokens_mistral': 1281, 'n_tokens_neox': 1261, 'n_words': 275}