



# 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.
__snake_case     :Optional[Any]			       =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__	:	Union[str, Any]				)       ->							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  lowerCamelCase_	(      lowerCAmelCase__	:	List[str]				)       ->							Any:

							'''simple docstring'''






							from transformers.testing_utils import pytest_addoption_shared

							pytest_addoption_shared(lowerCAmelCase__				)






def  lowerCamelCase_	(      lowerCAmelCase__	:	Union[str, Any]				)       ->							Union[str, Any]:

							'''simple docstring'''






							from transformers.testing_utils import pytest_terminal_summary_main

							A      						=    terminalreporter.config.getoption('--make-reports'				)
							if make_reports:
														pytest_terminal_summary_main(lowerCAmelCase__			,	id=lowerCAmelCase__				)






def  lowerCamelCase_	(      lowerCAmelCase__	:	List[Any]			,	lowerCAmelCase__	:	Union[str, Any]				)       ->							List[Any]:

							'''simple docstring'''






							if exitstatus == 5:
														A      						=    0


# Doctest custom flag to ignore output.
__snake_case     :int			       =doctest.register_optionflag('IGNORE_RESULT')

__snake_case     :List[str]			       =doctest.OutputChecker



class        lowerCAmelCase__					(  _lowerCamelCase       ):


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





__snake_case     :str			       =CustomOutputChecker
__snake_case     :List[Any]			       =HfDoctestModule



__snake_case     :str			       =HfDocTestParser






def 		_SCREAMING_SNAKE_CASE     ( lowerCAmelCase__							,lowerCAmelCase__						):
		if number < 0 or shift_amount < 0:
				raise ValueError('both inputs must be positive integers'						)

		lowerCamelCase_	:     int 						=      str(bin(lowerCAmelCase__						)						)
		binary_number += "0" * shift_amount
		return binary_number


def 		_SCREAMING_SNAKE_CASE     ( lowerCAmelCase__							,lowerCAmelCase__						):
		if number < 0 or shift_amount < 0:
				raise ValueError('both inputs must be positive integers'						)

		lowerCamelCase_	:     Union[str, Any] 						=      str(bin(lowerCAmelCase__						)						)[2:]
		if shift_amount >= len(lowerCAmelCase__						):
				return "0b0"
		lowerCamelCase_	:     List[str] 						=      binary_number[: len(lowerCAmelCase__						) - shift_amount]
		return "0b" + shifted_binary_number


def 		_SCREAMING_SNAKE_CASE     ( lowerCAmelCase__							,lowerCAmelCase__						):
		if number >= 0:  # Get binary representation of positive number
				lowerCamelCase_	:     List[Any] 						=      '0' + str(bin(lowerCAmelCase__						)						).strip('-'						)[2:]
		else:  # Get binary (2's complement) representation of negative number
				lowerCamelCase_	:     Any 						=      len(bin(lowerCAmelCase__						)[3:]						)  # Find 2's complement of number
				lowerCamelCase_	:     List[str] 						=      bin(abs(lowerCAmelCase__						) - (1 << binary_number_length)						)[3:]
				lowerCamelCase_	:     List[str] 						=      (
				    '1' + '0' * (binary_number_length - len(lowerCAmelCase__						)) + binary_number
				)

		if shift_amount >= len(lowerCAmelCase__						):
				return "0b" + binary_number[0] * len(lowerCAmelCase__						)
		return (
		    "0b"
		    + binary_number[0] * shift_amount
		    + binary_number[: len(lowerCAmelCase__						) - shift_amount]
		)


if __name__ == "__main__":
		import doctest

		doctest.testmod()
