



'''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__:   Union[str, Any]								=			logging.getLogger()

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







	"""simple docstring"""






	def      A	(						self			:     Optional[int]		,			__snake_case			:     Path		,			__snake_case			:     Union[str, None] = None		,			__snake_case			:     Union[List[str], None] = None		,			__snake_case			:     Union[str, List[str], None] = None		,			__snake_case			:     bool = True		,			)			->		Tuple:
								UpperCAmelCase :       Optional[Any] 							=		[file for file in os.listdir(__snake_case		) if os.path.isfile(os.path.join(__snake_case		,			__snake_case		)		)]

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

								if n_identifier is not None:
															if isinstance(__snake_case		,			__snake_case		):
																						for n_ in n_identifier:
																													UpperCAmelCase :       Dict 							=		[file for file in files if n_ not in file]
															else:
																						UpperCAmelCase :       Dict 							=		[file for file in files if n_identifier not in file]

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

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

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







	def      A	(						self			:     Any		)			->		Tuple:
								UpperCAmelCase :       List[str] 							=		Path('''src/transformers'''		)
								UpperCAmelCase :       int 							=		'''modeling'''
								UpperCAmelCase :       Tuple 							=		[
								    '''modeling_ctrl.py''',
								    '''modeling_tf_ctrl.py''',
								]
								self.analyze_directory(__snake_case		,			identifier=__snake_case		,			ignore_files=__snake_case		)







	def      A	(						self			:     List[Any]		)			->		Optional[Any]:
								UpperCAmelCase :       List[Any] 							=		Path('''src/transformers'''		)
								UpperCAmelCase :       Tuple 							=		'''tokenization'''
								self.analyze_directory(__snake_case		,			identifier=__snake_case		)







	def      A	(						self			:     Optional[int]		)			->		Optional[Any]:
								UpperCAmelCase :       Union[str, Any] 							=		Path('''src/transformers'''		)
								UpperCAmelCase :       str 							=		'''configuration'''
								self.analyze_directory(__snake_case		,			identifier=__snake_case		)







	def      A	(						self			:     int		)			->		Dict:
								UpperCAmelCase :       Union[str, Any] 							=		Path('''src/transformers'''		)
								UpperCAmelCase :       str 							=		['''configuration''', '''modeling''', '''tokenization''']
								self.analyze_directory(__snake_case		,			n_identifier=__snake_case		)







	def      A	(						self			:     Optional[int]		)			->		Optional[Any]:
								UpperCAmelCase :       Dict 							=		Path('''docs/source'''		)
								UpperCAmelCase :       Union[str, Any] 							=		['''favicon.ico''']
								self.analyze_directory(__snake_case		,			ignore_files=__snake_case		,			only_modules=__snake_case		)










'''simple docstring'''






from __future__ import annotations

import matplotlib.pyplot as plt  # type: ignore
import numpy

# initial triangle of Koch snowflake
UpperCamelCase__:   Tuple								=			numpy.array([0, 0])
UpperCamelCase__:   Union[str, Any]								=			numpy.array([0.5, 0.8660254])
UpperCamelCase__:   Dict								=			numpy.array([1, 0])
UpperCamelCase__:   int								=			[VECTOR_1, VECTOR_2, VECTOR_3, VECTOR_1]


def  snake_case_     (					_lowerCAmelCase  :						list[numpy.ndarray]   ,      _lowerCAmelCase  :						int  )      ->   list[numpy.ndarray]:
							UpperCAmelCase :       Union[str, Any] 							=		initial_vectors
							for _ in range(_lowerCAmelCase  ):
														UpperCAmelCase :       Union[str, Any] 							=		iteration_step(_lowerCAmelCase  )
							return vectors


def  snake_case_     (					_lowerCAmelCase  :						list[numpy.ndarray]  )      ->   list[numpy.ndarray]:
							UpperCAmelCase :       Tuple 							=		[]
							for i, start_vector in enumerate(vectors[:-1]  ):
														UpperCAmelCase :       List[str] 							=		vectors[i + 1]
														new_vectors.append(_lowerCAmelCase  )
														UpperCAmelCase :       Optional[Any] 							=		end_vector - start_vector
														new_vectors.append(start_vector + difference_vector / 3  )
														new_vectors.append(
														    start_vector + difference_vector / 3 + rotate(difference_vector / 3   ,      60  )  )
														new_vectors.append(start_vector + difference_vector * 2 / 3  )
							new_vectors.append(vectors[-1]  )
							return new_vectors


def  snake_case_     (					_lowerCAmelCase  :						numpy.ndarray   ,      _lowerCAmelCase  :						float  )      ->   numpy.ndarray:
							UpperCAmelCase :       List[str] 							=		numpy.radians(_lowerCAmelCase  )
							UpperCAmelCase							,		UpperCAmelCase :       Tuple 							=		numpy.cos(_lowerCAmelCase  ), numpy.sin(_lowerCAmelCase  )
							UpperCAmelCase :       Union[str, Any] 							=		numpy.array(((c, -s), (s, c))  )
							return numpy.dot(_lowerCAmelCase   ,      _lowerCAmelCase  )


def  snake_case_     (					_lowerCAmelCase  :						list[numpy.ndarray]  )      ->   None:
							UpperCAmelCase :       List[Any] 							=		plt.gca()
							axes.set_aspect('''equal'''  )

							# matplotlib.pyplot.plot takes a list of all x-coordinates and a list of all
							# y-coordinates as inputs, which are constructed from the vector-list using
							# zip()
							UpperCAmelCase							,		UpperCAmelCase :       str 							=		zip(*_lowerCAmelCase  )
							plt.plot(_lowerCAmelCase   ,      _lowerCAmelCase  )
							plt.show()


if __name__ == "__main__":
						import doctest

						doctest.testmod()

						UpperCamelCase__:   List[Any]								=			iterate(INITIAL_VECTORS, 5)
						plot(processed_vectors)





