






"""simple docstring"""
import os
import unittest

from transformers import BertTokenizerFast
from transformers.models.bert.tokenization_bert import (
    VOCAB_FILES_NAMES,
    BasicTokenizer,
    BertTokenizer,
    WordpieceTokenizer,
    _is_control,
    _is_punctuation,
    _is_whitespace,
)
from transformers.testing_utils import require_tokenizers, slow

from ...test_tokenization_common import TokenizerTesterMixin, filter_non_english






@require_tokenizers
class  _SCREAMING_SNAKE_CASE(       a__   ,     unittest.TestCase  ):
       SCREAMING_SNAKE_CASE_       :				Tuple     						=  BertTokenizer
       SCREAMING_SNAKE_CASE_       :				Tuple     						=  BertTokenizerFast
       SCREAMING_SNAKE_CASE_       :				Union[str, Any]     						=  True
       SCREAMING_SNAKE_CASE_       :				int     						=  True
       SCREAMING_SNAKE_CASE_       :				Union[str, Any]     						=  filter_non_english




       def    _UpperCamelCase					(						self							)      ->				Dict:





             """simple docstring"""






             super().setUp()

             __SCREAMING_SNAKE_CASE       :List[Any]		    =  [
                 '[UNK]',
                 '[CLS]',
                 '[SEP]',
                 '[PAD]',
                 '[MASK]',
                 'want',
                 '##want',
                 '##ed',
                 'wa',
                 'un',
                 'runn',
                 '##ing',
                 ',',
                 'low',
                 'lowest',
             ]
             __SCREAMING_SNAKE_CASE       :int		    =  os.path.join(self.tmpdirname		,VOCAB_FILES_NAMES['''vocab_file''']							)
             with open(self.vocab_file		,'''w'''		,encoding='''utf-8'''							) as vocab_writer:
                   vocab_writer.write(''''''.join([x + '''\n''' for x in vocab_tokens]							)							)




       def    _UpperCamelCase					(						self		,SCREAMING_SNAKE_CASE__							)      ->				List[Any]:





             """simple docstring"""






             __SCREAMING_SNAKE_CASE       :List[Any]		    =  'UNwant\u00E9d,running'
             __SCREAMING_SNAKE_CASE       :List[Any]		    =  'unwanted, running'
             return input_text, output_text




       def    _UpperCamelCase					(						self							)      ->				Any:





             """simple docstring"""






             __SCREAMING_SNAKE_CASE       :str		    =  self.tokenizer_class(self.vocab_file							)

             __SCREAMING_SNAKE_CASE       :List[str]		    =  tokenizer.tokenize('''UNwant\u00E9d,running'''							)
             self.assertListEqual(SCREAMING_SNAKE_CASE_		,['''un''', '''##want''', '''##ed''', ''',''', '''runn''', '''##ing''']							)
             self.assertListEqual(tokenizer.convert_tokens_to_ids(SCREAMING_SNAKE_CASE_							)		,[9, 6, 7, 12, 10, 11]							)




       def    _UpperCamelCase					(						self							)      ->				List[str]:





             """simple docstring"""






             if not self.test_rust_tokenizer:
                   return

             __SCREAMING_SNAKE_CASE       :List[Any]		    =  self.get_tokenizer()
             __SCREAMING_SNAKE_CASE       :Any		    =  self.get_rust_tokenizer()

             __SCREAMING_SNAKE_CASE       :Any		    =  'UNwant\u00E9d,running'

             __SCREAMING_SNAKE_CASE       :Optional[int]		    =  tokenizer.tokenize(SCREAMING_SNAKE_CASE_							)
             __SCREAMING_SNAKE_CASE       :Tuple		    =  rust_tokenizer.tokenize(SCREAMING_SNAKE_CASE_							)
             self.assertListEqual(SCREAMING_SNAKE_CASE_		,SCREAMING_SNAKE_CASE_							)

             __SCREAMING_SNAKE_CASE       :Dict		    =  tokenizer.encode(SCREAMING_SNAKE_CASE_		,add_special_tokens=SCREAMING_SNAKE_CASE_							)
             __SCREAMING_SNAKE_CASE       :Any		    =  rust_tokenizer.encode(SCREAMING_SNAKE_CASE_		,add_special_tokens=SCREAMING_SNAKE_CASE_							)
             self.assertListEqual(SCREAMING_SNAKE_CASE_		,SCREAMING_SNAKE_CASE_							)

             __SCREAMING_SNAKE_CASE       :Union[str, Any]		    =  self.get_rust_tokenizer()
             __SCREAMING_SNAKE_CASE       :Tuple		    =  tokenizer.encode(SCREAMING_SNAKE_CASE_							)
             __SCREAMING_SNAKE_CASE       :Union[str, Any]		    =  rust_tokenizer.encode(SCREAMING_SNAKE_CASE_							)
             self.assertListEqual(SCREAMING_SNAKE_CASE_		,SCREAMING_SNAKE_CASE_							)

             # With lower casing
             __SCREAMING_SNAKE_CASE       :Optional[Any]		    =  self.get_tokenizer(do_lower_case=SCREAMING_SNAKE_CASE_							)
             __SCREAMING_SNAKE_CASE       :int		    =  self.get_rust_tokenizer(do_lower_case=SCREAMING_SNAKE_CASE_							)

             __SCREAMING_SNAKE_CASE       :List[str]		    =  'UNwant\u00E9d,running'

             __SCREAMING_SNAKE_CASE       :Union[str, Any]		    =  tokenizer.tokenize(SCREAMING_SNAKE_CASE_							)
             __SCREAMING_SNAKE_CASE       :Any		    =  rust_tokenizer.tokenize(SCREAMING_SNAKE_CASE_							)
             self.assertListEqual(SCREAMING_SNAKE_CASE_		,SCREAMING_SNAKE_CASE_							)

             __SCREAMING_SNAKE_CASE       :Union[str, Any]		    =  tokenizer.encode(SCREAMING_SNAKE_CASE_		,add_special_tokens=SCREAMING_SNAKE_CASE_							)
             __SCREAMING_SNAKE_CASE       :Any		    =  rust_tokenizer.encode(SCREAMING_SNAKE_CASE_		,add_special_tokens=SCREAMING_SNAKE_CASE_							)
             self.assertListEqual(SCREAMING_SNAKE_CASE_		,SCREAMING_SNAKE_CASE_							)

             __SCREAMING_SNAKE_CASE       :int		    =  self.get_rust_tokenizer()
             __SCREAMING_SNAKE_CASE       :Union[str, Any]		    =  tokenizer.encode(SCREAMING_SNAKE_CASE_							)
             __SCREAMING_SNAKE_CASE       :Any		    =  rust_tokenizer.encode(SCREAMING_SNAKE_CASE_							)
             self.assertListEqual(SCREAMING_SNAKE_CASE_		,SCREAMING_SNAKE_CASE_							)




       def    _UpperCamelCase					(						self							)      ->				Optional[int]:





             """simple docstring"""






             __SCREAMING_SNAKE_CASE       :Optional[int]		    =  BasicTokenizer()

             self.assertListEqual(tokenizer.tokenize('''ah\u535A\u63A8zz'''							)		,['''ah''', '''\u535A''', '''\u63A8''', '''zz''']							)




       def    _UpperCamelCase					(						self							)      ->				List[str]:





             """simple docstring"""






             __SCREAMING_SNAKE_CASE       :Union[str, Any]		    =  BasicTokenizer(do_lower_case=SCREAMING_SNAKE_CASE_							)

             self.assertListEqual(
                 tokenizer.tokenize(''' \tHeLLo!how  \n Are yoU?  '''							)		,['''hello''', '''!''', '''how''', '''are''', '''you''', '''?''']							)
             self.assertListEqual(tokenizer.tokenize('''H\u00E9llo'''							)		,['''hello''']							)




       def    _UpperCamelCase					(						self							)      ->				Optional[int]:





             """simple docstring"""






             __SCREAMING_SNAKE_CASE       :Optional[Any]		    =  BasicTokenizer(do_lower_case=SCREAMING_SNAKE_CASE_		,strip_accents=SCREAMING_SNAKE_CASE_							)

             self.assertListEqual(
                 tokenizer.tokenize(''' \tHäLLo!how  \n Are yoU?  '''							)		,['''hällo''', '''!''', '''how''', '''are''', '''you''', '''?''']							)
             self.assertListEqual(tokenizer.tokenize('''H\u00E9llo'''							)		,['''h\u00E9llo''']							)




       def    _UpperCamelCase					(						self							)      ->				Tuple:





             """simple docstring"""






             __SCREAMING_SNAKE_CASE       :Dict		    =  BasicTokenizer(do_lower_case=SCREAMING_SNAKE_CASE_		,strip_accents=SCREAMING_SNAKE_CASE_							)

             self.assertListEqual(
                 tokenizer.tokenize(''' \tHäLLo!how  \n Are yoU?  '''							)		,['''hallo''', '''!''', '''how''', '''are''', '''you''', '''?''']							)
             self.assertListEqual(tokenizer.tokenize('''H\u00E9llo'''							)		,['''hello''']							)




       def    _UpperCamelCase					(						self							)      ->				Optional[int]:





             """simple docstring"""






             __SCREAMING_SNAKE_CASE       :Union[str, Any]		    =  BasicTokenizer(do_lower_case=SCREAMING_SNAKE_CASE_							)

             self.assertListEqual(
                 tokenizer.tokenize(''' \tHäLLo!how  \n Are yoU?  '''							)		,['''hallo''', '''!''', '''how''', '''are''', '''you''', '''?''']							)
             self.assertListEqual(tokenizer.tokenize('''H\u00E9llo'''							)		,['''hello''']							)




       def    _UpperCamelCase					(						self							)      ->				List[str]:





             """simple docstring"""






             __SCREAMING_SNAKE_CASE       :List[str]		    =  BasicTokenizer(do_lower_case=SCREAMING_SNAKE_CASE_							)

             self.assertListEqual(
                 tokenizer.tokenize(''' \tHeLLo!how  \n Are yoU?  '''							)		,['''HeLLo''', '''!''', '''how''', '''Are''', '''yoU''', '''?''']							)




       def    _UpperCamelCase					(						self							)      ->				Tuple:





             """simple docstring"""






             __SCREAMING_SNAKE_CASE       :List[str]		    =  BasicTokenizer(do_lower_case=SCREAMING_SNAKE_CASE_		,strip_accents=SCREAMING_SNAKE_CASE_							)

             self.assertListEqual(
                 tokenizer.tokenize(''' \tHäLLo!how  \n Are yoU?  '''							)		,['''HäLLo''', '''!''', '''how''', '''Are''', '''yoU''', '''?''']							)




       def    _UpperCamelCase					(						self							)      ->				Optional[int]:





             """simple docstring"""






             __SCREAMING_SNAKE_CASE       :Union[str, Any]		    =  BasicTokenizer(do_lower_case=SCREAMING_SNAKE_CASE_		,strip_accents=SCREAMING_SNAKE_CASE_							)

             self.assertListEqual(
                 tokenizer.tokenize(''' \tHäLLo!how  \n Are yoU?  '''							)		,['''HaLLo''', '''!''', '''how''', '''Are''', '''yoU''', '''?''']							)




       def    _UpperCamelCase					(						self							)      ->				Optional[Any]:





             """simple docstring"""






             __SCREAMING_SNAKE_CASE       :Optional[Any]		    =  BasicTokenizer(do_lower_case=SCREAMING_SNAKE_CASE_		,never_split=['''[UNK]''']							)

             self.assertListEqual(
                 tokenizer.tokenize(''' \tHeLLo!how  \n Are yoU? [UNK]'''							)		,['''HeLLo''', '''!''', '''how''', '''Are''', '''yoU''', '''?''', '''[UNK]''']							)




       def    _UpperCamelCase					(						self							)      ->				Optional[Any]:





             """simple docstring"""






             __SCREAMING_SNAKE_CASE       :str		    =  BasicTokenizer()
             __SCREAMING_SNAKE_CASE       :Optional[int]		    =  'a\n\'ll !!to?\'d of, can\'t.'
             __SCREAMING_SNAKE_CASE       :List[str]		    =  ['a', '\'', 'll', '!', '!', 'to', '?', '\'', 'd', 'of', ',', 'can', '\'', 't', '.']
             self.assertListEqual(tokenizer.tokenize(SCREAMING_SNAKE_CASE_							)		,SCREAMING_SNAKE_CASE_							)




       def    _UpperCamelCase					(						self							)      ->				Union[str, Any]:





             """simple docstring"""






             __SCREAMING_SNAKE_CASE       :Optional[Any]		    =  ['[UNK]', '[CLS]', '[SEP]', 'want', '##want', '##ed', 'wa', 'un', 'runn', '##ing']

             __SCREAMING_SNAKE_CASE       :str		    =  {}
             for i, token in enumerate(SCREAMING_SNAKE_CASE_							):
                   __SCREAMING_SNAKE_CASE       :List[str]		    =  i
             __SCREAMING_SNAKE_CASE       :Tuple		    =  WordpieceTokenizer(vocab=SCREAMING_SNAKE_CASE_		,unk_token='''[UNK]'''							)

             self.assertListEqual(tokenizer.tokenize(''''''							)		,[]							)

             self.assertListEqual(tokenizer.tokenize('''unwanted running'''							)		,['''un''', '''##want''', '''##ed''', '''runn''', '''##ing''']							)

             self.assertListEqual(tokenizer.tokenize('''unwantedX running'''							)		,['''[UNK]''', '''runn''', '''##ing''']							)




       def    _UpperCamelCase					(						self							)      ->				Dict:





             """simple docstring"""






             self.assertTrue(_is_whitespace(''' '''							)							)
             self.assertTrue(_is_whitespace('''\t'''							)							)
             self.assertTrue(_is_whitespace('''\r'''							)							)
             self.assertTrue(_is_whitespace('''\n'''							)							)
             self.assertTrue(_is_whitespace('''\u00A0'''							)							)

             self.assertFalse(_is_whitespace('''A'''							)							)
             self.assertFalse(_is_whitespace('''-'''							)							)




       def    _UpperCamelCase					(						self							)      ->				Tuple:





             """simple docstring"""






             self.assertTrue(_is_control('''\u0005'''							)							)

             self.assertFalse(_is_control('''A'''							)							)
             self.assertFalse(_is_control(''' '''							)							)
             self.assertFalse(_is_control('''\t'''							)							)
             self.assertFalse(_is_control('''\r'''							)							)




       def    _UpperCamelCase					(						self							)      ->				Optional[int]:





             """simple docstring"""






             self.assertTrue(_is_punctuation('''-'''							)							)
             self.assertTrue(_is_punctuation('''$'''							)							)
             self.assertTrue(_is_punctuation('''`'''							)							)
             self.assertTrue(_is_punctuation('''.'''							)							)

             self.assertFalse(_is_punctuation('''A'''							)							)
             self.assertFalse(_is_punctuation(''' '''							)							)




       def    _UpperCamelCase					(						self							)      ->				Optional[int]:





             """simple docstring"""






             __SCREAMING_SNAKE_CASE       :Dict		    =  self.get_tokenizer()
             __SCREAMING_SNAKE_CASE       :Optional[Any]		    =  self.get_rust_tokenizer()

             # Example taken from the issue https://github.com/huggingface/tokenizers/issues/340
             self.assertListEqual([tokenizer.tokenize(SCREAMING_SNAKE_CASE_							) for t in ['''Test''', '''\xad''', '''test''']]		,[['''[UNK]'''], [], ['''[UNK]''']]							)

             self.assertListEqual(
                 [rust_tokenizer.tokenize(SCREAMING_SNAKE_CASE_							) for t in ['''Test''', '''\xad''', '''test''']]		,[['''[UNK]'''], [], ['''[UNK]''']]							)




       @slow
       def    _UpperCamelCase					(						self							)      ->				Union[str, Any]:





             """simple docstring"""






             __SCREAMING_SNAKE_CASE       :Tuple		    =  self.tokenizer_class.from_pretrained('''bert-base-uncased'''							)

             __SCREAMING_SNAKE_CASE       :Optional[Any]		    =  tokenizer.encode('''sequence builders'''		,add_special_tokens=SCREAMING_SNAKE_CASE_							)
             __SCREAMING_SNAKE_CASE       :Optional[Any]		    =  tokenizer.encode('''multi-sequence build'''		,add_special_tokens=SCREAMING_SNAKE_CASE_							)

             __SCREAMING_SNAKE_CASE       :Any		    =  tokenizer.build_inputs_with_special_tokens(SCREAMING_SNAKE_CASE_							)
             __SCREAMING_SNAKE_CASE       :List[Any]		    =  tokenizer.build_inputs_with_special_tokens(SCREAMING_SNAKE_CASE_		,SCREAMING_SNAKE_CASE_							)

             assert encoded_sentence == [1_01] + text + [1_02]
             assert encoded_pair == [1_01] + text + [1_02] + text_a + [1_02]




       def    _UpperCamelCase					(						self							)      ->				Tuple:





             """simple docstring"""






             for tokenizer, pretrained_name, kwargs in self.tokenizers_list:
                   with self.subTest(f'''{tokenizer.__class__.__name__} ({pretrained_name})'''							):
                         __SCREAMING_SNAKE_CASE       :Dict		    =  self.rust_tokenizer_class.from_pretrained(SCREAMING_SNAKE_CASE_		,**SCREAMING_SNAKE_CASE_							)

                         __SCREAMING_SNAKE_CASE       :str		    =  f'''A, naïve {tokenizer_r.mask_token} AllenNLP sentence.'''
                         __SCREAMING_SNAKE_CASE       :int		    =  tokenizer_r.encode_plus(
                             SCREAMING_SNAKE_CASE_		,return_attention_mask=SCREAMING_SNAKE_CASE_		,return_token_type_ids=SCREAMING_SNAKE_CASE_		,return_offsets_mapping=SCREAMING_SNAKE_CASE_		,add_special_tokens=SCREAMING_SNAKE_CASE_		,)

                         __SCREAMING_SNAKE_CASE       :Dict		    =  tokenizer_r.do_lower_case if hasattr(SCREAMING_SNAKE_CASE_		,'''do_lower_case'''							) else False
                         __SCREAMING_SNAKE_CASE       :List[Any]		    =  (
                             [
                                 ((0, 0), tokenizer_r.cls_token),
                                 ((0, 1), 'A'),
                                 ((1, 2), ','),
                                 ((3, 5), 'na'),
                                 ((5, 6), '##ï'),
                                 ((6, 8), '##ve'),
                                 ((9, 15), tokenizer_r.mask_token),
                                 ((16, 21), 'Allen'),
                                 ((21, 23), '##NL'),
                                 ((23, 24), '##P'),
                                 ((25, 33), 'sentence'),
                                 ((33, 34), '.'),
                                 ((0, 0), tokenizer_r.sep_token),
                             ]
                             if not do_lower_case
                             else [
                                 ((0, 0), tokenizer_r.cls_token),
                                 ((0, 1), 'a'),
                                 ((1, 2), ','),
                                 ((3, 8), 'naive'),
                                 ((9, 15), tokenizer_r.mask_token),
                                 ((16, 21), 'allen'),
                                 ((21, 23), '##nl'),
                                 ((23, 24), '##p'),
                                 ((25, 33), 'sentence'),
                                 ((33, 34), '.'),
                                 ((0, 0), tokenizer_r.sep_token),
                             ]
                         )

                         self.assertEqual(
                             [e[1] for e in expected_results]		,tokenizer_r.convert_ids_to_tokens(tokens['''input_ids''']							)							)
                         self.assertEqual([e[0] for e in expected_results]		,tokens['''offset_mapping''']							)




       def    _UpperCamelCase					(						self							)      ->				Tuple:





             """simple docstring"""






             __SCREAMING_SNAKE_CASE       :Optional[Any]		    =  ['的', '人', '有']
             __SCREAMING_SNAKE_CASE       :str		    =  ''.join(SCREAMING_SNAKE_CASE_							)
             for tokenizer, pretrained_name, kwargs in self.tokenizers_list:
                   with self.subTest(f'''{tokenizer.__class__.__name__} ({pretrained_name})'''							):
                         __SCREAMING_SNAKE_CASE       :str		    =  True
                         __SCREAMING_SNAKE_CASE       :Optional[Any]		    =  self.tokenizer_class.from_pretrained(SCREAMING_SNAKE_CASE_		,**SCREAMING_SNAKE_CASE_							)
                         __SCREAMING_SNAKE_CASE       :str		    =  self.rust_tokenizer_class.from_pretrained(SCREAMING_SNAKE_CASE_		,**SCREAMING_SNAKE_CASE_							)

                         __SCREAMING_SNAKE_CASE       :str		    =  tokenizer_p.encode(SCREAMING_SNAKE_CASE_		,add_special_tokens=SCREAMING_SNAKE_CASE_							)
                         __SCREAMING_SNAKE_CASE       :List[Any]		    =  tokenizer_r.encode(SCREAMING_SNAKE_CASE_		,add_special_tokens=SCREAMING_SNAKE_CASE_							)

                         __SCREAMING_SNAKE_CASE       :int		    =  tokenizer_r.convert_ids_to_tokens(SCREAMING_SNAKE_CASE_							)
                         __SCREAMING_SNAKE_CASE       :Union[str, Any]		    =  tokenizer_p.convert_ids_to_tokens(SCREAMING_SNAKE_CASE_							)

                         # it is expected that each Chinese character is not preceded by "##"
                         self.assertListEqual(SCREAMING_SNAKE_CASE_		,SCREAMING_SNAKE_CASE_							)
                         self.assertListEqual(SCREAMING_SNAKE_CASE_		,SCREAMING_SNAKE_CASE_							)

                         __SCREAMING_SNAKE_CASE       :List[Any]		    =  False
                         __SCREAMING_SNAKE_CASE       :int		    =  self.rust_tokenizer_class.from_pretrained(SCREAMING_SNAKE_CASE_		,**SCREAMING_SNAKE_CASE_							)
                         __SCREAMING_SNAKE_CASE       :Union[str, Any]		    =  self.tokenizer_class.from_pretrained(SCREAMING_SNAKE_CASE_		,**SCREAMING_SNAKE_CASE_							)

                         __SCREAMING_SNAKE_CASE       :Union[str, Any]		    =  tokenizer_r.encode(SCREAMING_SNAKE_CASE_		,add_special_tokens=SCREAMING_SNAKE_CASE_							)
                         __SCREAMING_SNAKE_CASE       :Any		    =  tokenizer_p.encode(SCREAMING_SNAKE_CASE_		,add_special_tokens=SCREAMING_SNAKE_CASE_							)

                         __SCREAMING_SNAKE_CASE       :Tuple		    =  tokenizer_r.convert_ids_to_tokens(SCREAMING_SNAKE_CASE_							)
                         __SCREAMING_SNAKE_CASE       :Dict		    =  tokenizer_p.convert_ids_to_tokens(SCREAMING_SNAKE_CASE_							)

                         # it is expected that only the first Chinese character is not preceded by "##".
                         __SCREAMING_SNAKE_CASE       :int		    =  [
                             f'''##{token}''' if idx != 0 else token for idx, token in enumerate(SCREAMING_SNAKE_CASE_							)
                         ]
                         self.assertListEqual(SCREAMING_SNAKE_CASE_		,SCREAMING_SNAKE_CASE_							)
                         self.assertListEqual(SCREAMING_SNAKE_CASE_		,SCREAMING_SNAKE_CASE_							)






"""simple docstring"""
import colorsys

from PIL import Image  # type: ignore



def 					__lowerCamelCase       (							a_					:		float			,       a_					:		float			,       a_					:		int							)      ->				float:
      __SCREAMING_SNAKE_CASE       :List[Any]		    =  x
      __SCREAMING_SNAKE_CASE       :List[Any]		    =  y
      for step in range(a_							):  # noqa: B007
            __SCREAMING_SNAKE_CASE       :Dict		    =  a * a - b * b + x
            __SCREAMING_SNAKE_CASE       :Tuple		    =  2 * a * b + y
            __SCREAMING_SNAKE_CASE       :Dict		    =  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 					__lowerCamelCase       (							a_					:		float							)      ->				tuple:
      if distance == 1:
            return (0, 0, 0)
      else:
            return (2_55, 2_55, 2_55)



def 					__lowerCamelCase       (							a_					:		float							)      ->				tuple:
      if distance == 1:
            return (0, 0, 0)
      else:
            return tuple(round(i * 2_55							) for i in colorsys.hsv_to_rgb(a_			,       1			,       1							)							)



def 					__lowerCamelCase       (							a_					:		int = 8_00			,       a_					:		int = 6_00			,       a_					:		float = -0.6			,       a_					:		float = 0			,       a_					:		float = 3.2			,       a_					:		int = 50			,       a_					:		bool = True			,       )      ->				Image.Image:
      __SCREAMING_SNAKE_CASE       :Optional[int]		    =  Image.new('''RGB'''			,       (image_width, image_height)							)
      __SCREAMING_SNAKE_CASE       :Tuple		    =  img.load()

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

                  __SCREAMING_SNAKE_CASE       :List[Any]		    =  get_distance(a_			,       a_			,       a_							)

                  # color the corresponding pixel based on the selected coloring-function
                  if use_distance_color_coding:
                        __SCREAMING_SNAKE_CASE       :Optional[int]		    =  get_color_coded_rgb(a_							)
                  else:
                        __SCREAMING_SNAKE_CASE       :Optional[Any]		    =  get_black_and_white_rgb(a_							)

      return img


if __name__ == "__main__":
  import doctest

  doctest.testmod()

  # colored version, full figure
  lowerCamelCase_       =		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()