<commit_before>#!/usr/bin/env python
"""
Usage: python get_status.py [<serial>]

Gets the status of all APT controllers, or of the one specified
"""
import pylibftdi
import pyAPT

def get_vel_params(serial):
  with pyAPT.Controller(serial_number=serial) as con:
    min_vel, acc, max_vel = con.velocity_parameters()
    print '\tController velocity parameters:'
    print '\t\tMin. Velocity: %.2fmm/s'%(min_vel)
    print '\t\tAcceleration: %.2fmm/s/s'%(acc)
    print '\t\tMax. Velocity: %.2fmm/s'%(max_vel)

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

  if serial:
    get_vel_params(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
        get_vel_params(con[2])

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

if __name__ == '__main__':
  import sys
  sys.exit(main(sys.argv))
<commit_msg>Converts get_velocity_params.py to runner pattern<commit_after>#!/usr/bin/env python
"""
Usage: python get_status.py [<serial>]

Gets the status of all APT controllers, or of the one specified
"""
import pyAPT

from runner import runner_serial

@runner_serial
def get_vel_params(serial):
  with pyAPT.Controller(serial_number=serial) as con:
    min_vel, acc, max_vel = con.velocity_parameters()
    print '\tController velocity parameters:'
    print '\t\tMin. Velocity: %.2fmm/s'%(min_vel)
    print '\t\tAcceleration: %.2fmm/s/s'%(acc)
    print '\t\tMax. Velocity: %.2fmm/s'%(max_vel)

if __name__ == '__main__':
  import sys
  sys.exit(get_vel_params())

{'fraction_non_alphanumeric': 0.1256484149855908, 'fraction_numerical': 0.0069164265129683, 'mean_word_length': 3.568421052631579, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 6, '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': '5863270', 'n_tokens_mistral': 645, 'n_tokens_neox': 611, 'n_words': 167}