


'''simple docstring'''
from __future__ import annotations

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

# initial triangle of Koch snowflake
__snake_case				 =	numpy.array([0, 0])
__snake_case				 =	numpy.array([0.5, 0.866_0254])
__snake_case				 =	numpy.array([1, 0])
__snake_case				 =	[VECTOR_1, VECTOR_2, VECTOR_3, VECTOR_1]


def      a (     __a					,   __a  )    ->      list[numpy.ndarray]:



					'''simple docstring'''






					UpperCamelCase__  :int				   =					initial_vectors
					for _ in range(__a  ):
										UpperCamelCase__  :Dict				   =					iteration_step(__a  )
					return vectors


def      a (     __a  )    ->      list[numpy.ndarray]:



					'''simple docstring'''






					UpperCamelCase__  :Optional[Any]				   =					[]
					for i, start_vector in enumerate(vectors[:-1]  ):
										UpperCamelCase__  :List[str]				   =					vectors[i + 1]
										new_vectors.append(__a  )
										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      a (     __a					,   __a  )    ->      numpy.ndarray:



					'''simple docstring'''






					UpperCamelCase__  :Optional[Any]				   =					numpy.radians(__a  )
					UpperCamelCase__   ,							UpperCamelCase__  :List[Any]				   =					numpy.cos(__a  ), numpy.sin(__a  )
					UpperCamelCase__  :Optional[Any]				   =					numpy.array(((c, -s), (s, c))  )
					return numpy.dot(__a					,   __a  )


def      a (     __a  )    ->      None:



					'''simple docstring'''






					UpperCamelCase__  :Union[str, 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__  :List[Any]				   =					zip(*__a  )
					plt.plot(__a					,   __a  )
					plt.show()


if __name__ == "__main__":
		import doctest

		doctest.testmod()

		__snake_case				 =	iterate(INITIAL_VECTORS, 5)
		plot(processed_vectors)



'''simple docstring'''
from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_flax_available,
    is_tf_available,
    is_tokenizers_available,
    is_torch_available,
    is_vision_available,
)


__snake_case				 =	{
    '''configuration_clip''': [
        '''CLIP_PRETRAINED_CONFIG_ARCHIVE_MAP''',
        '''CLIPConfig''',
        '''CLIPOnnxConfig''',
        '''CLIPTextConfig''',
        '''CLIPVisionConfig''',
    ],
    '''processing_clip''': ['''CLIPProcessor'''],
    '''tokenization_clip''': ['''CLIPTokenizer'''],
}

try:
		if not is_tokenizers_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		__snake_case				 =	['''CLIPTokenizerFast''']

try:
		if not is_vision_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		__snake_case				 =	['''CLIPFeatureExtractor''']
		__snake_case				 =	['''CLIPImageProcessor''']

try:
		if not is_torch_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		__snake_case				 =	[
		    '''CLIP_PRETRAINED_MODEL_ARCHIVE_LIST''',
		    '''CLIPModel''',
		    '''CLIPPreTrainedModel''',
		    '''CLIPTextModel''',
		    '''CLIPTextModelWithProjection''',
		    '''CLIPVisionModel''',
		    '''CLIPVisionModelWithProjection''',
		]

try:
		if not is_tf_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		__snake_case				 =	[
		    '''TF_CLIP_PRETRAINED_MODEL_ARCHIVE_LIST''',
		    '''TFCLIPModel''',
		    '''TFCLIPPreTrainedModel''',
		    '''TFCLIPTextModel''',
		    '''TFCLIPVisionModel''',
		]

try:
		if not is_flax_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		__snake_case				 =	[
		    '''FlaxCLIPModel''',
		    '''FlaxCLIPPreTrainedModel''',
		    '''FlaxCLIPTextModel''',
		    '''FlaxCLIPTextPreTrainedModel''',
		    '''FlaxCLIPVisionModel''',
		    '''FlaxCLIPVisionPreTrainedModel''',
		]


if TYPE_CHECKING:
		from .configuration_clip import (
		    CLIP_PRETRAINED_CONFIG_ARCHIVE_MAP,
		    CLIPConfig,
		    CLIPOnnxConfig,
		    CLIPTextConfig,
		    CLIPVisionConfig,
		)
		from .processing_clip import CLIPProcessor
		from .tokenization_clip import CLIPTokenizer

		try:
				if not is_tokenizers_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .tokenization_clip_fast import CLIPTokenizerFast

		try:
				if not is_vision_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .feature_extraction_clip import CLIPFeatureExtractor
				from .image_processing_clip import CLIPImageProcessor

		try:
				if not is_torch_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .modeling_clip import (
				    CLIP_PRETRAINED_MODEL_ARCHIVE_LIST,
				    CLIPModel,
				    CLIPPreTrainedModel,
				    CLIPTextModel,
				    CLIPTextModelWithProjection,
				    CLIPVisionModel,
				    CLIPVisionModelWithProjection,
				)

		try:
				if not is_tf_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .modeling_tf_clip import (
				    TF_CLIP_PRETRAINED_MODEL_ARCHIVE_LIST,
				    TFCLIPModel,
				    TFCLIPPreTrainedModel,
				    TFCLIPTextModel,
				    TFCLIPVisionModel,
				)

		try:
				if not is_flax_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .modeling_flax_clip import (
				    FlaxCLIPModel,
				    FlaxCLIPPreTrainedModel,
				    FlaxCLIPTextModel,
				    FlaxCLIPTextPreTrainedModel,
				    FlaxCLIPVisionModel,
				    FlaxCLIPVisionPreTrainedModel,
				)


else:
		import sys

		__snake_case				 =	_LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)