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

def runner_serial(func):
  """
  Decorator for functions that take a serial number as the first argument,
  possibly with other arguments to follow
  """
  def inner():
    import sys
    args = sys.argv

    if len(args)>1:
      serial = args[1]
    else:
      serial = None

    if serial:
      func(serial)
      return 0
    else:
      print 'Looking for APT controllers'
      drv = pylibftdi.Driver()
      controllers = drv.list_devices()

      if controllers:
        for con in controllers:
          print 'Found %s %s S/N: %s'%con
          func(con[2])
          print ''

        return 0
      else:
        print '\tNo APT controllers found. Maybe you need to specify a PID'
        return 1
  return inner
<commit_msg>Added () to print functions in runner decorator and added byte decoding to serial number argument<commit_after>#!/usr/bin/env python
import pylibftdi

def runner_serial(func):
  """
  Decorator for functions that take a serial number as the first argument,
  possibly with other arguments to follow
  """
  def inner():
    import sys
    args = sys.argv

    if len(args)>1:
      serial = args[1]
    else:
      serial = None

    if serial:
      func(serial)
      return 0
    else:
      print('Looking for APT controllers')
      drv = pylibftdi.Driver()
      controllers = drv.list_devices()

      if controllers:
        for con in controllers:
          print('Found %s %s S/N: %s'%con)
          func(con[2].decode('latin-1'))
          print('')

        return 0
      else:
        print('\tNo APT controllers found. Maybe you need to specify a PID')
        return 1
  return inner

{'fraction_non_alphanumeric': 0.0885478158205431, 'fraction_numerical': 0.007674144037780401, 'mean_word_length': 2.18609022556391, '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': '2160000', 'n_tokens_mistral': 529, 'n_tokens_neox': 496, 'n_words': 181}