




'''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 			_a  (	unittest.TestCase ):
       def     A      (	self						:	List[str]				):



           '''simple docstring'''

           UpperCAmelCase			       =		[[1, 2, 4], [1, 2, 3, 4]]
           UpperCAmelCase			       =		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     A      (	self						:	Dict				):



           '''simple docstring'''

           UpperCAmelCase			       =		[[1, 2], [1, 2, 3, 4]]

           with self.assertRaises(lowercase				):
               DisjunctiveConstraint(lowercase				)  # fails here
       def     A      (	self						:	Optional[int]				):



           '''simple docstring'''

           UpperCAmelCase			       =		[[1, 2, 3], [1, 2, 4]]

           UpperCAmelCase			       =		DisjunctiveConstraint(lowercase				)

           UpperCAmelCase       ,     UpperCAmelCase       ,     UpperCAmelCase			       =		dc.update(1				)
           UpperCAmelCase			       =		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]				)

           UpperCAmelCase       ,     UpperCAmelCase       ,     UpperCAmelCase			       =		dc.update(2				)
           UpperCAmelCase			       =		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]				)

           UpperCAmelCase       ,     UpperCAmelCase       ,     UpperCAmelCase			       =		dc.update(3				)
           UpperCAmelCase			       =		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     A      (	self						:	Union[str, Any]				):



           '''simple docstring'''

           UpperCAmelCase			       =		[[1, 2, 3], [1, 2, 4, 5], [1, 2, 5]]

           UpperCAmelCase			       =		DisjunctiveConstraint(lowercase				)

           UpperCAmelCase       ,     UpperCAmelCase       ,     UpperCAmelCase			       =		dc.update(1				)
           self.assertTrue(not dc.completed				)
           self.assertTrue(dc.current_seq == [1]				)

           UpperCAmelCase       ,     UpperCAmelCase       ,     UpperCAmelCase			       =		dc.update(2				)
           self.assertTrue(not dc.completed				)
           self.assertTrue(dc.current_seq == [1, 2]				)

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

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

           dc.reset()

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

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

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










'''simple docstring'''







import os





def 						snake_case_							():
    UpperCAmelCase			       =		os.path.join(os.path.dirname(_a     )    ,   '''num.txt'''     )
    with open(_a     ) as file_hand:
        return str(sum(int(_a     ) for line in file_hand     )     )[:1_0]


if __name__ == "__main__":
   print(solution())




