






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					:		Optional[Any]	  =						logging.getLogger()


@unittest.skip("Temporarily disable the doc tests."	)
@require_torch
@require_tf
@slow
class   __SCREAMING_SNAKE_CASE(	unittest.TestCase	):
							def lowerCAmelCase_ (     self:      Dict       ,	UpperCamelCase:      Path       ,	UpperCamelCase:      Union[str, None] = None       ,	UpperCamelCase:      Union[List[str], None] = None       ,	UpperCamelCase:      Union[str, List[str], None] = None       ,	UpperCamelCase:      bool = True       ,	)		->		int:
											snake_case__									=     [file for file in os.listdir(UpperCamelCase						) if os.path.isfile(os.path.join(UpperCamelCase       ,	UpperCamelCase						)						)]

											if identifier is not None:
															snake_case__									=     [file for file in files if identifier in file]

											if n_identifier is not None:
															if isinstance(UpperCamelCase       ,	UpperCamelCase						):
																			for n_ in n_identifier:
																							snake_case__									=     [file for file in files if n_ not in file]
															else:
																			snake_case__									=     [file for file in files if n_identifier not in file]

											snake_case__									=     ignore_files or []
											ignore_files.append('__init__.py'						)
											snake_case__									=     [file for file in files if file not in ignore_files]

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

															if only_modules:
																			snake_case__									=     file.split('.'						)[0]
																			try:
																							snake_case__									=     getattr(UpperCamelCase       ,	UpperCamelCase						)
																							snake_case__									=     doctest.DocTestSuite(UpperCamelCase						)
																							snake_case__									=     unittest.TextTestRunner().run(UpperCamelCase						)
																							self.assertIs(len(result.failures						)       ,	0						)
																			except AttributeError:
																							logger.info(F'''{module_identifier} is not a module.'''						)
															else:
																			snake_case__									=     doctest.testfile(str('..' / directory / file						)       ,	optionflags=doctest.ELLIPSIS						)
																			self.assertIs(result.failed       ,	0						)
							def lowerCAmelCase_ (     self:      Tuple						)		->		int:
											snake_case__									=     Path('src/transformers'						)
											snake_case__									=     'modeling'
											snake_case__									=     [
											    'modeling_ctrl.py',
											    'modeling_tf_ctrl.py',
											]
											self.analyze_directory(UpperCamelCase       ,	identifier=UpperCamelCase       ,	ignore_files=UpperCamelCase						)
							def lowerCAmelCase_ (     self:      Optional[int]						)		->		str:
											snake_case__									=     Path('src/transformers'						)
											snake_case__									=     'tokenization'
											self.analyze_directory(UpperCamelCase       ,	identifier=UpperCamelCase						)
							def lowerCAmelCase_ (     self:      Optional[Any]						)		->		int:
											snake_case__									=     Path('src/transformers'						)
											snake_case__									=     'configuration'
											self.analyze_directory(UpperCamelCase       ,	identifier=UpperCamelCase						)
							def lowerCAmelCase_ (     self:      Dict						)		->		List[Any]:
											snake_case__									=     Path('src/transformers'						)
											snake_case__									=     ['configuration', 'modeling', 'tokenization']
											self.analyze_directory(UpperCamelCase       ,	n_identifier=UpperCamelCase						)


							def lowerCAmelCase_ (     self:      Tuple						)		->		Union[str, Any]:
											snake_case__									=     Path('docs/source'						)
											snake_case__									=     ['favicon.ico']
											self.analyze_directory(UpperCamelCase       ,	ignore_files=UpperCamelCase       ,	only_modules=UpperCamelCase						)












def      a_ (      _A      ,   _A  )			->			str:







				"""simple docstring"""
				if number < 0 or shift_amount < 0:
								raise ValueError('both inputs must be positive integers'  )

				snake_case__									=     str(bin(_A  )  )
				binary_number += "0" * shift_amount
				return binary_number
def      a_ (      _A      ,   _A  )			->			str:







				"""simple docstring"""
				if number < 0 or shift_amount < 0:
								raise ValueError('both inputs must be positive integers'  )

				snake_case__									=     str(bin(_A  )  )[2:]
				if shift_amount >= len(_A  ):
								return "0b0"
				snake_case__									=     binary_number[: len(_A  ) - shift_amount]
				return "0b" + shifted_binary_number
def      a_ (      _A      ,   _A  )			->			str:







				"""simple docstring"""
				if number >= 0:  # Get binary representation of positive number
								snake_case__									=     '0' + str(bin(_A  )  ).strip('-'  )[2:]
				else:  # Get binary (2's complement) representation of negative number
								snake_case__									=     len(bin(_A  )[3:]  )  # Find 2's complement of number
								snake_case__									=     bin(abs(_A  ) - (1 << binary_number_length)  )[3:]
								snake_case__									=     (
								    '1' + '0' * (binary_number_length - len(_A  )) + binary_number
								)

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


if __name__ == "__main__":
							import doctest

							doctest.testmod()




