



"""simple docstring"""






import re
import warnings
from contextlib import contextmanager

from ...processing_utils import ProcessorMixin



class     UpperCAmelCase    (	__SCREAMING_SNAKE_CASE  ):
   A__		:	str           =  ['''image_processor''', '''tokenizer''']
   A__		:	Dict           =  '''AutoImageProcessor'''
   A__		:	List[Any]           =  '''AutoTokenizer'''



   def __init__(       self    :	Optional[Any]							,       __lowerCamelCase    :	Union[str, Any]=None							,       __lowerCamelCase    :	Dict=None							,       **__lowerCamelCase    :	Optional[Any]				):



     """simple docstring"""
     _snake_case   	=      None
     if "feature_extractor" in kwargs:
       warnings.warn(
           '''The `feature_extractor` argument is deprecated and will be removed in v5, use `image_processor`'''
           ''' instead.'''							,       __lowerCamelCase							,       )
       _snake_case   	=      kwargs.pop('''feature_extractor'''				)

     _snake_case   	=      image_processor if image_processor is not None else feature_extractor
     if image_processor is None:
       raise ValueError('''You need to specify an `image_processor`.'''				)
     if tokenizer is None:
       raise ValueError('''You need to specify a `tokenizer`.'''				)

     super().__init__(__lowerCamelCase							,       __lowerCamelCase				)
     _snake_case   	=      self.image_processor
     _snake_case   	=      False



   def __call__(       self    :	Union[str, Any]							,       *__lowerCamelCase    :	Optional[int]							,       **__lowerCamelCase    :	Optional[Any]				):



     """simple docstring"""
     # For backward compatibility
     if self._in_target_context_manager:
       return self.current_processor(*__lowerCamelCase							,       **__lowerCamelCase				)

     _snake_case   	=      kwargs.pop('''images'''							,       __lowerCamelCase				)
     _snake_case   	=      kwargs.pop('''text'''							,       __lowerCamelCase				)
     if len(__lowerCamelCase				) > 0:
       _snake_case   	=      args[0]
       _snake_case   	=      args[1:]

     if images is None and text is None:
       raise ValueError('''You need to specify either an `images` or `text` input to process.'''				)

     if images is not None:
       _snake_case   	=      self.image_processor(__lowerCamelCase							,       *__lowerCamelCase							,       **__lowerCamelCase				)
     if text is not None:
       _snake_case   	=      self.tokenizer(__lowerCamelCase							,       **__lowerCamelCase				)

     if text is None:
       return inputs
     elif images is None:
       return encodings
     else:
       _snake_case   	=      encodings['''input_ids''']
       return inputs



   def    __UpperCAmelCase    (       self    :	int							,       *__lowerCamelCase    :	Union[str, Any]							,       **__lowerCamelCase    :	Dict				):



     """simple docstring"""
     return self.tokenizer.batch_decode(*__lowerCamelCase							,       **__lowerCamelCase				)



   def    __UpperCAmelCase    (       self    :	str							,       *__lowerCamelCase    :	Dict							,       **__lowerCamelCase    :	Union[str, Any]				):



     """simple docstring"""
     return self.tokenizer.decode(*__lowerCamelCase							,       **__lowerCamelCase				)



   @contextmanager
   def    __UpperCAmelCase    (       self    :	List[str]				):



     """simple docstring"""
     warnings.warn(
         '''`as_target_processor` is deprecated and will be removed in v5 of Transformers. You can process your '''
         '''labels by using the argument `text` of the regular `__call__` method (either in the same call as '''
         '''your images inputs, or in a separate call.'''				)
     _snake_case   	=      True
     _snake_case   	=      self.tokenizer
     yield
     _snake_case   	=      self.image_processor
     _snake_case   	=      False



   def    __UpperCAmelCase    (       self    :	int							,       __lowerCamelCase    :	List[str]							,       __lowerCamelCase    :	Union[str, Any]=False							,       __lowerCamelCase    :	Optional[int]=None				):



     """simple docstring"""
     if added_vocab is None:
       _snake_case   	=      self.tokenizer.get_added_vocab()

     _snake_case   	=      {}

     while tokens:
       _snake_case   	=      re.search(R'''<s_(.*?)>'''							,       __lowerCamelCase							,       re.IGNORECASE				)
       if start_token is None:
         break
       _snake_case   	=      start_token.group(1				)
       _snake_case   	=      re.search(Rf"""</s_{key}>"""							,       __lowerCamelCase							,       re.IGNORECASE				)
       _snake_case   	=      start_token.group()
       if end_token is None:
         _snake_case   	=      tokens.replace(__lowerCamelCase							,       ''''''				)
       else:
         _snake_case   	=      end_token.group()
         _snake_case   	=      re.escape(__lowerCamelCase				)
         _snake_case   	=      re.escape(__lowerCamelCase				)
         _snake_case   	=      re.search(f"""{start_token_escaped}(.*?){end_token_escaped}"""							,       __lowerCamelCase							,       re.IGNORECASE				)
         if content is not None:
           _snake_case   	=      content.group(1				).strip()
           if r"<s_" in content and r"</s_" in content:  # non-leaf node
             _snake_case   	=      self.tokenajson(__lowerCamelCase							,       is_inner_value=__lowerCamelCase							,       added_vocab=__lowerCamelCase				)
             if value:
               if len(__lowerCamelCase				) == 1:
                 _snake_case   	=      value[0]
               _snake_case   	=      value
           else:  # leaf nodes
             _snake_case   	=      []
             for leaf in content.split(R'''<sep/>'''				):
               _snake_case   	=      leaf.strip()
               if leaf in added_vocab and leaf[0] == "<" and leaf[-2:] == "/>":
                 _snake_case   	=      leaf[1:-2]  # for categorical special tokens
               output[key].append(__lowerCamelCase				)
             if len(output[key]				) == 1:
               _snake_case   	=      output[key][0]

         _snake_case   	=      tokens[tokens.find(__lowerCamelCase				) + len(__lowerCamelCase				) :].strip()
         if tokens[:6] == r"<sep/>":  # non-leaf nodes
           return [output] + self.tokenajson(tokens[6:]							,       is_inner_value=__lowerCamelCase							,       added_vocab=__lowerCamelCase				)

     if len(__lowerCamelCase				):
       return [output] if is_inner_value else output
     else:
       return [] if is_inner_value else {"text_sequence": tokens}



   @property
   def    __UpperCAmelCase    (       self    :	Union[str, Any]				):



     """simple docstring"""
     warnings.warn(
         '''`feature_extractor_class` is deprecated and will be removed in v5. Use `image_processor_class` instead.'''							,       __lowerCamelCase							,       )
     return self.image_processor_class





   @property
   def    __UpperCAmelCase    (       self    :	List[str]				):



     """simple docstring"""
     warnings.warn(
         '''`feature_extractor` is deprecated and will be removed in v5. Use `image_processor` instead.'''							,       __lowerCamelCase							,       )
     return self.image_processor










"""simple docstring"""






from itertools import product




def 			snake_case		(		lowerCAmelCase_  ,						lowerCAmelCase_	)						->				list[int]:
  _snake_case   	=      sides_number
  _snake_case   	=      max_face_number * dice_number
  _snake_case   	=      [0] * (max_total + 1)

  _snake_case   	=      1
  _snake_case   	=      range(lowerCAmelCase_  ,						max_face_number + 1	)
  for dice_numbers in product(lowerCAmelCase_  ,						repeat=lowerCAmelCase_	):
    _snake_case   	=      sum(lowerCAmelCase_	)
    totals_frequencies[total] += 1

  return totals_frequencies




def 			snake_case		(		)						->				float:
  _snake_case   	=      total_frequency_distribution(
      sides_number=4  ,						dice_number=9	)
  _snake_case   	=      total_frequency_distribution(
      sides_number=6  ,						dice_number=6	)

  _snake_case   	=      0
  _snake_case   	=      9
  _snake_case   	=      4 * 9
  _snake_case   	=      6
  for peter_total in range(lowerCAmelCase_  ,						max_peter_total + 1	):
    peter_wins_count += peter_totals_frequencies[peter_total] * sum(
        colin_totals_frequencies[min_colin_total:peter_total]	)

  _snake_case   	=      (4**9) * (6**6)
  _snake_case   	=      peter_wins_count / total_games_number

  _snake_case   	=      round(lowerCAmelCase_  ,						ndigits=7	)

  return rounded_peter_win_probability


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





