'''simple docstring'''




from __future__ import annotations

import string
from itertools import cycle, product
from pathlib import Path

__SCREAMING_SNAKE_CASE       :     str     =  (
    string.ascii_letters + string.digits + string.punctuation + string.whitespace
)
__SCREAMING_SNAKE_CASE       :     list[int]     =  [ord(letter) for letter in string.ascii_lowercase]
__SCREAMING_SNAKE_CASE       :     set[int]     =  {ord(char) for char in VALID_CHARS}

__SCREAMING_SNAKE_CASE       :     list[str]     =  ["the", "be", "to", "of", "and", "in", "that", "have"]

def 	UpperCamelCase_							(					_UpperCAmelCase  :      list[int]			,	_UpperCAmelCase  :      tuple[int, ...]    )    ->    str | None:


       """simple docstring"""







       _UpperCAmelCase     :  str							      =    ""
       _UpperCAmelCase     :  int
       _UpperCAmelCase     :  int
       _UpperCAmelCase     :  int

       for keychar, cipherchar in zip(cycle(_UpperCAmelCase    )			,	_UpperCAmelCase    ):
              _UpperCAmelCase     :  str							      =    cipherchar ^ keychar
              if decodedchar not in VALID_INTS:
                     return None
              decoded += chr(_UpperCAmelCase    )

       return decoded

def 	UpperCamelCase_							(					_UpperCAmelCase  :      list[int]    )    ->    list[str]:


       """simple docstring"""







       _UpperCAmelCase     :  list[str]							      =    []
       for key in product(_UpperCAmelCase			,	repeat=3    ):
              _UpperCAmelCase     :  Tuple							      =    try_key(_UpperCAmelCase			,	_UpperCAmelCase    )
              if encoded is not None:
                     possibles.append(_UpperCAmelCase    )
       return possibles

def 	UpperCamelCase_							(					_UpperCAmelCase  :      list[str]			,	_UpperCAmelCase  :      str    )    ->    list[str]:


       """simple docstring"""







       return [possible for possible in possibles if common_word in possible.lower()]

def 	UpperCamelCase_							(					_UpperCAmelCase  :      str = "p059_cipher.txt"    )    ->    int:


       """simple docstring"""







       _UpperCAmelCase     :  list[int]
       _UpperCAmelCase     :  list[str]
       _UpperCAmelCase     :  str
       _UpperCAmelCase     :  str
       _UpperCAmelCase     :  str							      =    Path(_UpperCAmelCase    ).parent.joinpath(_UpperCAmelCase    ).read_text(encoding="utf-8"    )

       _UpperCAmelCase     :  Optional[int]							      =    [int(_UpperCAmelCase    ) for number in data.strip().split(","    )]

       _UpperCAmelCase     :  Tuple							      =    filter_valid_chars(_UpperCAmelCase    )
       for common_word in COMMON_WORDS:
              _UpperCAmelCase     :  str							      =    filter_common_word(_UpperCAmelCase			,	_UpperCAmelCase    )
              if len(_UpperCAmelCase    ) == 1:
                     break

       _UpperCAmelCase     :  Tuple							      =    possibles[0]
       return sum(ord(_UpperCAmelCase    ) for char in decoded_text    )


if __name__ == "__main__":
  print(F'{solution() = }')


'''simple docstring'''




import numpy as np
from matplotlib import pyplot as plt
from sklearn.datasets import load_iris
from sklearn.metrics import ConfusionMatrixDisplay
from sklearn.model_selection import train_test_split
from xgboost import XGBClassifier

def 	UpperCamelCase_							(					_UpperCAmelCase  :      dict    )    ->    tuple:


       """simple docstring"""







       return (data["data"], data["target"])

def 	UpperCamelCase_							(					_UpperCAmelCase  :      np.ndarray			,	_UpperCAmelCase  :      np.ndarray    )    ->    XGBClassifier:


       """simple docstring"""







       _UpperCAmelCase     :  Any							      =    XGBClassifier()
       classifier.fit(_UpperCAmelCase			,	_UpperCAmelCase    )
       return classifier

def 	UpperCamelCase_							(					)    ->    None:


       """simple docstring"""







       _UpperCAmelCase     :  List[str]							      =    load_iris()
       _UpperCAmelCase      ,  _UpperCAmelCase     :  Dict							      =    data_handling(_UpperCAmelCase    )
       _UpperCAmelCase      ,  _UpperCAmelCase      ,  _UpperCAmelCase      ,  _UpperCAmelCase     :  str							      =    train_test_split(
           _UpperCAmelCase			,	_UpperCAmelCase			,	test_size=0.2_5    )

       _UpperCAmelCase     :  Optional[Any]							      =    iris["target_names"]

       # Create an XGBoost Classifier from the training data
       _UpperCAmelCase     :  Tuple							      =    xgboost(_UpperCAmelCase			,	_UpperCAmelCase    )

       # Display the confusion matrix of the classifier with both training and test sets
       ConfusionMatrixDisplay.from_estimator(
           _UpperCAmelCase			,	_UpperCAmelCase			,	_UpperCAmelCase			,	display_labels=_UpperCAmelCase			,	cmap="Blues"			,	normalize="true"			,	)
       plt.title("Normalized Confusion Matrix - IRIS Dataset"    )
       plt.show()


if __name__ == "__main__":
  import doctest

  doctest.testmod(verbose=True)
  main()

