

'''simple docstring'''





import doctest
import logging
import os
import unittest
from pathlib import Path
from typing import List, Union

import transformers
from transformers.testing_utils import require_tf, require_torch, slow


UpperCamelCase_    						=       logging.getLogger()





@unittest.skip('Temporarily disable the doc tests.'      )
@require_torch
@require_tf
@slow
class 		__SCREAMING_SNAKE_CASE							(			unittest.TestCase      ):







				def  lowerCamelCase_	(       self     :		Tuple		,					UpperCAmelCase__     :		Path		,					UpperCAmelCase__     :		Union[str, None] = None		,					UpperCAmelCase__     :		Union[List[str], None] = None		,					UpperCAmelCase__     :		Union[str, List[str], None] = None		,					UpperCAmelCase__     :		bool = True		,					):
										'''simple docstring'''
										lowercase :							List[Any]    		=[file for file in os.listdir(UpperCAmelCase__   ) if os.path.isfile(os.path.join(UpperCAmelCase__		,					UpperCAmelCase__   )   )]

										if identifier is not None:
																lowercase :							List[str]    		=[file for file in files if identifier in file]

										if n_identifier is not None:
																if isinstance(UpperCAmelCase__		,					UpperCAmelCase__   ):
																						for n_ in n_identifier:
																												lowercase :							Tuple    		=[file for file in files if n_ not in file]
																else:
																						lowercase :							int    		=[file for file in files if n_identifier not in file]

										lowercase :							Optional[Any]    		=ignore_files or []
										ignore_files.append('''__init__.py'''   )
										lowercase :							List[str]    		=[file for file in files if file not in ignore_files]

										for file in files:
																# Open all files
																print('''Testing'''		,					UpperCAmelCase__   )

																if only_modules:
																						lowercase :							Any    		=file.split('''.'''   )[0]
																						try:
																												lowercase :							Optional[Any]    		=getattr(UpperCAmelCase__		,					UpperCAmelCase__   )
																												lowercase :							str    		=doctest.DocTestSuite(UpperCAmelCase__   )
																												lowercase :							str    		=unittest.TextTestRunner().run(UpperCAmelCase__   )
																												self.assertIs(len(result.failures   )		,					0   )
																						except AttributeError:
																												logger.info(F'''{module_identifier} is not a module.'''   )
																else:
																						lowercase :							Optional[int]    		=doctest.testfile(str('''..''' / directory / file   )		,					optionflags=doctest.ELLIPSIS   )
																						self.assertIs(result.failed		,					0   )







				def  lowerCamelCase_	(       self     :		Optional[int]   ):
										'''simple docstring'''
										lowercase :							str    		=Path('''src/transformers'''   )
										lowercase :							Optional[Any]    		='''modeling'''
										lowercase :							Dict    		=[
										    '''modeling_ctrl.py''',
										    '''modeling_tf_ctrl.py''',
										]
										self.analyze_directory(UpperCAmelCase__		,					identifier=UpperCAmelCase__		,					ignore_files=UpperCAmelCase__   )







				def  lowerCamelCase_	(       self     :		Dict   ):
										'''simple docstring'''
										lowercase :							int    		=Path('''src/transformers'''   )
										lowercase :							List[str]    		='''tokenization'''
										self.analyze_directory(UpperCAmelCase__		,					identifier=UpperCAmelCase__   )







				def  lowerCamelCase_	(       self     :		int   ):
										'''simple docstring'''
										lowercase :							Dict    		=Path('''src/transformers'''   )
										lowercase :							Any    		='''configuration'''
										self.analyze_directory(UpperCAmelCase__		,					identifier=UpperCAmelCase__   )







				def  lowerCamelCase_	(       self     :		Optional[Any]   ):
										'''simple docstring'''
										lowercase :							str    		=Path('''src/transformers'''   )
										lowercase :							List[str]    		=['''configuration''', '''modeling''', '''tokenization''']
										self.analyze_directory(UpperCAmelCase__		,					n_identifier=UpperCAmelCase__   )







				def  lowerCamelCase_	(       self     :		int   ):
										'''simple docstring'''
										lowercase :							Any    		=Path('''docs/source'''   )
										lowercase :							List[Any]    		=['''favicon.ico''']
										self.analyze_directory(UpperCAmelCase__		,					ignore_files=UpperCAmelCase__		,					only_modules=UpperCAmelCase__   )








'''simple docstring'''





import numpy as np
from cva import destroyAllWindows, imread, imshow, waitKey





class 		__SCREAMING_SNAKE_CASE							:







				def __init__(       self     :		Union[str, Any]		,					UpperCAmelCase__     :		Union[str, Any]		,					UpperCAmelCase__     :		int		,					UpperCAmelCase__     :		int   ):
										'''simple docstring'''
										if dst_width < 0 or dst_height < 0:
																raise ValueError('''Destination width/height should be > 0'''   )

										lowercase :							Union[str, Any]    		=img
										lowercase :							Union[str, Any]    		=img.shape[1]
										lowercase :							str    		=img.shape[0]
										lowercase :							Union[str, Any]    		=dst_width
										lowercase :							str    		=dst_height

										lowercase :							str    		=self.src_w / self.dst_w
										lowercase :							Optional[Any]    		=self.src_h / self.dst_h

										lowercase :							int    		=(
										    np.ones((self.dst_h, self.dst_w, 3)		,					np.uinta   ) * 255
										)







				def  lowerCamelCase_	(       self     :		List[Any]   ):
										'''simple docstring'''
										for i in range(self.dst_h   ):
																for j in range(self.dst_w   ):
																						lowercase :							List[Any]    		=self.img[self.get_y(UpperCAmelCase__   )][self.get_x(UpperCAmelCase__   )]







				def  lowerCamelCase_	(       self     :		Tuple		,					UpperCAmelCase__     :		int   ):
										'''simple docstring'''
										return int(self.ratio_x * x   )







				def  lowerCamelCase_	(       self     :		List[Any]		,					UpperCAmelCase__     :		int   ):
										'''simple docstring'''
										return int(self.ratio_y * y   )


if __name__ == "__main__":
							UpperCamelCase_						,   UpperCamelCase_    						=       800, 600
							UpperCamelCase_    						=       imread("""image_data/lena.jpg""", 1)
							UpperCamelCase_    						=       NearestNeighbour(im, dst_w, dst_h)
							n.process()

							imshow(
							    f'''Image resized from: {im.shape[1]}x{im.shape[0]} to {dst_w}x{dst_h}''', n.output
							)
							waitKey(0)
							destroyAllWindows()





