<commit_before>import re
import requests

location = "http://www.ieee.org/netstorage/standards/oui.txt"
number_name = re.compile(" *(\w{6}) *\(.*\)[^\w]+(.*)$")

# Get the listing from the source location.
req = requests.get(location)

# Ignore the first 127 characters of junk data.
req_string = req.text[127:]

# Break the request string into a list of entries.
entries = req_string.split('\r\n\r\n')

for entry in entries:
    matches = number_name.search(entry.split('\r\n')[1])

    print("{}: {}".format(matches.group(2), matches.group(1)))<commit_msg>Parse companies, convert to list of dictionaries.<commit_after>import re
import hashlib
import requests

location = "http://www.ieee.org/netstorage/standards/oui.txt"
number_name = re.compile(" *(\w{6}) *\(.*\)[^\w]+(.*)$")
oui_hash = hashlib.sha1()
companies = []

# Get the listing from the source location.
req = requests.get(location)

# Update our hash object with the value from our request string.
oui_hash.update(bytes(req.text, "utf-8"))

# Ignore the first 127 characters of junk data.
req_string = req.text[127:]

# Break the request string into a list of entries.
entries = req_string.split('\r\n\r\n')

# Remove junk entry at the end.
del entries[-1]

for entry in entries:
    lines = entry.split('\r\n')
    matches = number_name.search(lines[1])
    company = {'name': matches.group(2), 'oui': matches.group(1)}
    companies.append(company)
{'fraction_non_alphanumeric': 0.16325088339222615, 'fraction_numerical': 0.01625441696113074, 'mean_word_length': 4.2835820895522385, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '5225023', 'n_tokens_mistral': 489, 'n_tokens_neox': 476, 'n_words': 134}