

"""simple docstring"""


from ...configuration_utils import PretrainedConfig
from ...utils import logging


a					:Any    = logging.get_logger(__name__)

a					:Optional[int]    = {
    "microsoft/trocr-base-handwritten": (
        "https://huggingface.co/microsoft/trocr-base-handwritten/resolve/main/config.json"
    ),
    # See all TrOCR models at https://huggingface.co/models?filter=trocr
}

class      __a							(_UpperCAmelCase):






     '''simple docstring'''
     _SCREAMING_SNAKE_CASE						:List[Any]       = """trocr"""
     _SCREAMING_SNAKE_CASE						:Dict       = ["""past_key_values"""]
     _SCREAMING_SNAKE_CASE						:Tuple       = {
         """num_attention_heads""": """decoder_attention_heads""",
         """hidden_size""": """d_model""",
         """num_hidden_layers""": """decoder_layers""",
     }

     def __init__(						self	,    _a=50_265	,    _a=1_024	,    _a=12	,    _a=16	,    _a=4_096	,    _a="gelu"	,    _a=512	,    _a=0.1	,    _a=0.0	,    _a=0.0	,    _a=2	,    _a=0.02	,    _a=0.0	,    _a=True	,    _a=False	,    _a=True	,    _a=True	,    _a=1	,    _a=0	,    _a=2	,    **_a	,    )  ->      Optional[int]:


           """simple docstring"""


           SCREAMING_SNAKE_CASE__   :      int      		=	vocab_size
           SCREAMING_SNAKE_CASE__   :      Tuple      		=	d_model
           SCREAMING_SNAKE_CASE__   :      List[str]      		=	decoder_layers
           SCREAMING_SNAKE_CASE__   :      Any      		=	decoder_attention_heads
           SCREAMING_SNAKE_CASE__   :      Any      		=	decoder_ffn_dim
           SCREAMING_SNAKE_CASE__   :      List[str]      		=	activation_function
           SCREAMING_SNAKE_CASE__   :      Optional[Any]      		=	max_position_embeddings
           SCREAMING_SNAKE_CASE__   :      Optional[int]      		=	dropout
           SCREAMING_SNAKE_CASE__   :      List[str]      		=	attention_dropout
           SCREAMING_SNAKE_CASE__   :      str      		=	activation_dropout
           SCREAMING_SNAKE_CASE__   :      Dict      		=	init_std
           SCREAMING_SNAKE_CASE__   :      Tuple      		=	decoder_layerdrop
           SCREAMING_SNAKE_CASE__   :      List[str]      		=	use_cache
           SCREAMING_SNAKE_CASE__   :      List[str]      		=	scale_embedding
           SCREAMING_SNAKE_CASE__   :      str      		=	use_learned_position_embeddings
           SCREAMING_SNAKE_CASE__   :      Tuple      		=	layernorm_embedding

           super().__init__(
               pad_token_id=lowerCamelCase_	,    bos_token_id=lowerCamelCase_	,    eos_token_id=lowerCamelCase_	,    decoder_start_token_id=lowerCamelCase_	,    **lowerCamelCase_	,    )







"""simple docstring"""


import re
from pathlib import Path
from unittest import TestCase

import pytest

@pytest.mark.integration
class      __a							(UpperCamelCase_):






     '''simple docstring'''

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


           """simple docstring"""


           with open(_a	,    encoding="""utf-8"""  ) as input_file:
                 SCREAMING_SNAKE_CASE__   :      str      		=	re.compile(r"""(?!.*\b(?:encoding|rb|w|wb|w+|wb+|ab|ab+)\b)(?<=\s)(open)\((.*)\)"""  )
                 SCREAMING_SNAKE_CASE__   :      Optional[Any]      		=	input_file.read()
                 SCREAMING_SNAKE_CASE__   :      str      		=	regexp.search(_a  )

           return match

     def 					_a			(						self	,    _a  )  ->      Optional[Any]:


           """simple docstring"""


           with open(_a	,    encoding="""utf-8"""  ) as input_file:
                 SCREAMING_SNAKE_CASE__   :      Tuple      		=	re.compile(r"""#[^\r\n]*print\(|\"[^\r\n]*print\(|\"\"\".*?print\(.*?\"\"\"|(print\()"""	,    re.DOTALL  )
                 SCREAMING_SNAKE_CASE__   :      List[Any]      		=	input_file.read()
                 # use `re.finditer` to handle the case where the ignored groups would be matched first by `re.search`
                 SCREAMING_SNAKE_CASE__   :      Dict      		=	regexp.finditer(_a  )

           SCREAMING_SNAKE_CASE__   :      int      		=	[match for match in matches if match is not None and match.group(1  ) is not None]
           return matches[0] if matches else None

     def 					_a			(						self  )  ->      str:


           """simple docstring"""


           SCREAMING_SNAKE_CASE__   :      Optional[int]      		=	Path("""./datasets"""  )
           SCREAMING_SNAKE_CASE__   :      Union[str, Any]      		=	list(dataset_paths.absolute().glob("""**/*.py"""  )  )

           for dataset in dataset_files:
                 if self._no_encoding_on_file_open(str(_a  )  ):
                       raise AssertionError(f'''open(...) must use utf-8 encoding in {dataset}'''  )





     def 					_a			(						self  )  ->      Dict:


           """simple docstring"""


           SCREAMING_SNAKE_CASE__   :      Union[str, Any]      		=	Path("""./datasets"""  )
           SCREAMING_SNAKE_CASE__   :      List[str]      		=	list(dataset_paths.absolute().glob("""**/*.py"""  )  )

           for dataset in dataset_files:
                 if self._no_print_statements(str(_a  )  ):
                       raise AssertionError(f'''print statement found in {dataset}. Use datasets.logger/logging instead.'''  )




