






# coding=utf-8
# Copyright 2023 The HuggingFace Inc. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# this script dumps information about the environment

import os
import platform
import sys


__snake_case      :      List[str]             =       """3"""

print("""Python version:""", sys.version)

print("""OS platform:""", platform.platform())
print("""OS architecture:""", platform.machine())

try:
					import torch

					print("""Torch version:""", torch.__version__)
					print("""Cuda available:""", torch.cuda.is_available())
					print("""Cuda version:""", torch.version.cuda)
					print("""CuDNN version:""", torch.backends.cudnn.version())
					print("""Number of GPUs available:""", torch.cuda.device_count())
except ImportError:
					print("""Torch version:""", None)

try:
					import transformers

					print("""transformers version:""", transformers.__version__)
except ImportError:
					print("""transformers version:""", None)













import colorsys

from PIL import Image  # type: ignore







def 		_UpperCamelCase				(      UpperCamelCase_    :   float      ,    UpperCamelCase_    :   float      ,    UpperCamelCase_    :   int						)					->				float:

						"""simple docstring"""



						lowerCAmelCase__        =  x
						lowerCAmelCase__        =  y
						for step in range(UpperCamelCase_						):  # noqa: B007
												lowerCAmelCase__        =  a * a - b * b + x
												lowerCAmelCase__        =  2 * a * b + y
												lowerCAmelCase__        =  a_new

												# divergence happens for all complex number with an absolute value
												# greater than 4
												if a * a + b * b > 4:
																		break
						return step / (max_step - 1)







def 		_UpperCamelCase				(      UpperCamelCase_    :   float						)					->				tuple:

						"""simple docstring"""



						if distance == 1:
												return (0, 0, 0)
						else:
												return (255, 255, 255)







def 		_UpperCamelCase				(      UpperCamelCase_    :   float						)					->				tuple:

						"""simple docstring"""



						if distance == 1:
												return (0, 0, 0)
						else:
												return tuple(round(i * 255						) for i in colorsys.hsv_to_rgb(UpperCamelCase_      ,    1      ,    1						)						)







def 		_UpperCamelCase				(      UpperCamelCase_    :   int = 800      ,    UpperCamelCase_    :   int = 600      ,    UpperCamelCase_    :   float = -0.6      ,    UpperCamelCase_    :   float = 0      ,    UpperCamelCase_    :   float = 3.2      ,    UpperCamelCase_    :   int = 50      ,    UpperCamelCase_    :   bool = True      ,    )					->				Image.Image:

						"""simple docstring"""



						lowerCAmelCase__        =  Image.new('RGB'      ,    (image_width, image_height)						)
						lowerCAmelCase__        =  img.load()

						# loop through the image-coordinates
						for image_x in range(UpperCamelCase_						):
												for image_y in range(UpperCamelCase_						):
																		# determine the figure-coordinates based on the image-coordinates
																		lowerCAmelCase__        =  figure_width / image_width * image_height
																		lowerCAmelCase__        =  figure_center_x + (image_x / image_width - 0.5) * figure_width
																		lowerCAmelCase__        =  figure_center_y + (image_y / image_height - 0.5) * figure_height

																		lowerCAmelCase__        =  get_distance(UpperCamelCase_      ,    UpperCamelCase_      ,    UpperCamelCase_						)

																		# color the corresponding pixel based on the selected coloring-function
																		if use_distance_color_coding:
																								lowerCAmelCase__        =  get_color_coded_rgb(UpperCamelCase_						)
																		else:
																								lowerCAmelCase__        =  get_black_and_white_rgb(UpperCamelCase_						)

						return img


if __name__ == "__main__":
					import doctest

					doctest.testmod()

					# colored version, full figure
					__snake_case      :      str             =       get_image()

					# uncomment for colored version, different section, zoomed in
					# img = get_image(figure_center_x = -0.6, figure_center_y = -0.4,
					# figure_width = 0.8)

					# uncomment for black and white version, full figure
					# img = get_image(use_distance_color_coding = False)

					# uncomment to save the image
					# img.save("mandelbrot.png")

					img.show()





