
"""simple docstring"""



from ..utils import DummyObject, requires_backends
class        _SCREAMING_SNAKE_CASE  (  metaclass=UpperCAmelCase							):






				'''simple docstring'''



				SCREAMING_SNAKE_CASE_:							List[str]							=					["flax"]


				def __init__(					self	:			int				,     *UpperCAmelCase_	:			Union[str, Any]				,     **UpperCAmelCase_	:			Any  )		->  int:







											"""simple docstring"""




											requires_backends(self				,     ['flax']  )


				@classmethod
				def 				__lowerCamelCase	(					cls	:			Any				,     *UpperCAmelCase_	:			Tuple				,     **UpperCAmelCase_	:			List[Any]  )		->  int:







											"""simple docstring"""




											requires_backends(cls				,     ['flax']  )







				@classmethod
				def 				__lowerCamelCase	(					cls	:			Dict				,     *UpperCAmelCase_	:			Tuple				,     **UpperCAmelCase_	:			Union[str, Any]  )		->  List[Any]:







											"""simple docstring"""




											requires_backends(cls				,     ['flax']  )






class        _SCREAMING_SNAKE_CASE  (  metaclass=UpperCAmelCase							):






				'''simple docstring'''



				SCREAMING_SNAKE_CASE_:							Optional[int]							=					["flax"]


				def __init__(					self	:			int				,     *UpperCAmelCase_	:			List[Any]				,     **UpperCAmelCase_	:			Optional[Any]  )		->  Union[str, Any]:







											"""simple docstring"""




											requires_backends(self				,     ['flax']  )


				@classmethod
				def 				__lowerCamelCase	(					cls	:			List[Any]				,     *UpperCAmelCase_	:			Any				,     **UpperCAmelCase_	:			Tuple  )		->  int:







											"""simple docstring"""




											requires_backends(cls				,     ['flax']  )







				@classmethod
				def 				__lowerCamelCase	(					cls	:			int				,     *UpperCAmelCase_	:			Dict				,     **UpperCAmelCase_	:			Union[str, Any]  )		->  Dict:







											"""simple docstring"""




											requires_backends(cls				,     ['flax']  )






class        _SCREAMING_SNAKE_CASE  (  metaclass=UpperCAmelCase							):






				'''simple docstring'''



				SCREAMING_SNAKE_CASE_:							List[str]							=					["flax"]


				def __init__(					self	:			Any				,     *UpperCAmelCase_	:			Optional[int]				,     **UpperCAmelCase_	:			Tuple  )		->  Union[str, Any]:







											"""simple docstring"""




											requires_backends(self				,     ['flax']  )


				@classmethod
				def 				__lowerCamelCase	(					cls	:			str				,     *UpperCAmelCase_	:			List[str]				,     **UpperCAmelCase_	:			List[Any]  )		->  List[Any]:







											"""simple docstring"""




											requires_backends(cls				,     ['flax']  )







				@classmethod
				def 				__lowerCamelCase	(					cls	:			List[Any]				,     *UpperCAmelCase_	:			Any				,     **UpperCAmelCase_	:			int  )		->  Tuple:







											"""simple docstring"""




											requires_backends(cls				,     ['flax']  )






class        _SCREAMING_SNAKE_CASE  (  metaclass=UpperCAmelCase							):






				'''simple docstring'''



				SCREAMING_SNAKE_CASE_:							Union[str, Any]							=					["flax"]


				def __init__(					self	:			Union[str, Any]				,     *UpperCAmelCase_	:			Optional[int]				,     **UpperCAmelCase_	:			List[Any]  )		->  Union[str, Any]:







											"""simple docstring"""




											requires_backends(self				,     ['flax']  )


				@classmethod
				def 				__lowerCamelCase	(					cls	:			Tuple				,     *UpperCAmelCase_	:			Tuple				,     **UpperCAmelCase_	:			str  )		->  Any:







											"""simple docstring"""




											requires_backends(cls				,     ['flax']  )







				@classmethod
				def 				__lowerCamelCase	(					cls	:			Tuple				,     *UpperCAmelCase_	:			Optional[Any]				,     **UpperCAmelCase_	:			List[Any]  )		->  List[Any]:







											"""simple docstring"""




											requires_backends(cls				,     ['flax']  )






class        _SCREAMING_SNAKE_CASE  (  metaclass=UpperCAmelCase							):






				'''simple docstring'''



				SCREAMING_SNAKE_CASE_:							List[str]							=					["flax"]


				def __init__(					self	:			Any				,     *UpperCAmelCase_	:			List[Any]				,     **UpperCAmelCase_	:			Optional[Any]  )		->  List[Any]:







											"""simple docstring"""




											requires_backends(self				,     ['flax']  )


				@classmethod
				def 				__lowerCamelCase	(					cls	:			int				,     *UpperCAmelCase_	:			Dict				,     **UpperCAmelCase_	:			Any  )		->  Dict:







											"""simple docstring"""




											requires_backends(cls				,     ['flax']  )







				@classmethod
				def 				__lowerCamelCase	(					cls	:			int				,     *UpperCAmelCase_	:			Optional[int]				,     **UpperCAmelCase_	:			Any  )		->  Optional[int]:







											"""simple docstring"""




											requires_backends(cls				,     ['flax']  )






class        _SCREAMING_SNAKE_CASE  (  metaclass=UpperCAmelCase							):






				'''simple docstring'''



				SCREAMING_SNAKE_CASE_:							List[str]							=					["flax"]


				def __init__(					self	:			List[Any]				,     *UpperCAmelCase_	:			Optional[int]				,     **UpperCAmelCase_	:			List[str]  )		->  Union[str, Any]:







											"""simple docstring"""




											requires_backends(self				,     ['flax']  )


				@classmethod
				def 				__lowerCamelCase	(					cls	:			Any				,     *UpperCAmelCase_	:			int				,     **UpperCAmelCase_	:			List[str]  )		->  Any:







											"""simple docstring"""




											requires_backends(cls				,     ['flax']  )







				@classmethod
				def 				__lowerCamelCase	(					cls	:			Dict				,     *UpperCAmelCase_	:			int				,     **UpperCAmelCase_	:			str  )		->  Any:







											"""simple docstring"""




											requires_backends(cls				,     ['flax']  )






class        _SCREAMING_SNAKE_CASE  (  metaclass=UpperCAmelCase							):






				'''simple docstring'''



				SCREAMING_SNAKE_CASE_:							List[str]							=					["flax"]


				def __init__(					self	:			Union[str, Any]				,     *UpperCAmelCase_	:			Union[str, Any]				,     **UpperCAmelCase_	:			List[Any]  )		->  Dict:







											"""simple docstring"""




											requires_backends(self				,     ['flax']  )


				@classmethod
				def 				__lowerCamelCase	(					cls	:			List[Any]				,     *UpperCAmelCase_	:			Tuple				,     **UpperCAmelCase_	:			int  )		->  Tuple:







											"""simple docstring"""




											requires_backends(cls				,     ['flax']  )







				@classmethod
				def 				__lowerCamelCase	(					cls	:			int				,     *UpperCAmelCase_	:			int				,     **UpperCAmelCase_	:			Tuple  )		->  Union[str, Any]:







											"""simple docstring"""




											requires_backends(cls				,     ['flax']  )






class        _SCREAMING_SNAKE_CASE  (  metaclass=UpperCAmelCase							):






				'''simple docstring'''



				SCREAMING_SNAKE_CASE_:							Any							=					["flax"]


				def __init__(					self	:			List[str]				,     *UpperCAmelCase_	:			Tuple				,     **UpperCAmelCase_	:			Any  )		->  Optional[Any]:







											"""simple docstring"""




											requires_backends(self				,     ['flax']  )


				@classmethod
				def 				__lowerCamelCase	(					cls	:			Dict				,     *UpperCAmelCase_	:			int				,     **UpperCAmelCase_	:			List[Any]  )		->  List[Any]:







											"""simple docstring"""




											requires_backends(cls				,     ['flax']  )







				@classmethod
				def 				__lowerCamelCase	(					cls	:			List[Any]				,     *UpperCAmelCase_	:			Optional[int]				,     **UpperCAmelCase_	:			Tuple  )		->  Dict:







											"""simple docstring"""




											requires_backends(cls				,     ['flax']  )






class        _SCREAMING_SNAKE_CASE  (  metaclass=UpperCAmelCase							):






				'''simple docstring'''



				SCREAMING_SNAKE_CASE_:							str							=					["flax"]


				def __init__(					self	:			Tuple				,     *UpperCAmelCase_	:			Optional[Any]				,     **UpperCAmelCase_	:			Optional[Any]  )		->  Any:







											"""simple docstring"""




											requires_backends(self				,     ['flax']  )


				@classmethod
				def 				__lowerCamelCase	(					cls	:			Tuple				,     *UpperCAmelCase_	:			Any				,     **UpperCAmelCase_	:			str  )		->  List[Any]:







											"""simple docstring"""




											requires_backends(cls				,     ['flax']  )







				@classmethod
				def 				__lowerCamelCase	(					cls	:			Union[str, Any]				,     *UpperCAmelCase_	:			Dict				,     **UpperCAmelCase_	:			Any  )		->  Optional[int]:







											"""simple docstring"""




											requires_backends(cls				,     ['flax']  )






class        _SCREAMING_SNAKE_CASE  (  metaclass=UpperCAmelCase							):






				'''simple docstring'''



				SCREAMING_SNAKE_CASE_:							Tuple							=					["flax"]


				def __init__(					self	:			Tuple				,     *UpperCAmelCase_	:			Union[str, Any]				,     **UpperCAmelCase_	:			Tuple  )		->  str:







											"""simple docstring"""




											requires_backends(self				,     ['flax']  )


				@classmethod
				def 				__lowerCamelCase	(					cls	:			str				,     *UpperCAmelCase_	:			Union[str, Any]				,     **UpperCAmelCase_	:			Any  )		->  List[Any]:







											"""simple docstring"""




											requires_backends(cls				,     ['flax']  )







				@classmethod
				def 				__lowerCamelCase	(					cls	:			Optional[int]				,     *UpperCAmelCase_	:			Tuple				,     **UpperCAmelCase_	:			Tuple  )		->  List[str]:







											"""simple docstring"""




											requires_backends(cls				,     ['flax']  )






class        _SCREAMING_SNAKE_CASE  (  metaclass=UpperCAmelCase							):






				'''simple docstring'''



				SCREAMING_SNAKE_CASE_:							str							=					["flax"]


				def __init__(					self	:			int				,     *UpperCAmelCase_	:			Tuple				,     **UpperCAmelCase_	:			List[Any]  )		->  List[str]:







											"""simple docstring"""




											requires_backends(self				,     ['flax']  )


				@classmethod
				def 				__lowerCamelCase	(					cls	:			Optional[int]				,     *UpperCAmelCase_	:			Tuple				,     **UpperCAmelCase_	:			List[Any]  )		->  Optional[Any]:







											"""simple docstring"""




											requires_backends(cls				,     ['flax']  )







				@classmethod
				def 				__lowerCamelCase	(					cls	:			Optional[Any]				,     *UpperCAmelCase_	:			Any				,     **UpperCAmelCase_	:			Tuple  )		->  Optional[int]:







											"""simple docstring"""




											requires_backends(cls				,     ['flax']  )






class        _SCREAMING_SNAKE_CASE  (  metaclass=UpperCAmelCase							):






				'''simple docstring'''



				SCREAMING_SNAKE_CASE_:							Optional[int]							=					["flax"]


				def __init__(					self	:			Dict				,     *UpperCAmelCase_	:			List[Any]				,     **UpperCAmelCase_	:			Union[str, Any]  )		->  Optional[int]:







											"""simple docstring"""




											requires_backends(self				,     ['flax']  )


				@classmethod
				def 				__lowerCamelCase	(					cls	:			Union[str, Any]				,     *UpperCAmelCase_	:			Tuple				,     **UpperCAmelCase_	:			Optional[Any]  )		->  Optional[int]:







											"""simple docstring"""




											requires_backends(cls				,     ['flax']  )







				@classmethod
				def 				__lowerCamelCase	(					cls	:			Optional[int]				,     *UpperCAmelCase_	:			Tuple				,     **UpperCAmelCase_	:			Union[str, Any]  )		->  Any:







											"""simple docstring"""




											requires_backends(cls				,     ['flax']  )






class        _SCREAMING_SNAKE_CASE  (  metaclass=UpperCAmelCase							):






				'''simple docstring'''



				SCREAMING_SNAKE_CASE_:							Optional[int]							=					["flax"]


				def __init__(					self	:			List[Any]				,     *UpperCAmelCase_	:			List[str]				,     **UpperCAmelCase_	:			Tuple  )		->  Any:







											"""simple docstring"""




											requires_backends(self				,     ['flax']  )


				@classmethod
				def 				__lowerCamelCase	(					cls	:			int				,     *UpperCAmelCase_	:			Optional[Any]				,     **UpperCAmelCase_	:			Any  )		->  Dict:







											"""simple docstring"""




											requires_backends(cls				,     ['flax']  )







				@classmethod
				def 				__lowerCamelCase	(					cls	:			Any				,     *UpperCAmelCase_	:			Optional[int]				,     **UpperCAmelCase_	:			Union[str, Any]  )		->  int:







											"""simple docstring"""




											requires_backends(cls				,     ['flax']  )








"""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        _SCREAMING_SNAKE_CASE  (  unittest.TestCase							):






				'''simple docstring'''



				def 				__lowerCamelCase	(					self	:			Any  )		->  Dict:







											"""simple docstring"""




											_lowerCAmelCase  	=			10


				def 				__lowerCamelCase	(					self	:			List[Any]  )		->  Optional[int]:







											"""simple docstring"""




											_lowerCAmelCase  	=			[1, 2, 3, 4]
											_lowerCAmelCase  	=			[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[int]  )		->  int:







											"""simple docstring"""




											_lowerCAmelCase  	=			[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
											_lowerCAmelCase  	=			[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
											self.assertEqual(truncate_or_pad(UpperCAmelCase_				,     self.block_size				,     0  )				,     UpperCAmelCase_  )


				def 				__lowerCamelCase	(					self	:			List[Any]  )		->  int:







											"""simple docstring"""




											_lowerCAmelCase  	=			[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
											_lowerCAmelCase  	=			[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
											self.assertEqual(truncate_or_pad(UpperCAmelCase_				,     self.block_size				,     0  )				,     UpperCAmelCase_  )


				def 				__lowerCamelCase	(					self	:			str  )		->  Optional[int]:







											"""simple docstring"""




											_lowerCAmelCase  	=			'It was the year of Our Lord one thousand seven hundred and\n        seventy-five.\n\nSpiritual revelations were conceded to England at that\n        favoured period, as at this.'
											_lowerCAmelCase	,		_lowerCAmelCase  	=			process_story(UpperCAmelCase_  )
											self.assertEqual(UpperCAmelCase_				,     []  )


				def 				__lowerCamelCase	(					self	:			Dict  )		->  Union[str, Any]:







											"""simple docstring"""




											_lowerCAmelCase  	=			''
											_lowerCAmelCase	,		_lowerCAmelCase  	=			process_story(UpperCAmelCase_  )
											self.assertEqual(UpperCAmelCase_				,     []  )
											self.assertEqual(UpperCAmelCase_				,     []  )


				def 				__lowerCamelCase	(					self	:			Optional[int]  )		->  List[str]:







											"""simple docstring"""




											_lowerCAmelCase  	=			(
											    '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	,		_lowerCAmelCase  	=			process_story(UpperCAmelCase_  )

											_lowerCAmelCase  	=			[
											    '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  	=			['It was the best of times.']
											self.assertEqual(UpperCAmelCase_				,     UpperCAmelCase_  )


				def 				__lowerCamelCase	(					self	:			List[str]  )		->  int:







											"""simple docstring"""




											_lowerCAmelCase  	=			torch.tensor([1, 2, 3, 4]  )
											_lowerCAmelCase  	=			torch.tensor([1, 1, 1, 1]  )
											np.testing.assert_array_equal(build_mask(UpperCAmelCase_				,     0  ).numpy()				,     expected.numpy()  )


				def 				__lowerCamelCase	(					self	:			int  )		->  str:







											"""simple docstring"""




											_lowerCAmelCase  	=			torch.tensor([1, 2, 3, 4, 23, 23, 23]  )
											_lowerCAmelCase  	=			torch.tensor([1, 1, 1, 1, 0, 0, 0]  )
											np.testing.assert_array_equal(build_mask(UpperCAmelCase_				,     23  ).numpy()				,     expected.numpy()  )


				def 				__lowerCamelCase	(					self	:			int  )		->  Union[str, Any]:







											"""simple docstring"""




											_lowerCAmelCase  	=			torch.tensor([8, 2, 3, 4, 1, 1, 1]  )
											_lowerCAmelCase  	=			torch.tensor([1, 1, 1, 1, 0, 0, 0]  )
											np.testing.assert_array_equal(build_mask(UpperCAmelCase_				,     1  ).numpy()				,     expected.numpy()  )







				def 				__lowerCamelCase	(					self	:			str  )		->  int:







											"""simple docstring"""




											_lowerCAmelCase  	=			101
											_lowerCAmelCase  	=			torch.tensor([[1, 2, 3, 4, 5, 6], [1, 2, 3, 101, 5, 6], [1, 101, 3, 4, 101, 6]]  )
											_lowerCAmelCase  	=			torch.tensor([[1, 1, 1, 1, 1, 1], [1, 1, 1, 0, 0, 0], [1, 0, 0, 0, 1, 1]]  )

											_lowerCAmelCase  	=			compute_token_type_ids(UpperCAmelCase_				,     UpperCAmelCase_  )
											np.testing.assert_array_equal(UpperCAmelCase_				,     UpperCAmelCase_  )






