code: 
  
  
  
  '''simple docstring'''
  
  
  
  import json
  import os
  import tempfile
  import unittest
  
  from transformers.modelcard import ModelCard
  class        UpperCAmelCase__  (    unittest.TestCase):
  
  
  
  	def    __lowerCamelCase				(  self			)  ->							Optional[Any]:
  		__UpperCamelCase				      =  {
  		    """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""": 55.1, """ROUGE-1""": 7_6},
  		}
  
  
  
  	def    __lowerCamelCase				(  self			)  ->							List[Any]:
  		__UpperCamelCase				      =  ModelCard.from_dict(self.inputs_dict			)
  		self.assertTrue(hasattr(lowercase		,	"""model_details"""			)			)
  		self.assertTrue(hasattr(lowercase		,	"""intended_use"""			)			)
  		self.assertTrue(hasattr(lowercase		,	"""factors"""			)			)
  		self.assertTrue(hasattr(lowercase		,	"""metrics"""			)			)
  		self.assertTrue(hasattr(lowercase		,	"""evaluation_data"""			)			)
  		self.assertTrue(hasattr(lowercase		,	"""training_data"""			)			)
  		self.assertTrue(hasattr(lowercase		,	"""quantitative_analyses"""			)			)
  		self.assertTrue(hasattr(lowercase		,	"""ethical_considerations"""			)			)
  		self.assertTrue(hasattr(lowercase		,	"""caveats_and_recommendations"""			)			)
  
  
  
  	def    __lowerCamelCase				(  self			)  ->							List[str]:
  		__UpperCamelCase				      =  ModelCard.from_dict(self.inputs_dict			)
  		__UpperCamelCase				      =  json.loads(modelcard.to_json_string()			)
  		for key, value in self.inputs_dict.items():
  			self.assertEqual(obj[key]		,	lowercase			)
  
  
  
  	def    __lowerCamelCase				(  self			)  ->							int:
  		__UpperCamelCase				      =  ModelCard.from_dict(self.inputs_dict			)
  
  		with tempfile.TemporaryDirectory() as tmpdirname:
  			__UpperCamelCase				      =  os.path.join(lowercase		,	"""modelcard.json"""			)
  			model_card_first.to_json_file(lowercase			)
  			__UpperCamelCase				      =  ModelCard.from_json_file(lowercase			)
  
  		self.assertEqual(model_card_second.to_dict()		,	model_card_first.to_dict()			)
  
  
  
  
  	def    __lowerCamelCase				(  self			)  ->							Optional[int]:
  		__UpperCamelCase				      =  ModelCard.from_dict(self.inputs_dict			)
  
  		with tempfile.TemporaryDirectory() as tmpdirname:
  			model_card_first.save_pretrained(lowercase			)
  			__UpperCamelCase				      =  ModelCard.from_pretrained(lowercase			)
  
  		self.assertEqual(model_card_second.to_dict()		,	model_card_first.to_dict()			)
  
  
  
  
  
  
style_context: 
  
  
  
  '''simple docstring'''
  
  
  
  def _lowercase   (  __A							,__A       ):
  
  
  
   '''simple docstring'''
  
  
  
   __UpperCamelCase				      =  1
   while b > 0:
    if b & 1:
     res *= a
  
    a *= a
    b >>= 1
  
   return res
  
  
  
  
  
  
  
  def _lowercase   (  __A							,__A							,__A       ):
  
  
  
   '''simple docstring'''
  
  
  
   __UpperCamelCase				      =  1
   while b > 0:
    if b & 1:
     __UpperCamelCase				      =  ((res % c) * (a % c)) % c
  
    a *= a
    b >>= 1
  
   return res
  
  
  
  
  
  