<commit_before>
import time
import datetime
import RPi.GPIO as GPIO



def __init__(self, pin):

if __name__ == "__main__":
	GPIO.setmode(GPIO.BOARD)
	GPIO.setup(12, GPIO.IN)


def flowing():
	count = 0
	realtime = time.time()
	prevtime = time.time()

	while True:
		prevtest = GPIO.input(12)
		time.sleep(.01)
		test = GPIO.input(12)

		if (test == 0 and prevtest == 1) or (test == 1 and prevtest == 0):
			count += 1
			prevtime = time.time()
			realtime = time.time()
		else:
			realtime = time.time()

		tdelta = realtime - prevtime
		if tdelta > 2 and count > 1:
			break

	return count<commit_msg>add functionality for portability, extrapolation, and structure optimization<commit_after>
import time
import datetime
import RPi.GPIO as GPIO

class FlowmeterValve():

	def __init__(self, pin):
		self._pin = pin
		GPIO.setmode(GPIO.BOARD)
		GPIO.setup(pin, GPIO.IN)


def flowing(self):
	count = 0
	realtime = time.time()
	prevtime = time.time()

	while True:
		prevtest = GPIO.input(self._pin)
		time.sleep(.01)
		test = GPIO.input(self._pin)

		if (test == 0 and prevtest == 1) or (test == 1 and prevtest == 0):
			count += 1
			prevtime = time.time()
			realtime = time.time()
		else:
			realtime = time.time()

		tdelta = realtime - prevtime
		if tdelta > 2 and count > 1:
			break

	return count
{'fraction_non_alphanumeric': 0.12576687116564417, 'fraction_numerical': 0.019938650306748466, 'mean_word_length': 3.3069306930693068, 'pattern_counts': {'":': 1, '<': 3, '<?xml version=': 0, '>': 7, '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': '5233026', 'n_tokens_mistral': 533, 'n_tokens_neox': 458, 'n_words': 139}