<commit_before>#!/usr/bin/python

def reading(sensor):
    import time
    import RPi.GPIO as GPIO
    
    GPIO.setwarnings(False)
    
    GPIO.setmode(GPIO.BCM)
    
    if sensor == 0:
        
        GPIO.setup(17,GPIO.OUT)
        GPIO.setup(27,GPIO.IN)
        GPIO.output(17, GPIO.LOW)
        
        time.sleep(0.3)
        
        GPIO.output(17, True)
        
        time.sleep(0.00001)
        
        GPIO.output(17, False)

        while GPIO.input(27) == 0:
            signaloff = time.time()
        
        while GPIO.input(27) == 1:
            signalon = time.time()
        
        timepassed = signalon - signaloff
        
        distance_cm = timepassed * 17000
	distance_in = distance_cm * float(0.39)        
        return distance_in
        
        GPIO.cleanup()

    else:
        print "Incorrect usonic() function varible."

x = reading(0)
print "The distance is %f" % x,
print "inches"<commit_msg>minor cleanup on sonar.py<commit_after>#!/usr/bin/python

def reading(sensor):
    import time
    import RPi.GPIO as GPIO
    
    GPIO.setwarnings(False)
    
    GPIO.setmode(GPIO.BCM)
    
    if sensor == 0:
        
        GPIO.setup(17,GPIO.OUT)
        GPIO.setup(27,GPIO.IN)
        GPIO.output(17, GPIO.LOW)
        
        time.sleep(0.3)
        
        GPIO.output(17, True)
        
        time.sleep(0.00001)
        
        GPIO.output(17, False)

        while GPIO.input(27) == 0:
            signaloff = time.time()
        
        while GPIO.input(27) == 1:
            signalon = time.time()
        
        timepassed = signalon - signaloff
        
        distance_cm = timepassed * 17000
	       
        return distance_cm
         
        GPIO.cleanup()

    else:
        print "Incorrect usonic() function varible."

x = reading(0)
print "The distance is %f" % x,
print "centimeters"

inches = x * float(0.39)
print "The distance is %f" % inches,
print "inches"
{'fraction_non_alphanumeric': 0.10824742268041238, 'fraction_numerical': 0.03505154639175258, 'mean_word_length': 1.5674603174603174, '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': '1027405', 'n_tokens_mistral': 672, 'n_tokens_neox': 620, 'n_words': 134}