
"""simple docstring"""
from typing import List

from .keymap import KEYMAP, get_character

def  lowercase     (_lowerCAmelCase						):

						def decorator(_lowerCAmelCase						):
												__lowerCAmelCase     =  getattr(_lowerCAmelCase ,    """handle_key""" ,    []						)
												handle += [key]
												setattr(_lowerCAmelCase ,    """handle_key""" ,    _lowerCAmelCase						)
												return func

						return decorator

def  lowercase     (*_lowerCAmelCase						):

						def decorator(_lowerCAmelCase						):
												__lowerCAmelCase     =  getattr(_lowerCAmelCase ,    """handle_key""" ,    []						)
												handle += keys
												setattr(_lowerCAmelCase ,    """handle_key""" ,    _lowerCAmelCase						)
												return func

						return decorator
class       lowerCAmelCase_		(				A__ ):



							'''simple docstring'''





							def __new__( cls    ,				snake_case_    ,				snake_case_    ,				snake_case_				)       ->  Any:
													__lowerCAmelCase     =  super().__new__(cls    ,				snake_case_    ,				snake_case_    ,				snake_case_				)
													if not hasattr(snake_case_    ,				"""key_handler"""				):
																			setattr(snake_case_    ,				"""key_handler"""    ,				{}				)
													setattr(snake_case_    ,				"""handle_input"""    ,				KeyHandler.handle_input				)

													for value in attrs.values():
																			__lowerCAmelCase     =  getattr(snake_case_    ,				"""handle_key"""    ,				[]				)
																			for key in handled_keys:
																									__lowerCAmelCase     =  value
													return new_cls




							@staticmethod
							def    A__						( cls				)       ->  Tuple:
													__lowerCAmelCase     =  get_character()
													if char != KEYMAP["undefined"]:
																			__lowerCAmelCase     =  ord(snake_case_				)
													__lowerCAmelCase     =  cls.key_handler.get(snake_case_				)
													if handler:
																			__lowerCAmelCase     =  char
																			return handler(cls				)
													else:
																			return None

def  lowercase     (cls						):
						return KeyHandler(cls.__name__ ,    cls.__bases__ ,    cls.__dict__.copy()						)


"""simple docstring"""
from ...configuration_utils import PretrainedConfig
from ...utils import logging


SCREAMING_SNAKE_CASE_					     =	logging.get_logger(__name__)

SCREAMING_SNAKE_CASE_					     =	{
    '''alibaba-damo/mgp-str-base''': '''https://huggingface.co/alibaba-damo/mgp-str-base/resolve/main/config.json''',
}
class       lowerCAmelCase_		(				A__ ):



							'''simple docstring'''





							_snake_case						      =		'''mgp-str'''




							def __init__( self    ,				snake_case_=[32, 128]    ,				snake_case_=4    ,				snake_case_=3    ,				snake_case_=27    ,				snake_case_=38    ,				snake_case_=50_257    ,				snake_case_=30_522    ,				snake_case_=768    ,				snake_case_=12    ,				snake_case_=12    ,				snake_case_=4.0    ,				snake_case_=True    ,				snake_case_=False    ,				snake_case_=1e-5    ,				snake_case_=0.0    ,				snake_case_=0.0    ,				snake_case_=0.0    ,				snake_case_=False    ,				snake_case_=0.02    ,				**snake_case_    ,				)       ->  List[Any]:
													super().__init__(**snake_case_				)

													__lowerCAmelCase     =  image_size
													__lowerCAmelCase     =  patch_size
													__lowerCAmelCase     =  num_channels
													__lowerCAmelCase     =  max_token_length
													__lowerCAmelCase     =  num_character_labels
													__lowerCAmelCase     =  num_bpe_labels
													__lowerCAmelCase     =  num_wordpiece_labels
													__lowerCAmelCase     =  hidden_size
													__lowerCAmelCase     =  num_hidden_layers
													__lowerCAmelCase     =  num_attention_heads
													__lowerCAmelCase     =  mlp_ratio
													__lowerCAmelCase     =  distilled
													__lowerCAmelCase     =  layer_norm_eps
													__lowerCAmelCase     =  drop_rate
													__lowerCAmelCase     =  qkv_bias
													__lowerCAmelCase     =  attn_drop_rate
													__lowerCAmelCase     =  drop_path_rate
													__lowerCAmelCase     =  output_aa_attentions
													__lowerCAmelCase     =  initializer_range
