





"""simple docstring"""


import argparse
import json
import os
import sys
import tempfile
import unittest
from argparse import Namespace
from dataclasses import dataclass, field
from enum import Enum
from pathlib import Path
from typing import List, Literal, Optional

import yaml

from transformers import HfArgumentParser, TrainingArguments
from transformers.hf_argparser import make_choice_type_function, string_to_bool


# Since Python 3.10, we can use the builtin `|` operator for Union types
# See PEP 604: https://peps.python.org/pep-0604
lowerCamelCase__				  =   sys.version_info >= (3, 10)




def 					lowercase__    (					lowercase_=None		,lowercase_=None			)					->		Optional[int]:




      """simple docstring"""

      return field(default_factory=lambda: default		,metadata=__A			)



@dataclass
class      __SCREAMING_SNAKE_CASE    :







  '''simple docstring'''


  SCREAMING_SNAKE_CASE__							:Any	     =					42
  SCREAMING_SNAKE_CASE__							:List[Any]	     =					42
  SCREAMING_SNAKE_CASE__							:Optional[Any]	     =					42
  SCREAMING_SNAKE_CASE__							:List[Any]	     =					42





@dataclass
class      __SCREAMING_SNAKE_CASE    :







  '''simple docstring'''


  SCREAMING_SNAKE_CASE__							:List[Any]	     =					42
  SCREAMING_SNAKE_CASE__							:int	     =					field(default="toto"		,  metadata={"help": "help message"}   )





@dataclass
class      __SCREAMING_SNAKE_CASE    :







  '''simple docstring'''


  SCREAMING_SNAKE_CASE__							:int	     =					False
  SCREAMING_SNAKE_CASE__							:List[str]	     =					True
  SCREAMING_SNAKE_CASE__							:Dict	     =					None





class      __SCREAMING_SNAKE_CASE    (						__lowerCAmelCase   ):







  '''simple docstring'''


  SCREAMING_SNAKE_CASE__							:Union[str, Any]	     =					"titi"
  SCREAMING_SNAKE_CASE__							:Dict	     =					"toto"





class      __SCREAMING_SNAKE_CASE    (						__lowerCAmelCase   ):







  '''simple docstring'''


  SCREAMING_SNAKE_CASE__							:List[Any]	     =					"titi"
  SCREAMING_SNAKE_CASE__							:List[Any]	     =					"toto"
  SCREAMING_SNAKE_CASE__							:List[str]	     =					42





@dataclass
class      __SCREAMING_SNAKE_CASE    :







  '''simple docstring'''


  SCREAMING_SNAKE_CASE__							:List[str]	     =					"toto"

  def    __SCREAMING_SNAKE_CASE				(		self   :       int	)		->				Any:
        _UpperCamelCase      :	Union[str, Any]						=       BasicEnum(self.foo	)





@dataclass
class      __SCREAMING_SNAKE_CASE    :







  '''simple docstring'''


  SCREAMING_SNAKE_CASE__							:str	     =					"toto"

  def    __SCREAMING_SNAKE_CASE				(		self   :       Union[str, Any]	)		->				List[str]:
        _UpperCamelCase      :	Union[str, Any]						=       MixedTypeEnum(self.foo	)





@dataclass
class      __SCREAMING_SNAKE_CASE    :







  '''simple docstring'''


  SCREAMING_SNAKE_CASE__							:List[str]	     =					None
  SCREAMING_SNAKE_CASE__							:Tuple	     =					field(default=__lowerCAmelCase		,  metadata={"help": "help message"}   )
  SCREAMING_SNAKE_CASE__							:Dict	     =					None
  SCREAMING_SNAKE_CASE__							:Dict	     =					list_field(default=[]   )
  SCREAMING_SNAKE_CASE__							:Union[str, Any]	     =					list_field(default=[]   )





@dataclass
class      __SCREAMING_SNAKE_CASE    :







  '''simple docstring'''


  SCREAMING_SNAKE_CASE__							:int	     =					list_field(default=[]   )
  SCREAMING_SNAKE_CASE__							:Optional[Any]	     =					list_field(default=[1, 2, 3]   )
  SCREAMING_SNAKE_CASE__							:Optional[Any]	     =					list_field(default=["Hallo", "Bonjour", "Hello"]   )
  SCREAMING_SNAKE_CASE__							:int	     =					list_field(default=[0.1, 0.2, 0.3]   )





@dataclass
class      __SCREAMING_SNAKE_CASE    :







  '''simple docstring'''


  SCREAMING_SNAKE_CASE__							:Optional[int]	     =					field()
  SCREAMING_SNAKE_CASE__							:str	     =					field()
  SCREAMING_SNAKE_CASE__							:List[Any]	     =					field()

  def    __SCREAMING_SNAKE_CASE				(		self   :       Dict	)		->				Any:
        _UpperCamelCase      :	Dict						=       BasicEnum(self.required_enum	)





@dataclass
class      __SCREAMING_SNAKE_CASE    :







  '''simple docstring'''


  SCREAMING_SNAKE_CASE__							:str	     =					42
  SCREAMING_SNAKE_CASE__							:Dict	     =					field()
  SCREAMING_SNAKE_CASE__							:List[Any]	     =					None
  SCREAMING_SNAKE_CASE__							:Dict	     =					field(default="toto"		,  metadata={"help": "help message"}   )
  SCREAMING_SNAKE_CASE__							:str	     =					list_field(default=["Hallo", "Bonjour", "Hello"]   )


if is_python_no_less_than_3_10:



  @dataclass
  class      __SCREAMING_SNAKE_CASE    :







    '''simple docstring'''


    SCREAMING_SNAKE_CASE__							:Optional[Any]	     =					False
    SCREAMING_SNAKE_CASE__							:Optional[int]	     =					True
    SCREAMING_SNAKE_CASE__							:str	     =					None





  @dataclass
  class      __SCREAMING_SNAKE_CASE    :







    '''simple docstring'''


    SCREAMING_SNAKE_CASE__							:Any	     =					None
    SCREAMING_SNAKE_CASE__							:str	     =					field(default=__lowerCAmelCase		,  metadata={"help": "help message"}   )
    SCREAMING_SNAKE_CASE__							:Tuple	     =					None
    SCREAMING_SNAKE_CASE__							:List[str]	     =					list_field(default=[]   )
    SCREAMING_SNAKE_CASE__							:List[Any]	     =					list_field(default=[]   )



class      __SCREAMING_SNAKE_CASE    (						unittest.TestCase   ):







  '''simple docstring'''


  def    __SCREAMING_SNAKE_CASE				(		self   :       Union[str, Any]					,   __a   :       argparse.ArgumentParser					,   __a   :       argparse.ArgumentParser	)		->				Tuple:
        self.assertEqual(len(a._actions	)					,   len(b._actions	)	)
        for x, y in zip(a._actions					,   b._actions	):
              _UpperCamelCase      :	Optional[Any]						=       {k: v for k, v in vars(_UpperCamelCase	).items() if k != """container"""}
              _UpperCamelCase      :	Any						=       {k: v for k, v in vars(_UpperCamelCase	).items() if k != """container"""}

              # Choices with mixed type have custom function as "type"
              # So we need to compare results directly for equality
              if xx.get("choices"					,   _UpperCamelCase	) and yy.get("choices"					,   _UpperCamelCase	):
                    for expected_choice in yy["choices"] + xx["choices"]:
                          self.assertEqual(xx["type"](_UpperCamelCase	)					,   yy["type"](_UpperCamelCase	)	)
                    del xx["type"], yy["type"]

              self.assertEqual(_UpperCamelCase					,   _UpperCamelCase	)

  def    __SCREAMING_SNAKE_CASE				(		self   :       List[Any]	)		->				Any:
        _UpperCamelCase      :	List[Any]						=       HfArgumentParser(_UpperCamelCase	)

        _UpperCamelCase      :	Tuple						=       argparse.ArgumentParser()
        expected.add_argument("--foo"					,   type=_UpperCamelCase					,   required=_UpperCamelCase	)
        expected.add_argument("--bar"					,   type=_UpperCamelCase					,   required=_UpperCamelCase	)
        expected.add_argument("--baz"					,   type=_UpperCamelCase					,   required=_UpperCamelCase	)
        expected.add_argument("--flag"					,   type=_UpperCamelCase					,   default=_UpperCamelCase					,   const=_UpperCamelCase					,   nargs="?"	)
        self.argparsersEqual(_UpperCamelCase					,   _UpperCamelCase	)

        _UpperCamelCase      :	Any						=       ["""--foo""", """1""", """--baz""", """quux""", """--bar""", """0.5"""]
        (_UpperCamelCase							)      :	Tuple						=       parser.parse_args_into_dataclasses(_UpperCamelCase					,   look_for_args_file=_UpperCamelCase	)
        self.assertFalse(example.flag	)

  def    __SCREAMING_SNAKE_CASE				(		self   :       Optional[int]	)		->				Union[str, Any]:
        _UpperCamelCase      :	Any						=       HfArgumentParser(_UpperCamelCase	)

        _UpperCamelCase      :	List[Any]						=       argparse.ArgumentParser()
        expected.add_argument("--foo"					,   default=42					,   type=_UpperCamelCase	)
        expected.add_argument("--baz"					,   default="toto"					,   type=_UpperCamelCase					,   help="help message"	)
        self.argparsersEqual(_UpperCamelCase					,   _UpperCamelCase	)

  def    __SCREAMING_SNAKE_CASE				(		self   :       int	)		->				Optional[int]:
        _UpperCamelCase      :	Tuple						=       argparse.ArgumentParser()
        expected.add_argument("--foo"					,   type=_UpperCamelCase					,   default=_UpperCamelCase					,   const=_UpperCamelCase					,   nargs="?"	)
        expected.add_argument("--baz"					,   type=_UpperCamelCase					,   default=_UpperCamelCase					,   const=_UpperCamelCase					,   nargs="?"	)
        # A boolean no_* argument always has to come after its "default: True" regular counter-part
        # and its default must be set to False
        expected.add_argument("--no_baz"					,   action="store_false"					,   default=_UpperCamelCase					,   dest="baz"	)
        expected.add_argument("--opt"					,   type=_UpperCamelCase					,   default=_UpperCamelCase	)

        _UpperCamelCase      :	List[str]						=       [WithDefaultBoolExample]
        if is_python_no_less_than_3_10:
              dataclass_types.append(_UpperCamelCase	)

        for dataclass_type in dataclass_types:
              _UpperCamelCase      :	Optional[Any]						=       HfArgumentParser(_UpperCamelCase	)
              self.argparsersEqual(_UpperCamelCase					,   _UpperCamelCase	)

              _UpperCamelCase      :	str						=       parser.parse_args([]	)
              self.assertEqual(_UpperCamelCase					,   Namespace(foo=_UpperCamelCase					,   baz=_UpperCamelCase					,   opt=_UpperCamelCase	)	)

              _UpperCamelCase      :	Any						=       parser.parse_args(["--foo", "--no_baz"]	)
              self.assertEqual(_UpperCamelCase					,   Namespace(foo=_UpperCamelCase					,   baz=_UpperCamelCase					,   opt=_UpperCamelCase	)	)

              _UpperCamelCase      :	Union[str, Any]						=       parser.parse_args(["--foo", "--baz"]	)
              self.assertEqual(_UpperCamelCase					,   Namespace(foo=_UpperCamelCase					,   baz=_UpperCamelCase					,   opt=_UpperCamelCase	)	)

              _UpperCamelCase      :	int						=       parser.parse_args(["--foo", "True", "--baz", "True", "--opt", "True"]	)
              self.assertEqual(_UpperCamelCase					,   Namespace(foo=_UpperCamelCase					,   baz=_UpperCamelCase					,   opt=_UpperCamelCase	)	)

              _UpperCamelCase      :	Optional[Any]						=       parser.parse_args(["--foo", "False", "--baz", "False", "--opt", "False"]	)
              self.assertEqual(_UpperCamelCase					,   Namespace(foo=_UpperCamelCase					,   baz=_UpperCamelCase					,   opt=_UpperCamelCase	)	)

  def    __SCREAMING_SNAKE_CASE				(		self   :       str	)		->				Any:
        _UpperCamelCase      :	int						=       HfArgumentParser(_UpperCamelCase	)

        _UpperCamelCase      :	Dict						=       argparse.ArgumentParser()
        expected.add_argument(
            "--foo"					,   default="toto"					,   choices=["titi", "toto", 42]					,   type=make_choice_type_function(["titi", "toto", 42]	)					,   )
        self.argparsersEqual(_UpperCamelCase					,   _UpperCamelCase	)

        _UpperCamelCase      :	Dict						=       parser.parse_args([]	)
        self.assertEqual(args.foo					,   "toto"	)
        _UpperCamelCase      :	Optional[int]						=       parser.parse_args_into_dataclasses([]	)[0]
        self.assertEqual(enum_ex.foo					,   MixedTypeEnum.toto	)

        _UpperCamelCase      :	Tuple						=       parser.parse_args(["--foo", "titi"]	)
        self.assertEqual(args.foo					,   "titi"	)
        _UpperCamelCase      :	int						=       parser.parse_args_into_dataclasses(["--foo", "titi"]	)[0]
        self.assertEqual(enum_ex.foo					,   MixedTypeEnum.titi	)

        _UpperCamelCase      :	List[str]						=       parser.parse_args(["--foo", "42"]	)
        self.assertEqual(args.foo					,   42	)
        _UpperCamelCase      :	Union[str, Any]						=       parser.parse_args_into_dataclasses(["--foo", "42"]	)[0]
        self.assertEqual(enum_ex.foo					,   MixedTypeEnum.fourtytwo	)

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



        @dataclass
        class      __SCREAMING_SNAKE_CASE    :







          '''simple docstring'''


          SCREAMING_SNAKE_CASE__							:Union[str, Any]	     =					"toto"





        _UpperCamelCase      :	List[Any]						=       HfArgumentParser(_UpperCamelCase	)

        _UpperCamelCase      :	Tuple						=       argparse.ArgumentParser()
        expected.add_argument(
            "--foo"					,   default="toto"					,   choices=("titi", "toto", 42)					,   type=make_choice_type_function(["titi", "toto", 42]	)					,   )
        self.argparsersEqual(_UpperCamelCase					,   _UpperCamelCase	)

        _UpperCamelCase      :	Tuple						=       parser.parse_args([]	)
        self.assertEqual(args.foo					,   "toto"	)

        _UpperCamelCase      :	Any						=       parser.parse_args(["--foo", "titi"]	)
        self.assertEqual(args.foo					,   "titi"	)

        _UpperCamelCase      :	str						=       parser.parse_args(["--foo", "42"]	)
        self.assertEqual(args.foo					,   42	)

  def    __SCREAMING_SNAKE_CASE				(		self   :       Tuple	)		->				Tuple:
        _UpperCamelCase      :	Optional[Any]						=       HfArgumentParser(_UpperCamelCase	)

        _UpperCamelCase      :	Any						=       argparse.ArgumentParser()
        expected.add_argument("--foo_int"					,   nargs="+"					,   default=[]					,   type=_UpperCamelCase	)
        expected.add_argument("--bar_int"					,   nargs="+"					,   default=[1, 2, 3]					,   type=_UpperCamelCase	)
        expected.add_argument("--foo_str"					,   nargs="+"					,   default=["Hallo", "Bonjour", "Hello"]					,   type=_UpperCamelCase	)
        expected.add_argument("--foo_float"					,   nargs="+"					,   default=[0.1, 0.2, 0.3]					,   type=_UpperCamelCase	)

        self.argparsersEqual(_UpperCamelCase					,   _UpperCamelCase	)

        _UpperCamelCase      :	int						=       parser.parse_args([]	)
        self.assertEqual(
            _UpperCamelCase					,   Namespace(foo_int=[]					,   bar_int=[1, 2, 3]					,   foo_str=["Hallo", "Bonjour", "Hello"]					,   foo_float=[0.1, 0.2, 0.3]	)					,   )

        _UpperCamelCase      :	Any						=       parser.parse_args("--foo_int 1 --bar_int 2 3 --foo_str a b c --foo_float 0.1 0.7".split()	)
        self.assertEqual(_UpperCamelCase					,   Namespace(foo_int=[1]					,   bar_int=[2, 3]					,   foo_str=["a", "b", "c"]					,   foo_float=[0.1, 0.7]	)	)

  def    __SCREAMING_SNAKE_CASE				(		self   :       int	)		->				Optional[Any]:
        _UpperCamelCase      :	Optional[Any]						=       argparse.ArgumentParser()
        expected.add_argument("--foo"					,   default=_UpperCamelCase					,   type=_UpperCamelCase	)
        expected.add_argument("--bar"					,   default=_UpperCamelCase					,   type=_UpperCamelCase					,   help="help message"	)
        expected.add_argument("--baz"					,   default=_UpperCamelCase					,   type=_UpperCamelCase	)
        expected.add_argument("--ces"					,   nargs="+"					,   default=[]					,   type=_UpperCamelCase	)
        expected.add_argument("--des"					,   nargs="+"					,   default=[]					,   type=_UpperCamelCase	)

        _UpperCamelCase      :	str						=       [OptionalExample]
        if is_python_no_less_than_3_10:
              dataclass_types.append(_UpperCamelCase	)

        for dataclass_type in dataclass_types:
              _UpperCamelCase      :	Tuple						=       HfArgumentParser(_UpperCamelCase	)

              self.argparsersEqual(_UpperCamelCase					,   _UpperCamelCase	)

              _UpperCamelCase      :	int						=       parser.parse_args([]	)
              self.assertEqual(_UpperCamelCase					,   Namespace(foo=_UpperCamelCase					,   bar=_UpperCamelCase					,   baz=_UpperCamelCase					,   ces=[]					,   des=[]	)	)

              _UpperCamelCase      :	List[Any]						=       parser.parse_args("--foo 12 --bar 3.14 --baz 42 --ces a b c --des 1 2 3".split()	)
              self.assertEqual(_UpperCamelCase					,   Namespace(foo=12					,   bar=3.14					,   baz="42"					,   ces=["a", "b", "c"]					,   des=[1, 2, 3]	)	)

  def    __SCREAMING_SNAKE_CASE				(		self   :       Optional[int]	)		->				List[Any]:
        _UpperCamelCase      :	str						=       HfArgumentParser(_UpperCamelCase	)

        _UpperCamelCase      :	str						=       argparse.ArgumentParser()
        expected.add_argument("--required_list"					,   nargs="+"					,   type=_UpperCamelCase					,   required=_UpperCamelCase	)
        expected.add_argument("--required_str"					,   type=_UpperCamelCase					,   required=_UpperCamelCase	)
        expected.add_argument(
            "--required_enum"					,   type=make_choice_type_function(["titi", "toto"]	)					,   choices=["titi", "toto"]					,   required=_UpperCamelCase					,   )
        self.argparsersEqual(_UpperCamelCase					,   _UpperCamelCase	)

  def    __SCREAMING_SNAKE_CASE				(		self   :       str	)		->				Optional[int]:
        _UpperCamelCase      :	str						=       HfArgumentParser(_UpperCamelCase	)

        _UpperCamelCase      :	Optional[Any]						=       argparse.ArgumentParser()
        expected.add_argument("--foo"					,   type=_UpperCamelCase					,   required=_UpperCamelCase	)
        expected.add_argument(
            "--required_enum"					,   type=make_choice_type_function(["titi", "toto"]	)					,   choices=["titi", "toto"]					,   required=_UpperCamelCase					,   )
        expected.add_argument("--opt"					,   type=_UpperCamelCase					,   default=_UpperCamelCase	)
        expected.add_argument("--baz"					,   default="toto"					,   type=_UpperCamelCase					,   help="help message"	)
        expected.add_argument("--foo_str"					,   nargs="+"					,   default=["Hallo", "Bonjour", "Hello"]					,   type=_UpperCamelCase	)
        self.argparsersEqual(_UpperCamelCase					,   _UpperCamelCase	)

  def    __SCREAMING_SNAKE_CASE				(		self   :       str	)		->				Optional[int]:
        _UpperCamelCase      :	List[str]						=       HfArgumentParser(_UpperCamelCase	)

        _UpperCamelCase      :	List[Any]						=       {
            """foo""": 12,
            """bar""": 3.14,
            """baz""": """42""",
            """flag""": True,
        }

        _UpperCamelCase      :	int						=       parser.parse_dict(_UpperCamelCase	)[0]
        _UpperCamelCase      :	List[Any]						=       BasicExample(**_UpperCamelCase	)
        self.assertEqual(_UpperCamelCase					,   _UpperCamelCase	)

  def    __SCREAMING_SNAKE_CASE				(		self   :       Optional[Any]	)		->				List[Any]:
        _UpperCamelCase      :	Dict						=       HfArgumentParser(_UpperCamelCase	)

        _UpperCamelCase      :	Tuple						=       {
            """foo""": 12,
            """bar""": 3.14,
            """baz""": """42""",
            """flag""": True,
            """extra""": 42,
        }

        self.assertRaises(_UpperCamelCase					,   parser.parse_dict					,   _UpperCamelCase					,   allow_extra_keys=_UpperCamelCase	)

  def    __SCREAMING_SNAKE_CASE				(		self   :       str	)		->				Tuple:
        _UpperCamelCase      :	str						=       HfArgumentParser(_UpperCamelCase	)

        _UpperCamelCase      :	List[str]						=       {
            """foo""": 12,
            """bar""": 3.14,
            """baz""": """42""",
            """flag""": True,
        }
        with tempfile.TemporaryDirectory() as tmp_dir:
              _UpperCamelCase      :	Union[str, Any]						=       os.path.join(_UpperCamelCase					,   "temp_json"	)
              os.mkdir(_UpperCamelCase	)
              with open(temp_local_path + ".json"					,   "w+"	) as f:
                    json.dump(_UpperCamelCase					,   _UpperCamelCase	)
              _UpperCamelCase      :	List[str]						=       parser.parse_yaml_file(Path(temp_local_path + ".json"	)	)[0]

        _UpperCamelCase      :	Dict						=       BasicExample(**_UpperCamelCase	)
        self.assertEqual(_UpperCamelCase					,   _UpperCamelCase	)

  def    __SCREAMING_SNAKE_CASE				(		self   :       str	)		->				Tuple:
        _UpperCamelCase      :	Tuple						=       HfArgumentParser(_UpperCamelCase	)

        _UpperCamelCase      :	Union[str, Any]						=       {
            """foo""": 12,
            """bar""": 3.14,
            """baz""": """42""",
            """flag""": True,
        }
        with tempfile.TemporaryDirectory() as tmp_dir:
              _UpperCamelCase      :	int						=       os.path.join(_UpperCamelCase					,   "temp_yaml"	)
              os.mkdir(_UpperCamelCase	)
              with open(temp_local_path + ".yaml"					,   "w+"	) as f:
                    yaml.dump(_UpperCamelCase					,   _UpperCamelCase	)
              _UpperCamelCase      :	Optional[int]						=       parser.parse_yaml_file(Path(temp_local_path + ".yaml"	)	)[0]
        _UpperCamelCase      :	Any						=       BasicExample(**_UpperCamelCase	)
        self.assertEqual(_UpperCamelCase					,   _UpperCamelCase	)


  def    __SCREAMING_SNAKE_CASE				(		self   :       List[Any]	)		->				Any:
        _UpperCamelCase      :	Optional[int]						=       HfArgumentParser(_UpperCamelCase	)
        self.assertIsNotNone(_UpperCamelCase	)







"""simple docstring"""


from collections.abc import Iterator, MutableMapping
from dataclasses import dataclass
from typing import Generic, TypeVar

lowerCamelCase__				  =   TypeVar("KEY")
lowerCamelCase__				  =   TypeVar("VAL")



@dataclass(frozen=_UpperCamelCase		,  slots=_UpperCamelCase   )
class      __SCREAMING_SNAKE_CASE    (						Generic[KEY, VAL]   ):







  '''simple docstring'''


  SCREAMING_SNAKE_CASE__							:KEY
  SCREAMING_SNAKE_CASE__							:VAL





class      __SCREAMING_SNAKE_CASE    (						_Item   ):







  '''simple docstring'''


  def __init__(		self   :       List[str]	)		->				None:
        super().__init__(__a					,   __a	)


  def __bool__(		self   :       Dict	)		->				bool:
        return False





lowerCamelCase__				  =   _DeletedItem()



class      __SCREAMING_SNAKE_CASE    (						MutableMapping[KEY, VAL]   ):







  '''simple docstring'''


  def __init__(		self   :       int					,   __a   :       int = 8					,   __a   :       float = 0.75	)		->				None:
        _UpperCamelCase      :	str						=       initial_block_size
        _UpperCamelCase      :	list[_Item | None]						=       [None] * initial_block_size
        assert 0.0 < capacity_factor < 1.0
        _UpperCamelCase      :	List[str]						=       capacity_factor
        _UpperCamelCase      :	Dict						=       0

  def    __SCREAMING_SNAKE_CASE				(		self   :       int					,   __a   :       KEY	)		->				int:
        return hash(__a	) % len(self._buckets	)

  def    __SCREAMING_SNAKE_CASE				(		self   :       List[Any]					,   __a   :       int	)		->				int:
        return (ind + 1) % len(self._buckets	)

  def    __SCREAMING_SNAKE_CASE				(		self   :       Tuple					,   __a   :       int					,   __a   :       KEY					,   __a   :       VAL	)		->				bool:
        _UpperCamelCase      :	List[Any]						=       self._buckets[ind]
        if not stored:
              _UpperCamelCase      :	Tuple						=       _Item(__a					,   __a	)
              self._len += 1
              return True
        elif stored.key == key:
              _UpperCamelCase      :	Union[str, Any]						=       _Item(__a					,   __a	)
              return True
        else:
              return False

  def    __SCREAMING_SNAKE_CASE				(		self   :       List[str]	)		->				bool:
        _UpperCamelCase      :	Any						=       len(self._buckets	) * self._capacity_factor
        return len(self	) >= int(__a	)

  def    __SCREAMING_SNAKE_CASE				(		self   :       str	)		->				bool:
        if len(self._buckets	) <= self._initial_block_size:
              return False
        _UpperCamelCase      :	List[str]						=       len(self._buckets	) * self._capacity_factor / 2
        return len(self	) < limit

  def    __SCREAMING_SNAKE_CASE				(		self   :       Union[str, Any]					,   __a   :       int	)		->				None:
        _UpperCamelCase      :	Any						=       self._buckets
        _UpperCamelCase      :	List[Any]						=       [None] * new_size
        _UpperCamelCase      :	List[str]						=       0
        for item in old_buckets:
              if item:
                    self._add_item(item.key					,   item.val	)

  def    __SCREAMING_SNAKE_CASE				(		self   :       int	)		->				None:
        self._resize(len(self._buckets	) * 2	)

  def    __SCREAMING_SNAKE_CASE				(		self   :       Union[str, Any]	)		->				None:
        self._resize(len(self._buckets	) // 2	)

  def    __SCREAMING_SNAKE_CASE				(		self   :       List[Any]					,   __a   :       KEY	)		->				Iterator[int]:
        _UpperCamelCase      :	str						=       self._get_bucket_index(__a	)
        for _ in range(len(self._buckets	)	):
              yield ind
              _UpperCamelCase      :	Tuple						=       self._get_next_ind(__a	)

  def    __SCREAMING_SNAKE_CASE				(		self   :       Optional[int]					,   __a   :       KEY					,   __a   :       VAL	)		->				None:
        for ind in self._iterate_buckets(__a	):
              if self._try_set(__a					,   __a					,   __a	):
                    break

  def __setitem__(		self   :       int					,   __a   :       KEY					,   __a   :       VAL	)		->				None:
        if self._is_full():
              self._size_up()

        self._add_item(__a					,   __a	)

  def __delitem__(		self   :       str					,   __a   :       KEY	)		->				None:
        for ind in self._iterate_buckets(__a	):
              _UpperCamelCase      :	Tuple						=       self._buckets[ind]
              if item is None:
                    raise KeyError(__a	)
              if item is _deleted:
                    continue
              if item.key == key:
                    _UpperCamelCase      :	List[Any]						=       _deleted
                    self._len -= 1
                    break
        if self._is_sparse():
              self._size_down()

  def __getitem__(		self   :       str					,   __a   :       KEY	)		->				VAL:
        for ind in self._iterate_buckets(__a	):
              _UpperCamelCase      :	Tuple						=       self._buckets[ind]
              if item is None:
                    break
              if item is _deleted:
                    continue
              if item.key == key:
                    return item.val
        raise KeyError(__a	)

  def __len__(		self   :       List[Any]	)		->				int:
        return self._len

  def __iter__(		self   :       List[str]	)		->				Iterator[KEY]:
        yield from (item.key for item in self._buckets if item)


  def __repr__(		self   :       List[str]	)		->				str:
        _UpperCamelCase      :	Optional[int]						=       " ,".join(
            F'''{item.key}: {item.val}''' for item in self._buckets if item	)
        return F'''HashMap({val_string})'''
