


"""simple docstring"""





import unittest

import numpy as np
import torch

from .utils_summarization import build_mask, compute_token_type_ids, process_story, truncate_or_pad



class 		snake_case_(       unittest.TestCase			):






     def      lowerCamelCase__     (	self  :					Union[str, Any]				):
           lowerCAmelCase					:	Any       =   1_0






     def      lowerCamelCase__     (	self  :					List[Any]				):
           lowerCAmelCase					:	str       =   [1, 2, 3, 4]
           lowerCAmelCase					:	Union[str, Any]       =   [1, 2, 3, 4, 0, 0, 0, 0, 0, 0]
           self.assertEqual(truncate_or_pad(UpperCamelCase_					,				self.block_size					,				0				)					,				UpperCamelCase_				)






     def      lowerCamelCase__     (	self  :					Optional[Any]				):
           lowerCAmelCase					:	Optional[Any]       =   [1, 2, 3, 4, 5, 6, 7, 8, 9, 1_0]
           lowerCAmelCase					:	int       =   [1, 2, 3, 4, 5, 6, 7, 8, 9, 1_0]
           self.assertEqual(truncate_or_pad(UpperCamelCase_					,				self.block_size					,				0				)					,				UpperCamelCase_				)






     def      lowerCamelCase__     (	self  :					Tuple				):
           lowerCAmelCase					:	Any       =   [1, 2, 3, 4, 5, 6, 7, 8, 9, 1_0, 1_1, 1_2, 1_3]
           lowerCAmelCase					:	Optional[Any]       =   [1, 2, 3, 4, 5, 6, 7, 8, 9, 1_0]
           self.assertEqual(truncate_or_pad(UpperCamelCase_					,				self.block_size					,				0				)					,				UpperCamelCase_				)






     def      lowerCamelCase__     (	self  :					Tuple				):
           lowerCAmelCase					:	Optional[int]       =   '''It was the year of Our Lord one thousand seven hundred and
        seventy-five.\n\nSpiritual revelations were conceded to England at that
        favoured period, as at this.'''
           lowerCAmelCase					:	Union[str, Any]       =   process_story(UpperCamelCase_				)
           self.assertEqual(UpperCamelCase_					,				[]				)






     def      lowerCamelCase__     (	self  :					List[str]				):
           lowerCAmelCase					:	List[Any]       =   ''''''
           lowerCAmelCase					:	str       =   process_story(UpperCamelCase_				)
           self.assertEqual(UpperCamelCase_					,				[]				)
           self.assertEqual(UpperCamelCase_					,				[]				)






     def      lowerCamelCase__     (	self  :					List[Any]				):
           lowerCAmelCase					:	int       =   (
               '''It was the year of Our Lord one thousand seven hundred and '''
               '''seventy-five\n\nSpiritual revelations were conceded to England '''
               '''at that favoured period, as at this.\n@highlight\n\nIt was the best of times'''
           )
           lowerCAmelCase					:	Union[str, Any]       =   process_story(UpperCamelCase_				)

           lowerCAmelCase					:	Dict       =   [
               '''It was the year of Our Lord one thousand seven hundred and seventy-five.''',
               '''Spiritual revelations were conceded to England at that favoured period, as at this.''',
           ]
           self.assertEqual(UpperCamelCase_					,				UpperCamelCase_				)

           lowerCAmelCase					:	str       =   ['''It was the best of times.''']
           self.assertEqual(UpperCamelCase_					,				UpperCamelCase_				)






     def      lowerCamelCase__     (	self  :					int				):
           lowerCAmelCase					:	Dict       =   torch.tensor([1, 2, 3, 4]				)
           lowerCAmelCase					:	str       =   torch.tensor([1, 1, 1, 1]				)
           np.testing.assert_array_equal(build_mask(UpperCamelCase_					,				0				).numpy()					,				expected.numpy()				)






     def      lowerCamelCase__     (	self  :					Optional[Any]				):
           lowerCAmelCase					:	Optional[int]       =   torch.tensor([1, 2, 3, 4, 2_3, 2_3, 2_3]				)
           lowerCAmelCase					:	Tuple       =   torch.tensor([1, 1, 1, 1, 0, 0, 0]				)
           np.testing.assert_array_equal(build_mask(UpperCamelCase_					,				2_3				).numpy()					,				expected.numpy()				)






     def      lowerCamelCase__     (	self  :					List[Any]				):
           lowerCAmelCase					:	Any       =   torch.tensor([8, 2, 3, 4, 1, 1, 1]				)
           lowerCAmelCase					:	List[Any]       =   torch.tensor([1, 1, 1, 1, 0, 0, 0]				)
           np.testing.assert_array_equal(build_mask(UpperCamelCase_					,				1				).numpy()					,				expected.numpy()				)






     def      lowerCamelCase__     (	self  :					List[Any]				):
           lowerCAmelCase					:	Union[str, Any]       =   1_0_1
           lowerCAmelCase					:	Union[str, Any]       =   torch.tensor([[1, 2, 3, 4, 5, 6], [1, 2, 3, 1_0_1, 5, 6], [1, 1_0_1, 3, 4, 1_0_1, 6]]				)
           lowerCAmelCase					:	str       =   torch.tensor([[1, 1, 1, 1, 1, 1], [1, 1, 1, 0, 0, 0], [1, 0, 0, 0, 1, 1]]				)

           lowerCAmelCase					:	Dict       =   compute_token_type_ids(UpperCamelCase_					,				UpperCamelCase_				)
           np.testing.assert_array_equal(UpperCamelCase_					,				UpperCamelCase_				)






"""simple docstring"""





snake_case__		:     List[Any]    				=				'''Tobias Carryer'''

from time import time



class 		snake_case_:






     def __init__(	self  :					Optional[Any]					,				UpperCamelCase_  :					Optional[Any]					,				UpperCamelCase_  :					Tuple					,				UpperCamelCase_  :					Optional[int]					,				UpperCamelCase_  :					Dict=int(time()				)				):  # noqa: B008
           lowerCAmelCase					:	str       =   multiplier
           lowerCAmelCase					:	Optional[int]       =   increment
           lowerCAmelCase					:	Optional[Any]       =   modulo
           lowerCAmelCase					:	Optional[Any]       =   seed






     def      lowerCamelCase__     (	self  :					Union[str, Any]				):
           lowerCAmelCase					:	Optional[int]       =   (self.multiplier * self.seed + self.increment) % self.modulo
           return self.seed


if __name__ == "__main__":
 # Show the LCG in action.
 snake_case__		:     int    				=				LinearCongruentialGenerator(1_664_525, 1_013_904_223, 2 << 31)
 while True:
  print(lcg.next_number())


