
import math


class 		__magic_name__   :





		def __init__(							self    :	List[Any]						,  lowerCamelCase__    :	Any				):
							lowerCAmelCase		:					Dict  	=     len(lowerCamelCase__				)
							lowerCAmelCase		:					Optional[Any]  	=     [0] * (
							    4 * self.N
							)  # approximate the overall size of segment tree with array N
							self.build(1						,  0						,  self.N - 1				)





		def       _A							(							self    :	Union[str, Any]						,  lowerCamelCase__    :	Optional[int]				):
							return idx * 2





		def       _A							(							self    :	Optional[int]						,  lowerCamelCase__    :	str				):
							return idx * 2 + 1





		def       _A							(							self    :	List[Any]						,  lowerCamelCase__    :	Dict						,  lowerCamelCase__    :	str						,  lowerCamelCase__    :	List[str]				):  # noqa: E741
							if l == r:
												lowerCAmelCase		:					List[str]  	=     A[l]
							else:
												lowerCAmelCase		:					str  	=     (l + r) // 2
												self.build(self.left(lowerCamelCase__				)						,  lowerCamelCase__						,  lowerCamelCase__				)
												self.build(self.right(lowerCamelCase__				)						,  mid + 1						,  lowerCamelCase__				)
												lowerCAmelCase		:					Any  	=     max(self.st[self.left(lowerCamelCase__				)]						,  self.st[self.right(lowerCamelCase__				)]				)





		def       _A							(							self    :	int						,  lowerCamelCase__    :	Tuple						,  lowerCamelCase__    :	Optional[int]						,  lowerCamelCase__    :	str				):
							return self.update_recursive(1						,  0						,  self.N - 1						,  a - 1						,  b - 1						,  lowerCamelCase__				)





		def       _A							(							self    :	int						,  lowerCamelCase__    :	Dict						,  lowerCamelCase__    :	Tuple						,  lowerCamelCase__    :	Union[str, Any]						,  lowerCamelCase__    :	Optional[Any]						,  lowerCamelCase__    :	Union[str, Any]						,  lowerCamelCase__    :	Tuple				):  # noqa: E741
							if r < a or l > b:
												return True
							if l == r:
												lowerCAmelCase		:					Tuple  	=     val
												return True
							lowerCAmelCase		:					List[str]  	=     (l + r) // 2
							self.update_recursive(self.left(lowerCamelCase__				)						,  lowerCamelCase__						,  lowerCamelCase__						,  lowerCamelCase__						,  lowerCamelCase__						,  lowerCamelCase__				)
							self.update_recursive(self.right(lowerCamelCase__				)						,  mid + 1						,  lowerCamelCase__						,  lowerCamelCase__						,  lowerCamelCase__						,  lowerCamelCase__				)
							lowerCAmelCase		:					Any  	=     max(self.st[self.left(lowerCamelCase__				)]						,  self.st[self.right(lowerCamelCase__				)]				)
							return True





		def       _A							(							self    :	Tuple						,  lowerCamelCase__    :	str						,  lowerCamelCase__    :	Optional[int]				):
							return self.query_recursive(1						,  0						,  self.N - 1						,  a - 1						,  b - 1				)





		def       _A							(							self    :	Dict						,  lowerCamelCase__    :	str						,  lowerCamelCase__    :	str						,  lowerCamelCase__    :	Tuple						,  lowerCamelCase__    :	int						,  lowerCamelCase__    :	Optional[int]				):  # noqa: E741
							if r < a or l > b:
												return -math.inf
							if l >= a and r <= b:
												return self.st[idx]
							lowerCAmelCase		:					Optional[Any]  	=     (l + r) // 2
							lowerCAmelCase		:					Any  	=     self.query_recursive(self.left(lowerCamelCase__				)						,  lowerCamelCase__						,  lowerCamelCase__						,  lowerCamelCase__						,  lowerCamelCase__				)
							lowerCAmelCase		:					str  	=     self.query_recursive(self.right(lowerCamelCase__				)						,  mid + 1						,  lowerCamelCase__						,  lowerCamelCase__						,  lowerCamelCase__				)
							return max(lowerCamelCase__						,  lowerCamelCase__				)





		def       _A							(							self    :	Optional[int]				):
							lowerCAmelCase		:					str  	=     []
							for i in range(1						,  N + 1				):
												show_list += [self.query(lowerCamelCase__						,  lowerCamelCase__				)]
							print(lowerCamelCase__				)


if __name__ == "__main__":
		__SCREAMING_SNAKE_CASE			:   Optional[Any]         =     [1, 2, -4, 7, 3, -5, 6, 11, -20, 9, 14, 15, 5, 2, -8]
		__SCREAMING_SNAKE_CASE			:   Dict         =     15
		__SCREAMING_SNAKE_CASE			:   List[str]         =     SegmentTree(A)
		print(segt.query(4, 6))
		print(segt.query(7, 11))
		print(segt.query(7, 12))
		segt.update(1, 3, 1_11)
		print(segt.query(1, 15))
		segt.update(7, 8, 2_35)
		segt.show_data()


import json
import os
import tempfile
import unittest

from transformers.modelcard import ModelCard


class 		__magic_name__   (						unittest.TestCase    ):





		def       _A							(							self    :	Dict				):
							lowerCAmelCase		:					List[Any]  	=     {
							    '''model_details''': {
							        '''Organization''': '''testing''',
							        '''Model date''': '''today''',
							        '''Model version''': '''v2.1, Developed by Test Corp in 2019.''',
							        '''Architecture''': '''Convolutional Neural Network.''',
							    },
							    '''metrics''': '''BLEU and ROUGE-1''',
							    '''evaluation_data''': {
							        '''Datasets''': {'''BLEU''': '''My-great-dataset-v1''', '''ROUGE-1''': '''My-short-dataset-v2.1'''},
							        '''Preprocessing''': '''See details on https://arxiv.org/pdf/1810.03993.pdf''',
							    },
							    '''training_data''': {
							        '''Dataset''': '''English Wikipedia dump dated 2018-12-01''',
							        '''Preprocessing''': (
							            '''Using SentencePiece vocabulary of size 52k tokens. See details on'''
							            ''' https://arxiv.org/pdf/1810.03993.pdf'''
							        ),
							    },
							    '''quantitative_analyses''': {'''BLEU''': 5_5.1, '''ROUGE-1''': 7_6},
							}





		def       _A							(							self    :	str				):
							lowerCAmelCase		:					Dict  	=     ModelCard.from_dict(self.inputs_dict				)
							self.assertTrue(hasattr(lowerCamelCase__						,  '''model_details'''				)				)
							self.assertTrue(hasattr(lowerCamelCase__						,  '''intended_use'''				)				)
							self.assertTrue(hasattr(lowerCamelCase__						,  '''factors'''				)				)
							self.assertTrue(hasattr(lowerCamelCase__						,  '''metrics'''				)				)
							self.assertTrue(hasattr(lowerCamelCase__						,  '''evaluation_data'''				)				)
							self.assertTrue(hasattr(lowerCamelCase__						,  '''training_data'''				)				)
							self.assertTrue(hasattr(lowerCamelCase__						,  '''quantitative_analyses'''				)				)
							self.assertTrue(hasattr(lowerCamelCase__						,  '''ethical_considerations'''				)				)
							self.assertTrue(hasattr(lowerCamelCase__						,  '''caveats_and_recommendations'''				)				)





		def       _A							(							self    :	Optional[Any]				):
							lowerCAmelCase		:					Tuple  	=     ModelCard.from_dict(self.inputs_dict				)
							lowerCAmelCase		:					Dict  	=     json.loads(modelcard.to_json_string()				)
							for key, value in self.inputs_dict.items():
												self.assertEqual(obj[key]						,  lowerCamelCase__				)





		def       _A							(							self    :	Tuple				):
							lowerCAmelCase		:					Tuple  	=     ModelCard.from_dict(self.inputs_dict				)

							with tempfile.TemporaryDirectory() as tmpdirname:
												lowerCAmelCase		:					str  	=     os.path.join(lowerCamelCase__						,  '''modelcard.json'''				)
												model_card_first.to_json_file(lowerCamelCase__				)
												lowerCAmelCase		:					Dict  	=     ModelCard.from_json_file(lowerCamelCase__				)

							self.assertEqual(model_card_second.to_dict()						,  model_card_first.to_dict()				)





		def       _A							(							self    :	Union[str, Any]				):
							lowerCAmelCase		:					int  	=     ModelCard.from_dict(self.inputs_dict				)

							with tempfile.TemporaryDirectory() as tmpdirname:
												model_card_first.save_pretrained(lowerCamelCase__				)
												lowerCAmelCase		:					Any  	=     ModelCard.from_pretrained(lowerCamelCase__				)

							self.assertEqual(model_card_second.to_dict()						,  model_card_first.to_dict()				)
