<commit_before>import json
import csv
import argparse
from collections import namedtuple


def get_module_ports(j, module):
    if module not in j['modules']:
        raise LookupError(
            'module %s not in module list %s' %
            (module, ', '.join(j['modules'].keys()))
        )

    for port in j['modules'][module]['ports']:
        bits = j['modules'][module]['ports'][port]['bits']
        if len(bits) > 1:
            for idx, _ in enumerate(bits):
                yield j['modules'][module]['ports'][port][
                    'direction'], '%s[%d]' % (port, idx)
        else:
            yield j['modules'][module]['ports'][port]['direction'], port


Pin = namedtuple('Pin', 'name is_clock is_input is_output')


def get_free_pin(available_pins, direction):
    possible_pins = []
    for pin in available_pins:
        if pin.is_input and direction == 'input':<commit_msg>Attempt to fix failing wire test.<commit_after>import json
import csv
import argparse
from collections import namedtuple


def get_module_ports(j, module):
    if module not in j['modules']:
        raise LookupError(
            'module %s not in module list %s' %
            (module, ', '.join(j['modules'].keys()))
        )

    for port in j['modules'][module]['ports']:
        bits = j['modules'][module]['ports'][port]['bits']
        if len(bits) > 1:
            for idx, _ in enumerate(bits):
                yield j['modules'][module]['ports'][port][
                    'direction'], '%s[%d]' % (port, idx)
        else:
            yield j['modules'][module]['ports'][port]['direction'], port


Pin = namedtuple('Pin', 'name is_clock is_input is_output')


def get_free_pin(available_pins, direction):
    possible_pins = []
    for pin in available_pins:
        if pin.is_input and not pin.is_clock and direction == 'input':
{'fraction_non_alphanumeric': 0.1510048886474742, 'fraction_numerical': 0.0010863661053775121, 'mean_word_length': 2.766871165644172, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '4768236', 'n_tokens_mistral': 546, 'n_tokens_neox': 534, 'n_words': 149}