





'''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 					__snake_case  (					unittest.TestCase							):






   '''simple docstring'''





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

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

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

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

   def 		__UpperCamelCase						(							self       ):
    # 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).
    snake_case__     :					Union[str, Any]    =  [[1, 2], [1, 2, 3, 4]]

    with self.assertRaises(__SCREAMING_SNAKE_CASE       ):
     DisjunctiveConstraint(__SCREAMING_SNAKE_CASE       )  # fails here

   def 		__UpperCamelCase						(							self       ):
    snake_case__     :					List[str]    =  [[1, 2, 3], [1, 2, 4]]

    snake_case__     :					Optional[int]    =  DisjunctiveConstraint(__SCREAMING_SNAKE_CASE       )

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

    snake_case__  ,							snake_case__  ,							snake_case__     :					Tuple    =  dc.update(2       )
    snake_case__     :					Tuple    =  stepped is True and completed is False and reset is False
    self.assertTrue(__SCREAMING_SNAKE_CASE       )
    self.assertTrue(not dc.completed       )
    self.assertTrue(dc.current_seq == [1, 2]       )

    snake_case__  ,							snake_case__  ,							snake_case__     :					Union[str, Any]    =  dc.update(3       )
    snake_case__     :					List[str]    =  stepped is True and completed is True and reset is False
    self.assertTrue(__SCREAMING_SNAKE_CASE       )
    self.assertTrue(dc.completed       )  # Completed!
    self.assertTrue(dc.current_seq == [1, 2, 3]       )


   def 		__UpperCamelCase						(							self       ):
    snake_case__     :					Optional[Any]    =  [[1, 2, 3], [1, 2, 4, 5], [1, 2, 5]]

    snake_case__     :					int    =  DisjunctiveConstraint(__SCREAMING_SNAKE_CASE       )

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

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

    snake_case__  ,							snake_case__  ,							snake_case__     :					List[Any]    =  dc.update(4       )
    self.assertTrue(not dc.completed       )
    self.assertTrue(dc.current_seq == [1, 2, 4]       )

    snake_case__  ,							snake_case__  ,							snake_case__     :					Union[str, Any]    =  dc.update(5       )
    self.assertTrue(dc.completed       )  # Completed!
    self.assertTrue(dc.current_seq == [1, 2, 4, 5]       )

    dc.reset()

    snake_case__  ,							snake_case__  ,							snake_case__     :					List[Any]    =  dc.update(1       )
    self.assertTrue(not dc.completed       )
    self.assertTrue(dc.remaining() == 3       )
    self.assertTrue(dc.current_seq == [1]       )

    snake_case__  ,							snake_case__  ,							snake_case__     :					List[Any]    =  dc.update(2       )
    self.assertTrue(not dc.completed       )
    self.assertTrue(dc.remaining() == 2       )
    self.assertTrue(dc.current_seq == [1, 2]       )

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








def     __SCREAMING_SNAKE_CASE							(       )		->     Optional[int]:




						'''simple docstring'''







						__UpperCAmelCase			:							str	    =	[31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]

						__UpperCAmelCase			:							Union[str, Any]	    =	6
						__UpperCAmelCase			:							Optional[Any]	    =	1
						__UpperCAmelCase			:							Tuple	    =	1901

						__UpperCAmelCase			:							Any	    =	0

						while year < 2001:
												day += 7

												if (year % 4 == 0 and year % 100 != 0) or (year % 400 == 0):
																		if day > days_per_month[month - 1] and month != 2:
																								month += 1
																								__UpperCAmelCase			:							Optional[int]	    =	day - days_per_month[month - 2]
																		elif day > 29 and month == 2:
																								month += 1
																								__UpperCAmelCase			:							Optional[Any]	    =	day - 29
												else:
																		if day > days_per_month[month - 1]:
																								month += 1
																								__UpperCAmelCase			:							Optional[Any]	    =	day - days_per_month[month - 2]

												if month > 12:
																		year += 1
																		__UpperCAmelCase			:							int	    =	1

												if year < 2001 and day == 1:
																		sundays += 1
						return sundays


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

