






'''simple docstring'''

import unittest

from transformers import is_torch_available
from transformers.testing_utils import require_torch


if is_torch_available():
						import torch

						from transformers.generation import DisjunctiveConstraint






@require_torch
class 							__magic_name__     (	unittest.TestCase				):







	"""simple docstring"""



	def        lowerCamelCase__		(							self       )						->  str:
							# For consistency across different places the DisjunctiveConstraint is called,
							# dc.token_ids is a list of integers. It is also initialized only by integers.

							lowercase_      :   Optional[Any]        =			[[1, 2, 4], [1, 2, 3, 4]]
							lowercase_      :   int        =			DisjunctiveConstraint(_lowercase       )
							self.assertTrue(isinstance(dc.token_ids  ,      _lowercase       )       )

							with self.assertRaises(_lowercase       ):
													DisjunctiveConstraint(torch.LongTensor([[1, 2, 4], [1, 2, 3]]       )       )

							with self.assertRaises(_lowercase       ):
													DisjunctiveConstraint([torch.LongTensor([1, 2, 4]       ), torch.LongTensor([1, 2, 3, 4, 5]       )]       )
	def        lowerCamelCase__		(							self       )						->  Union[str, Any]:
							# We can't have constraints that are complete subsets of another. This leads to a preverse
							# interpretation of "constraint fulfillment": does generating [1,2,3] fulfill the constraint?
							# It would mean that it generated [1,2] which fulfills it, but it's in the middle of potentially
							# fulfilling [1,2,3,4]. If we believe that [1,2,3] does fulfill the constraint, then the algorithm
							# will necessarily never reach [1,2,3,4], giving users a false sense of control (better to just not allow it).
							lowercase_      :   Optional[Any]        =			[[1, 2], [1, 2, 3, 4]]

							with self.assertRaises(_lowercase       ):
													DisjunctiveConstraint(_lowercase       )  # fails here
	def        lowerCamelCase__		(							self       )						->  Optional[Any]:
							lowercase_      :   Optional[Any]        =			[[1, 2, 3], [1, 2, 4]]

							lowercase_      :   Any        =			DisjunctiveConstraint(_lowercase       )

							lowercase_  ,      lowercase_  ,      lowercase_      :   List[Any]        =			dc.update(1       )
							lowercase_      :   List[Any]        =			stepped is True and completed is False and reset is False
							self.assertTrue(_lowercase       )
							self.assertTrue(not dc.completed       )
							self.assertTrue(dc.current_seq == [1]       )

							lowercase_  ,      lowercase_  ,      lowercase_      :   int        =			dc.update(2       )
							lowercase_      :   Dict        =			stepped is True and completed is False and reset is False
							self.assertTrue(_lowercase       )
							self.assertTrue(not dc.completed       )
							self.assertTrue(dc.current_seq == [1, 2]       )

							lowercase_  ,      lowercase_  ,      lowercase_      :   Optional[Any]        =			dc.update(3       )
							lowercase_      :   int        =			stepped is True and completed is True and reset is False
							self.assertTrue(_lowercase       )
							self.assertTrue(dc.completed       )  # Completed!
							self.assertTrue(dc.current_seq == [1, 2, 3]       )







	def        lowerCamelCase__		(							self       )						->  List[Any]:
							lowercase_      :   List[Any]        =			[[1, 2, 3], [1, 2, 4, 5], [1, 2, 5]]

							lowercase_      :   int        =			DisjunctiveConstraint(_lowercase       )

							lowercase_  ,      lowercase_  ,      lowercase_      :   Union[str, Any]        =			dc.update(1       )
							self.assertTrue(not dc.completed       )
							self.assertTrue(dc.current_seq == [1]       )

							lowercase_  ,      lowercase_  ,      lowercase_      :   Union[str, Any]        =			dc.update(2       )
							self.assertTrue(not dc.completed       )
							self.assertTrue(dc.current_seq == [1, 2]       )

							lowercase_  ,      lowercase_  ,      lowercase_      :   Tuple        =			dc.update(4       )
							self.assertTrue(not dc.completed       )
							self.assertTrue(dc.current_seq == [1, 2, 4]       )

							lowercase_  ,      lowercase_  ,      lowercase_      :   Optional[int]        =			dc.update(5       )
							self.assertTrue(dc.completed       )  # Completed!
							self.assertTrue(dc.current_seq == [1, 2, 4, 5]       )

							dc.reset()

							lowercase_  ,      lowercase_  ,      lowercase_      :   int        =			dc.update(1       )
							self.assertTrue(not dc.completed       )
							self.assertTrue(dc.remaining() == 3       )
							self.assertTrue(dc.current_seq == [1]       )

							lowercase_  ,      lowercase_  ,      lowercase_      :   Tuple        =			dc.update(2       )
							self.assertTrue(not dc.completed       )
							self.assertTrue(dc.remaining() == 2       )
							self.assertTrue(dc.current_seq == [1, 2]       )

							lowercase_  ,      lowercase_  ,      lowercase_      :   Optional[int]        =			dc.update(5       )
							self.assertTrue(dc.completed       )  # Completed!
							self.assertTrue(dc.remaining() == 0       )
							self.assertTrue(dc.current_seq == [1, 2, 5]       )








'''simple docstring'''

def 	_UpperCAmelCase    (  a		:	int						,			a		:	int							)			->			int:





						"""simple docstring"""
						while second != 0:
												lowercase_      :   Any        =			first & second
												first ^= second
												lowercase_      :   List[str]        =			c << 1
						return first


if __name__ == "__main__":
						import doctest

						doctest.testmod()

						A:      Union[str, Any]  				=				int(input("Enter the first number: ").strip())
						A:      Union[str, Any]  				=				int(input("Enter the second number: ").strip())
						print(f"""{add(first, second) = }""")
