<commit_before>from BinPy.Gates import *

class SRLatch:

	def __init__(self, R, S):
		"""
		Construct an SRLatch with initial reset input R and set input S.
		"""

		self.a = Connector()
		self.b = Connector()

		self.g1 = NOR(R, self.b)
		self.g1.setOutput(self.a)

		self.g2 = NOR(S, self.a)
		self.g2.setOutput(self.b)

	def setInputs(self, R, S):
		"""
		Set this SRLatch's reset input to R and set input to S.
		Unstable behaviour when transitioning directly from RS = 11 to RS = 00.
		"""

		self.g1.setInputs(R, self.b)
		self.g2.setInputs(S, self.a)

	def output(self):
		"""
		Return the output of this SRLatch in the format [Q, ~Q].
		"""

		return [self.g1.output(), self.g2.output()]

class DFlipFlop:

	def __init__(self,input1,input2):

		self.a = Connector()
		self.b = Connector()
		self.c = Connector()
		self.d = Connector()

		self.g1 = NAND(input1,input2)
		self.g1.setOutput(self.a)

		self.g2 = NAND(self.a,input2)
		self.g2.setOutput(self.b)

		self.g3 = NAND(self.a,self.d)
		self.g3.setOutput(self.c)

		self.g4 = NAND(self.b,self.c)
		self.g4.setOutput(self.d)

	def output(self):

		return [self.g3.output(),self.g4.output()]

	def setInputs(self,input1,input2):

		self.g1.setInput(0,input1)
		self.g1.setInput(1,input2)
		self.g2.setInput(1,input2)<commit_msg>Updated sequential.py to conform to PEP8 guidelines.<commit_after>from BinPy.Gates import *


class SRLatch:

    def __init__(self, R, S):
        """
        Construct an SRLatch with initial reset input R and set input S.
        """

        self.a = Connector()
        self.b = Connector()

        self.g1 = NOR(R, self.b)
        self.g1.setOutput(self.a)

        self.g2 = NOR(S, self.a)
        self.g2.setOutput(self.b)

    def setInputs(self, R, S):
        """
        Set this SRLatch's reset input to R and set input to S.
        Unstable behaviour when transitioning directly from RS = 11 to RS = 00.
        """

        self.g1.setInput(0, R)
        self.g2.setInput(0, S)

    def output(self):
        """
        Return the output of this SRLatch in the format [Q, Q'].
        """

        return [self.g1.output(), self.g2.output()]


class DFlipFlop:

    def __init__(self, input1, input2):

        self.a = Connector()
        self.b = Connector()
        self.c = Connector()
        self.d = Connector()

        self.g1 = NAND(input1, input2)
        self.g1.setOutput(self.a)

        self.g2 = NAND(self.a, input2)
        self.g2.setOutput(self.b)

        self.g3 = NAND(self.a, self.d)
        self.g3.setOutput(self.c)

        self.g4 = NAND(self.b, self.c)
        self.g4.setOutput(self.d)

    def output(self):

        return [self.g3.output(), self.g4.output()]

    def setInputs(self, input1, input2):

        self.g1.setInput(0, input1)
        self.g1.setInput(1, input2)
        self.g2.setInput(1, input2)
{'fraction_non_alphanumeric': 0.1418041418041418, 'fraction_numerical': 0.02772902772902773, 'mean_word_length': 2.4296028880866425, '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': '2243120', 'n_tokens_mistral': 1174, 'n_tokens_neox': 1090, 'n_words': 243}