





'''simple docstring'''

import doctest
import logging
import os
import unittest
from pathlib import Path
from typing import List, Union

import transformers
from transformers.testing_utils import require_tf, require_torch, slow


lowercase__		:     List[str]			=							logging.getLogger()
@unittest.skip('Temporarily disable the doc tests.'					)
@require_torch
@require_tf
@slow
class 							__lowerCAmelCase	(       unittest.TestCase					):






       """simple docstring"""





       def snake_case__		(				self  :						int			,					lowerCAmelCase__  :						Path			,					lowerCAmelCase__  :						Union[str, None] = None			,					lowerCAmelCase__  :						Union[List[str], None] = None			,					lowerCAmelCase__  :						Union[str, List[str], None] = None			,					lowerCAmelCase__  :						bool = True			,					)       ->	Dict:

            '''simple docstring'''




            _UpperCamelCase							       =			[file for file in os.listdir(lowerCAmelCase__	) if os.path.isfile(os.path.join(lowerCAmelCase__			,					lowerCAmelCase__	)	)]

            if identifier is not None:
                 _UpperCamelCase							       =			[file for file in files if identifier in file]

            if n_identifier is not None:
                 if isinstance(lowerCAmelCase__			,					lowerCAmelCase__	):
                      for n_ in n_identifier:
                           _UpperCamelCase							       =			[file for file in files if n_ not in file]
                 else:
                      _UpperCamelCase							       =			[file for file in files if n_identifier not in file]

            _UpperCamelCase							       =			ignore_files or []
            ignore_files.append('''__init__.py'''	)
            _UpperCamelCase							       =			[file for file in files if file not in ignore_files]

            for file in files:
                 # Open all files
                 print('''Testing'''			,					lowerCAmelCase__	)

                 if only_modules:
                      _UpperCamelCase							       =			file.split('''.'''	)[0]
                      try:
                           _UpperCamelCase							       =			getattr(lowerCAmelCase__			,					lowerCAmelCase__	)
                           _UpperCamelCase							       =			doctest.DocTestSuite(lowerCAmelCase__	)
                           _UpperCamelCase							       =			unittest.TextTestRunner().run(lowerCAmelCase__	)
                           self.assertIs(len(result.failures	)			,					0	)
                      except AttributeError:
                           logger.info(f"""{module_identifier} is not a module."""	)
                 else:
                      _UpperCamelCase							       =			doctest.testfile(str('''..''' / directory / file	)			,					optionflags=doctest.ELLIPSIS	)
                      self.assertIs(result.failed			,					0	)





       def snake_case__		(				self  :						Any	)       ->	Optional[Any]:

            '''simple docstring'''




            _UpperCamelCase							       =			Path('''src/transformers'''	)
            _UpperCamelCase							       =			'''modeling'''
            _UpperCamelCase							       =			[
                '''modeling_ctrl.py''',
                '''modeling_tf_ctrl.py''',
            ]
            self.analyze_directory(lowerCAmelCase__			,					identifier=lowerCAmelCase__			,					ignore_files=lowerCAmelCase__	)





       def snake_case__		(				self  :						Optional[Any]	)       ->	Any:

            '''simple docstring'''




            _UpperCamelCase							       =			Path('''src/transformers'''	)
            _UpperCamelCase							       =			'''tokenization'''
            self.analyze_directory(lowerCAmelCase__			,					identifier=lowerCAmelCase__	)





       def snake_case__		(				self  :						List[str]	)       ->	Tuple:

            '''simple docstring'''




            _UpperCamelCase							       =			Path('''src/transformers'''	)
            _UpperCamelCase							       =			'''configuration'''
            self.analyze_directory(lowerCAmelCase__			,					identifier=lowerCAmelCase__	)





       def snake_case__		(				self  :						str	)       ->	int:

            '''simple docstring'''




            _UpperCamelCase							       =			Path('''src/transformers'''	)
            _UpperCamelCase							       =			['''configuration''', '''modeling''', '''tokenization''']
            self.analyze_directory(lowerCAmelCase__			,					n_identifier=lowerCAmelCase__	)







       def snake_case__		(				self  :						str	)       ->	Any:

            '''simple docstring'''




            _UpperCamelCase							       =			Path('''docs/source'''	)
            _UpperCamelCase							       =			['''favicon.ico''']
            self.analyze_directory(lowerCAmelCase__			,					ignore_files=lowerCAmelCase__			,					only_modules=lowerCAmelCase__	)










from typing import Callable, Optional

from .. import Features
from ..packaged_modules.generator.generator import Generator
from .abc import AbstractDatasetInputStream





class 				a			(      __lowercase			):






				def __init__(  self			, _lowerCAmelCase			, _lowerCAmelCase = None			, _lowerCAmelCase = None			, _lowerCAmelCase = False			, _lowerCAmelCase = False			, _lowerCAmelCase = None			, _lowerCAmelCase = None			, **_lowerCAmelCase			, ):

										"""simple docstring"""




										super().__init__(
										    features=_lowerCAmelCase			, cache_dir=_lowerCAmelCase			, keep_in_memory=_lowerCAmelCase			, streaming=_lowerCAmelCase			, num_proc=_lowerCAmelCase			, **_lowerCAmelCase			, )
										__SCREAMING_SNAKE_CASE:				Any           =   Generator(
										    cache_dir=_lowerCAmelCase			, features=_lowerCAmelCase			, generator=_lowerCAmelCase			, gen_kwargs=_lowerCAmelCase			, **_lowerCAmelCase			, )






				def 			snake_case_    (  self					):

										"""simple docstring"""




										if self.streaming:
																__SCREAMING_SNAKE_CASE:				List[str]           =   self.builder.as_streaming_dataset(split='''train'''					)
										# Build regular (map-style) dataset
										else:
																__SCREAMING_SNAKE_CASE:				str           =   None
																__SCREAMING_SNAKE_CASE:				List[Any]           =   None
																__SCREAMING_SNAKE_CASE:				Tuple           =   None
																__SCREAMING_SNAKE_CASE:				Optional[Any]           =   None

																self.builder.download_and_prepare(
																    download_config=_lowerCAmelCase			, download_mode=_lowerCAmelCase			, verification_mode=_lowerCAmelCase			, base_path=_lowerCAmelCase			, num_proc=self.num_proc			, )
																__SCREAMING_SNAKE_CASE:				List[str]           =   self.builder.as_dataset(
																    split='''train'''			, verification_mode=_lowerCAmelCase			, in_memory=self.keep_in_memory					)
										return dataset



