
"""simple docstring"""





import json
import os
import tempfile

from transformers.testing_utils import check_json_file_has_correct_format






class     _UpperCAmelCase:
		lowercase__						=      None



		def 						UpperCAmelCase							(					self)       ->       List[str]:






							'''simple docstring'''
							_UpperCamelCase							 =  self.feature_extraction_class(**self.feat_extract_dict)
							_UpperCamelCase							 =  json.loads(feat_extract.to_json_string())
							for key, value in self.feat_extract_dict.items():
												self.assertEqual(obj[key]				,		lowercase_)



		def 						UpperCAmelCase							(					self)       ->       Tuple:






							'''simple docstring'''
							_UpperCamelCase							 =  self.feature_extraction_class(**self.feat_extract_dict)

							with tempfile.TemporaryDirectory() as tmpdirname:
												_UpperCamelCase							 =  os.path.join(lowercase_				,		'''feat_extract.json''')
												feat_extract_first.to_json_file(lowercase_)
												_UpperCamelCase							 =  self.feature_extraction_class.from_json_file(lowercase_)

							self.assertEqual(feat_extract_second.to_dict()				,		feat_extract_first.to_dict())



		def 						UpperCAmelCase							(					self)       ->       Any:






							'''simple docstring'''
							_UpperCamelCase							 =  self.feature_extraction_class(**self.feat_extract_dict)

							with tempfile.TemporaryDirectory() as tmpdirname:
												_UpperCamelCase							 =  feat_extract_first.save_pretrained(lowercase_)[0]
												check_json_file_has_correct_format(lowercase_)
												_UpperCamelCase							 =  self.feature_extraction_class.from_pretrained(lowercase_)

							self.assertEqual(feat_extract_second.to_dict()				,		feat_extract_first.to_dict())




		def 						UpperCAmelCase							(					self)       ->       Optional[int]:






							'''simple docstring'''
							_UpperCamelCase							 =  self.feature_extraction_class()
							self.assertIsNotNone(lowercase_)










import os
import sys
from contextlib import contextmanager


# Windows only
if os.name == "nt":
 import ctypes
 import msvcrt  # noqa




 class A  (   ctypes.Structure     ):
       # _fields is a specific attr expected by ctypes
       UpperCamelCase__							:  List[Any]      =[('size', ctypes.c_int), ('visible', ctypes.c_byte)]




def 	a_      (    ):
       '''simple docstring'''





       if os.name == "nt":
              _lowerCamelCase       :		Optional[Any]		=CursorInfo()
              _lowerCamelCase       :		Dict		=ctypes.windll.kernelaa.GetStdHandle(-11     )
              ctypes.windll.kernelaa.GetConsoleCursorInfo(SCREAMING_SNAKE_CASE__		,			ctypes.byref(SCREAMING_SNAKE_CASE__     )     )
              _lowerCamelCase       :		Any		=False
              ctypes.windll.kernelaa.SetConsoleCursorInfo(SCREAMING_SNAKE_CASE__		,			ctypes.byref(SCREAMING_SNAKE_CASE__     )     )
       elif os.name == "posix":
              sys.stdout.write('\033[?25l'     )
              sys.stdout.flush()




def 	a_      (    ):
       '''simple docstring'''





       if os.name == "nt":
              _lowerCamelCase       :		Any		=CursorInfo()
              _lowerCamelCase       :		Optional[Any]		=ctypes.windll.kernelaa.GetStdHandle(-11     )
              ctypes.windll.kernelaa.GetConsoleCursorInfo(SCREAMING_SNAKE_CASE__		,			ctypes.byref(SCREAMING_SNAKE_CASE__     )     )
              _lowerCamelCase       :		Union[str, Any]		=True
              ctypes.windll.kernelaa.SetConsoleCursorInfo(SCREAMING_SNAKE_CASE__		,			ctypes.byref(SCREAMING_SNAKE_CASE__     )     )
       elif os.name == "posix":
              sys.stdout.write('\033[?25h'     )
              sys.stdout.flush()




@contextmanager
def 	a_      (    ):
       '''simple docstring'''





       try:
              hide_cursor()
              yield
       finally:
              show_cursor()


