



# tests directory-specific settings - this file is run automatically
# by pytest before any tests are run

import doctest
import sys
import warnings
from os.path import abspath, dirname, join

import _pytest

from transformers.testing_utils import HfDoctestModule, HfDocTestParser


# allow having multiple repository checkouts and not needing to remember to rerun
# 'pip install -e .[dev]' when switching between checkouts and running tests.
_lowercase     							=						abspath(join(dirname(__file__), '''src'''))
sys.path.insert(1, git_repo_path)

# silence FutureWarning warnings in tests since often we can't act on them until
# they become normal warnings - i.e. the tests still need to test the current functionality
warnings.simplefilter(action='''ignore''', category=FutureWarning)






def      _A				(UpperCamelCase		:      Any )  ->List[Any]:



			'''simple docstring'''







			config.addinivalue_line(
			    """markers"""      ,			"""is_pt_tf_cross_test: mark test to run only when PT and TF interactions are tested""" )
			config.addinivalue_line(
			    """markers"""      ,			"""is_pt_flax_cross_test: mark test to run only when PT and FLAX interactions are tested""" )
			config.addinivalue_line("""markers"""      ,			"""is_pipeline_test: mark test to run only when pipelines are tested""" )
			config.addinivalue_line("""markers"""      ,			"""is_staging_test: mark test to run only in the staging environment""" )
			config.addinivalue_line("""markers"""      ,			"""accelerate_tests: mark test that require accelerate""" )
			config.addinivalue_line("""markers"""      ,			"""tool_tests: mark the tool tests that are run on their specific schedule""" )






def      _A				(UpperCamelCase		:      List[Any] )  ->Union[str, Any]:



			'''simple docstring'''







			from transformers.testing_utils import pytest_addoption_shared

			pytest_addoption_shared(UpperCamelCase )






def      _A				(UpperCamelCase		:      List[str] )  ->Optional[Any]:



			'''simple docstring'''







			from transformers.testing_utils import pytest_terminal_summary_main

			lowerCamelCase__ :      str								=		terminalreporter.config.getoption("""--make-reports""" )
			if make_reports:
						pytest_terminal_summary_main(UpperCamelCase      ,			id=UpperCamelCase )






def      _A				(UpperCamelCase		:      Union[str, Any]      ,			UpperCamelCase		:      Union[str, Any] )  ->Optional[int]:



			'''simple docstring'''







			if exitstatus == 5:
						lowerCamelCase__ :      Optional[Any]								=		0


# Doctest custom flag to ignore output.
_lowercase     							=						doctest.register_optionflag('''IGNORE_RESULT''')

_lowercase     							=						doctest.OutputChecker
class 				__A					( A_      ):





			def        _snake_case    (self							,    __magic_name__							,    __magic_name__							,    __magic_name__				):
						if IGNORE_RESULT & optionflags:
									return True
						return OutputChecker.check_output(self							,    __magic_name__							,    __magic_name__							,    __magic_name__				)







_lowercase     							=						CustomOutputChecker
_lowercase     							=						HfDoctestModule
_lowercase     							=						HfDocTestParser








from pathlib import Path

import cva
import numpy as np
from matplotlib import pyplot as plt






def      _A				(UpperCamelCase		:      np.ndarray      ,			UpperCamelCase		:      np.ndarray      ,			UpperCamelCase		:      np.ndarray      ,			UpperCamelCase		:      int      ,			UpperCamelCase		:      int )  ->np.ndarray:



			'''simple docstring'''







			lowerCamelCase__ :      Union[str, Any]								=		cva.getAffineTransform(UpperCamelCase      ,			UpperCamelCase )
			return cva.warpAffine(UpperCamelCase      ,			UpperCamelCase      ,			(rows, cols) )


if __name__ == "__main__":
				# read original image
				_lowercase     							=						cva.imread(
				    str(Path(__file__).resolve().parent.parent / '''image_data''' / '''lena.jpg''')
				)
				# turn image in gray scale value
				_lowercase     							=						cva.cvtColor(image, cva.COLOR_BGR2GRAY)
				# get image shape
				_lowercase							,				_lowercase     							=						gray_img.shape

				# set different points to rotate image
				_lowercase     							=						np.array([[50, 50], [2_00, 50], [50, 2_00]], np.floataa)
				_lowercase     							=						np.array([[10, 1_00], [2_00, 50], [1_00, 2_50]], np.floataa)
				_lowercase     							=						np.array([[50, 50], [1_50, 50], [1_20, 2_00]], np.floataa)
				_lowercase     							=						np.array([[10, 1_00], [80, 50], [1_80, 2_50]], np.floataa)

				# add all rotated images in a list
				_lowercase     							=						[
				    gray_img,
				    get_rotation(gray_img, ptsa, ptsa, img_rows, img_cols),
				    get_rotation(gray_img, ptsa, ptsa, img_rows, img_cols),
				    get_rotation(gray_img, ptsa, ptsa, img_rows, img_cols),
				]

				# plot different image rotations
				_lowercase     							=						plt.figure(1)
				_lowercase     							=						['''Original''', '''Rotation 1''', '''Rotation 2''', '''Rotation 3''']
				for i, image in enumerate(images):
								plt.subplot(2, 2, i + 1), plt.imshow(image, '''gray''')
								plt.title(titles[i])
								plt.axis('''off''')
								plt.subplots_adjust(left=0.0, bottom=0.05, right=1.0, top=0.95)
				plt.show()



