


'''simple docstring'''

import os
import string
import sys


lowerCAmelCase				:str        =      1 << 8

lowerCAmelCase				:Optional[Any]        =      {
    '''tab''': ord('''\t'''),
    '''newline''': ord('''\r'''),
    '''esc''': 2_7,
    '''up''': 6_5 + ARROW_KEY_FLAG,
    '''down''': 6_6 + ARROW_KEY_FLAG,
    '''right''': 6_7 + ARROW_KEY_FLAG,
    '''left''': 6_8 + ARROW_KEY_FLAG,
    '''mod_int''': 9_1,
    '''undefined''': sys.maxsize,
    '''interrupt''': 3,
    '''insert''': 5_0,
    '''delete''': 5_1,
    '''pg_up''': 5_3,
    '''pg_down''': 5_4,
}

lowerCAmelCase				:Tuple        =      KEYMAP['''up''']
lowerCAmelCase				:int        =      KEYMAP['''left''']

if sys.platform == "win32":
							lowerCAmelCase				:Tuple        =      []
							lowerCAmelCase				:Optional[Any]        =      {
							    b'''\xe0H''': KEYMAP['''up'''] - ARROW_KEY_FLAG,
							    b'''\x00H''': KEYMAP['''up'''] - ARROW_KEY_FLAG,
							    b'''\xe0P''': KEYMAP['''down'''] - ARROW_KEY_FLAG,
							    b'''\x00P''': KEYMAP['''down'''] - ARROW_KEY_FLAG,
							    b'''\xe0M''': KEYMAP['''right'''] - ARROW_KEY_FLAG,
							    b'''\x00M''': KEYMAP['''right'''] - ARROW_KEY_FLAG,
							    b'''\xe0K''': KEYMAP['''left'''] - ARROW_KEY_FLAG,
							    b'''\x00K''': KEYMAP['''left'''] - ARROW_KEY_FLAG,
							}

for i in range(1_0):
							lowerCAmelCase				:Dict        =      ord(str(i))





def lowerCamelCase      (      ):





	"""simple docstring"""







	if os.name == "nt":
		import msvcrt

		__magic_name__	:   Union[str, Any]					     =					'mbcs'
		# Flush the keyboard buffer
		while msvcrt.kbhit():
			msvcrt.getch()
		if len(lowerCAmelCase		) == 0:
			# Read the keystroke
			__magic_name__	:   Union[str, Any]					     =					msvcrt.getch()

			# If it is a prefix char, get second part
			if ch in (b"\x00", b"\xe0"):
				__magic_name__	:   str					     =					ch + msvcrt.getch()
				# Translate actual Win chars to bullet char types
				try:
					__magic_name__	:   str					     =					chr(WIN_KEYMAP[cha]		)
					WIN_CH_BUFFER.append(chr(KEYMAP['mod_int']		)		)
					WIN_CH_BUFFER.append(lowerCAmelCase		)
					if ord(lowerCAmelCase		) in (
					    KEYMAP["insert"] - 1 << 9,
					    KEYMAP["delete"] - 1 << 9,
					    KEYMAP["pg_up"] - 1 << 9,
					    KEYMAP["pg_down"] - 1 << 9,
					):
						WIN_CH_BUFFER.append(chr(126		)		)
					__magic_name__	:   Any					     =					chr(KEYMAP['esc']		)
				except KeyError:
					__magic_name__	:   Union[str, Any]					     =					cha[1]
			else:
				__magic_name__	:   Union[str, Any]					     =					ch.decode(lowerCAmelCase		)
		else:
			__magic_name__	:   Any					     =					WIN_CH_BUFFER.pop(0		)
	elif os.name == "posix":
		import termios
		import tty

		__magic_name__	:   Tuple					     =					sys.stdin.fileno()
		__magic_name__	:   Any					     =					termios.tcgetattr(lowerCAmelCase		)
		try:
			tty.setraw(lowerCAmelCase		)
			__magic_name__	:   Any					     =					sys.stdin.read(1		)
		finally:
			termios.tcsetattr(lowerCAmelCase		,		termios.TCSADRAIN		,		lowerCAmelCase		)
	return ch





def lowerCamelCase      (      ):





	"""simple docstring"""







	__magic_name__	:   Optional[Any]					     =					get_raw_chars()
	if ord(lowerCAmelCase		) in [KEYMAP["interrupt"], KEYMAP["newline"]]:
		return char

	elif ord(lowerCAmelCase		) == KEYMAP["esc"]:
		__magic_name__	:   Union[str, Any]					     =					get_raw_chars()
		if ord(lowerCAmelCase		) == KEYMAP["mod_int"]:
			__magic_name__	:   Optional[Any]					     =					get_raw_chars()
			if ord(lowerCAmelCase		) >= KEYMAP["arrow_begin"] - ARROW_KEY_FLAG and ord(lowerCAmelCase		) <= KEYMAP["arrow_end"] - ARROW_KEY_FLAG:
				return chr(ord(lowerCAmelCase		) + ARROW_KEY_FLAG		)
			else:
				return KEYMAP["undefined"]
		else:
			return get_raw_chars()

	else:
		if char in string.printable:
			return char
		else:
			return KEYMAP["undefined"]



'''simple docstring'''

# 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.
lowerCAmelCase				:Optional[int]        =      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 lowerCamelCase      (      lowerCAmelCase    :     Tuple		):





	"""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 lowerCamelCase      (      lowerCAmelCase    :     Any		):





	"""simple docstring"""







	from transformers.testing_utils import pytest_addoption_shared

	pytest_addoption_shared(lowerCAmelCase		)





def lowerCamelCase      (      lowerCAmelCase    :     Dict		):





	"""simple docstring"""







	from transformers.testing_utils import pytest_terminal_summary_main

	__magic_name__	:   Tuple					     =					terminalreporter.config.getoption('--make-reports'		)
	if make_reports:
		pytest_terminal_summary_main(lowerCAmelCase		,		id=lowerCAmelCase		)





def lowerCamelCase      (      lowerCAmelCase    :     List[Any]		,		lowerCAmelCase    :     Tuple		):





	"""simple docstring"""







	if exitstatus == 5:
		__magic_name__	:   Any					     =					0


# Doctest custom flag to ignore output.
lowerCAmelCase				:List[str]        =      doctest.register_optionflag('''IGNORE_RESULT''')

lowerCAmelCase				:Union[str, Any]        =      doctest.OutputChecker
class _lowerCamelCase	(						lowercase__							):



		'''simple docstring'''







		def        __lowerCAmelCase		( self		:						List[str]  ,					_A		:						Tuple  ,					_A		:						Tuple  ,					_A		:						str      )  ->			int:
			if IGNORE_RESULT & optionflags:
				return True
			return OutputChecker.check_output(self  ,					_A  ,					_A  ,					_A      )







lowerCAmelCase				:Optional[Any]        =      CustomOutputChecker
lowerCAmelCase				:int        =      HfDoctestModule





lowerCAmelCase				:Any        =      HfDocTestParser