<commit_before>import BaseHTTPServer
from time import sleep

import serial
from Phidgets.Devices.Stepper import Stepper

# connArduino = serial.Serial('/dev/ttyACM0', 9600)
connArduino = serial.Serial('/dev/tty.usbmodemc041', 9600)

connPhidget = Stepper()

class HTTPHandler(BaseHTTPServer.BaseHTTPRequestHandler):
  def do_GET(self):
    command = self.path[1:].split('/')

    if command[0][0] == 'd' or command[0][0] == 't':
      connArduino.write(command[0][0] + command[1] + '\n')
      print 'MOVE: %s %s units' % (command[0][0], command[1])

    elif command[0][0] == 'r':
      print 'MOVE: Rotating %s degrees' % command[1]
      connPhidget.openPhidget()
      connPhidget.waitForAttach(10000)
      connPhidget.setCurrentPosition(0, 0)
      # sleep(1)
      connPhidget.setEngaged(0, True)
      # sleep(1)
      connPhidget.setAcceleration(0, 87543)
      connPhidget.setVelocityLimit(0, 40000)
      connPhidget.setCurrentLimit(0, .7)
      # sleep(2)

      target = int(90 * 200 * 16 * int(command[1]) / 360)
      connPhidget.setTargetPosition(0, target)

      while connPhidget.getCurrentPosition(0) != target:
        pass<commit_msg>Fix case where need to pause in between rotates<commit_after>import BaseHTTPServer
from time import sleep

import serial
from Phidgets.Devices.Stepper import Stepper

# connArduino = serial.Serial('/dev/ttyACM0', 9600)
connArduino = serial.Serial('/dev/tty.usbmodemc041', 9600)

connPhidget = Stepper()

class HTTPHandler(BaseHTTPServer.BaseHTTPRequestHandler):
  def do_GET(self):
    command = self.path[1:].split('/')

    if command[0][0] == 'd' or command[0][0] == 't':
      connArduino.write(command[0][0] + command[1] + '\n')
      print 'MOVE: %s %s units' % (command[0][0], command[1])

    elif command[0][0] == 'r':
      print 'MOVE: Rotating %s degrees' % command[1]
      connPhidget.openPhidget()
      connPhidget.waitForAttach(10000)
      connPhidget.setCurrentPosition(0, 0)
      # sleep(1)
      connPhidget.setEngaged(0, True)
      # sleep(1)
      connPhidget.setAcceleration(0, 87543)
      connPhidget.setVelocityLimit(0, 40000)
      connPhidget.setCurrentLimit(0, .7)
      sleep(1)

      target = int(90 * 200 * 16 * int(command[1]) / 360)
      connPhidget.setTargetPosition(0, target)

      while connPhidget.getCurrentPosition(0) != target:
        pass
{'fraction_non_alphanumeric': 0.14035836177474403, 'fraction_numerical': 0.05460750853242321, 'mean_word_length': 3.6161417322834644, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '2175764', 'n_tokens_mistral': 879, 'n_tokens_neox': 813, 'n_words': 163}