


import json
import os
import pickle
import subprocess
from hashlib import mda
from pathlib import Path
from tempfile import gettempdir
from textwrap import dedent
from types import CodeType, FunctionType
from unittest import TestCase
from unittest.mock import patch

import pytest
from multiprocess import Pool
from packaging import version

import datasets
from datasets.fingerprint import Hasher, fingerprint_transform
from datasets.table import InMemoryTable

from .utils import (
    require_regex,
    require_spacy,
    require_spacy_model,
    require_tiktoken,
    require_torch,
    require_transformers,
)



class  UpperCAmelCase_						:
       '''simple docstring'''






       def __init__(  self			,       __SCREAMING_SNAKE_CASE    ):




              """simple docstring"""




              UpperCamelCase     :						Optional[int] 						=		foo






       def __call__(  self    ):




              """simple docstring"""




              return self.foo




class  UpperCAmelCase_						(				datasets.Dataset):
       '''simple docstring'''






       @fingerprint_transform(inplace=__SCREAMING_SNAKE_CASE    )
       def 			_lowercase (  self			,       __SCREAMING_SNAKE_CASE			,       *__SCREAMING_SNAKE_CASE			,       **__SCREAMING_SNAKE_CASE    ):




              """simple docstring"""




              return DatasetChild(self.data			,       fingerprint=__SCREAMING_SNAKE_CASE    )






       @fingerprint_transform(inplace=__SCREAMING_SNAKE_CASE    )
       def 			_lowercase (  self			,       __SCREAMING_SNAKE_CASE			,       *__SCREAMING_SNAKE_CASE			,       **__SCREAMING_SNAKE_CASE    ):




              """simple docstring"""




              return DatasetChild(self.data			,       fingerprint=__SCREAMING_SNAKE_CASE    )




class  UpperCAmelCase_						:
       '''simple docstring'''






       def __init__(  self			,       __SCREAMING_SNAKE_CASE    ):




              """simple docstring"""




              UpperCamelCase     :						List[Any] 						=		callable






       def __call__(  self			,       *__SCREAMING_SNAKE_CASE			,       **__SCREAMING_SNAKE_CASE    ):




              """simple docstring"""




              if self.callable is not None:
                     return self.callable(*__SCREAMING_SNAKE_CASE			,       **__SCREAMING_SNAKE_CASE    )






       def __getstate__(  self    ):




              """simple docstring"""




              raise pickle.PicklingError()




class  UpperCAmelCase_						(				_a):
       '''simple docstring'''






       @require_transformers
       @pytest.mark.integration
       def 			_lowercase (  self    ):




              """simple docstring"""




              from transformers import AutoTokenizer

              def encode(__SCREAMING_SNAKE_CASE    ):
                     return tokenizer(__SCREAMING_SNAKE_CASE    )

              # TODO: add hash consistency tests across sessions
              UpperCamelCase     :						Optional[int] 						=		AutoTokenizer.from_pretrained('''bert-base-uncased'''    )
              UpperCamelCase     :						Tuple 						=		mda(datasets.utils.py_utils.dumps(__SCREAMING_SNAKE_CASE    )    ).hexdigest()
              UpperCamelCase     :						str 						=		mda(datasets.utils.py_utils.dumps(lambda __SCREAMING_SNAKE_CASE    : tokenizer(__SCREAMING_SNAKE_CASE    )    )    ).hexdigest()
              UpperCamelCase     :						Any 						=		mda(datasets.utils.py_utils.dumps(__SCREAMING_SNAKE_CASE    )    ).hexdigest()
              UpperCamelCase     :						int 						=		AutoTokenizer.from_pretrained('''bert-base-cased'''    )
              UpperCamelCase     :						str 						=		mda(datasets.utils.py_utils.dumps(__SCREAMING_SNAKE_CASE    )    ).hexdigest()
              UpperCamelCase     :						int 						=		mda(datasets.utils.py_utils.dumps(lambda __SCREAMING_SNAKE_CASE    : tokenizer(__SCREAMING_SNAKE_CASE    )    )    ).hexdigest()
              UpperCamelCase     :						str 						=		mda(datasets.utils.py_utils.dumps(__SCREAMING_SNAKE_CASE    )    ).hexdigest()
              UpperCamelCase     :						List[Any] 						=		AutoTokenizer.from_pretrained('''bert-base-uncased'''    )
              UpperCamelCase     :						List[Any] 						=		mda(datasets.utils.py_utils.dumps(__SCREAMING_SNAKE_CASE    )    ).hexdigest()
              UpperCamelCase     :						Dict 						=		mda(datasets.utils.py_utils.dumps(lambda __SCREAMING_SNAKE_CASE    : tokenizer(__SCREAMING_SNAKE_CASE    )    )    ).hexdigest()
              UpperCamelCase     :						List[Any] 						=		mda(datasets.utils.py_utils.dumps(__SCREAMING_SNAKE_CASE    )    ).hexdigest()
              self.assertEqual(__SCREAMING_SNAKE_CASE			,       __SCREAMING_SNAKE_CASE    )
              self.assertNotEqual(__SCREAMING_SNAKE_CASE			,       __SCREAMING_SNAKE_CASE    )
              self.assertEqual(__SCREAMING_SNAKE_CASE			,       __SCREAMING_SNAKE_CASE    )
              self.assertNotEqual(__SCREAMING_SNAKE_CASE			,       __SCREAMING_SNAKE_CASE    )
              self.assertEqual(__SCREAMING_SNAKE_CASE			,       __SCREAMING_SNAKE_CASE    )
              self.assertNotEqual(__SCREAMING_SNAKE_CASE			,       __SCREAMING_SNAKE_CASE    )






       @require_transformers
       @pytest.mark.integration
       def 			_lowercase (  self    ):




              """simple docstring"""




              from transformers import AutoTokenizer

              UpperCamelCase     :						int 						=		AutoTokenizer.from_pretrained('''gpt2'''    )
              UpperCamelCase     :						Optional[Any] 						=		mda(datasets.utils.py_utils.dumps(__SCREAMING_SNAKE_CASE    )    ).hexdigest()
              tokenizer('''Hello world !'''    )  # call once to change the tokenizer's cache
              UpperCamelCase     :						Tuple 						=		mda(datasets.utils.py_utils.dumps(__SCREAMING_SNAKE_CASE    )    ).hexdigest()
              self.assertEqual(__SCREAMING_SNAKE_CASE			,       __SCREAMING_SNAKE_CASE    )






       @require_regex
       def 			_lowercase (  self    ):




              """simple docstring"""




              import regex

              UpperCamelCase     :						int 						=		regex.Regex('''foo'''    )
              UpperCamelCase     :						List[Any] 						=		mda(datasets.utils.py_utils.dumps(__SCREAMING_SNAKE_CASE    )    ).hexdigest()
              UpperCamelCase     :						Optional[int] 						=		regex.Regex('''bar'''    )
              UpperCamelCase     :						List[Any] 						=		mda(datasets.utils.py_utils.dumps(__SCREAMING_SNAKE_CASE    )    ).hexdigest()
              UpperCamelCase     :						Union[str, Any] 						=		regex.Regex('''foo'''    )
              UpperCamelCase     :						Optional[Any] 						=		mda(datasets.utils.py_utils.dumps(__SCREAMING_SNAKE_CASE    )    ).hexdigest()
              self.assertEqual(__SCREAMING_SNAKE_CASE			,       __SCREAMING_SNAKE_CASE    )
              self.assertNotEqual(__SCREAMING_SNAKE_CASE			,       __SCREAMING_SNAKE_CASE    )




class  UpperCAmelCase_						(				_a):
       '''simple docstring'''






       def 			_lowercase (  self    ):




              """simple docstring"""




              def func():
                     return foo

              UpperCamelCase     :						int 						=		[0]
              UpperCamelCase     :						Optional[Any] 						=		mda(datasets.utils.py_utils.dumps(__SCREAMING_SNAKE_CASE    )    ).hexdigest()
              UpperCamelCase     :						List[Any] 						=		[1]
              UpperCamelCase     :						Dict 						=		mda(datasets.utils.py_utils.dumps(__SCREAMING_SNAKE_CASE    )    ).hexdigest()
              UpperCamelCase     :						Optional[Any] 						=		[0]
              UpperCamelCase     :						Tuple 						=		mda(datasets.utils.py_utils.dumps(__SCREAMING_SNAKE_CASE    )    ).hexdigest()
              self.assertEqual(__SCREAMING_SNAKE_CASE			,       __SCREAMING_SNAKE_CASE    )
              self.assertNotEqual(__SCREAMING_SNAKE_CASE			,       __SCREAMING_SNAKE_CASE    )






       def 			_lowercase (  self    ):




              """simple docstring"""




              def func():
                     pass

              UpperCamelCase     :						int 						=		mda(datasets.utils.py_utils.dumps(__SCREAMING_SNAKE_CASE    )    ).hexdigest()

              def func():
                     pass

              UpperCamelCase     :						List[str] 						=		mda(datasets.utils.py_utils.dumps(__SCREAMING_SNAKE_CASE    )    ).hexdigest()
              self.assertEqual(__SCREAMING_SNAKE_CASE			,       __SCREAMING_SNAKE_CASE    )






       def 			_lowercase (  self    ):




              """simple docstring"""




              UpperCamelCase     :						Tuple 						=		mda(datasets.utils.py_utils.dumps(Foo([0]    )    )    ).hexdigest()
              UpperCamelCase     :						Optional[int] 						=		mda(datasets.utils.py_utils.dumps(Foo([1]    )    )    ).hexdigest()
              UpperCamelCase     :						List[str] 						=		mda(datasets.utils.py_utils.dumps(Foo([0]    )    )    ).hexdigest()
              self.assertEqual(__SCREAMING_SNAKE_CASE			,       __SCREAMING_SNAKE_CASE    )
              self.assertNotEqual(__SCREAMING_SNAKE_CASE			,       __SCREAMING_SNAKE_CASE    )






       def 			_lowercase (  self    ):




              """simple docstring"""




              UpperCamelCase     :						Dict 						=		mda(datasets.utils.py_utils.dumps(Foo([0]    ).__call__    )    ).hexdigest()
              UpperCamelCase     :						Any 						=		mda(datasets.utils.py_utils.dumps(Foo([1]    ).__call__    )    ).hexdigest()
              UpperCamelCase     :						str 						=		mda(datasets.utils.py_utils.dumps(Foo([0]    ).__call__    )    ).hexdigest()
              self.assertEqual(__SCREAMING_SNAKE_CASE			,       __SCREAMING_SNAKE_CASE    )
              self.assertNotEqual(__SCREAMING_SNAKE_CASE			,       __SCREAMING_SNAKE_CASE    )






       def 			_lowercase (  self    ):




              """simple docstring"""




              UpperCamelCase     :						Tuple 						=		(
                  '''co_argcount''',
                  '''co_kwonlyargcount''',
                  '''co_nlocals''',
                  '''co_stacksize''',
                  '''co_flags''',
                  '''co_code''',
                  '''co_consts''',
                  '''co_names''',
                  '''co_varnames''',
                  '''co_filename''',
                  '''co_name''',
                  '''co_firstlineno''',
                  '''co_lnotab''',
                  '''co_freevars''',
                  '''co_cellvars''',
              )

              def _create_code_pyaa(*__SCREAMING_SNAKE_CASE    ):
                     if hasattr(args[-3]			,       '''encode'''    ):
                            UpperCamelCase     :						Union[str, Any] 						=		list(__SCREAMING_SNAKE_CASE    )
                            UpperCamelCase     :						List[str] 						=		args[-3].encode()  # co_lnotab
                            UpperCamelCase     :						Union[str, Any] 						=		args[-10].encode()  # co_code
                     if hasattr(__SCREAMING_SNAKE_CASE			,       '''co_posonlyargcount'''    ):
                            if len(__SCREAMING_SNAKE_CASE    ) == 16:
                                   return CodeType(*__SCREAMING_SNAKE_CASE    )
                            elif len(__SCREAMING_SNAKE_CASE    ) == 15:
                                   return CodeType(args[0]			,       0			,       *args[1:]    )
                            return CodeType(args[0]			,       0			,       0			,       *args[1:]    )
                     elif hasattr(__SCREAMING_SNAKE_CASE			,       '''co_kwonlyargcount'''    ):
                            if len(__SCREAMING_SNAKE_CASE    ) == 16:
                                   return CodeType(args[0]			,       *args[2:]    )
                            elif len(__SCREAMING_SNAKE_CASE    ) == 15:
                                   return CodeType(*__SCREAMING_SNAKE_CASE    )
                            return CodeType(args[0]			,       0			,       *args[1:]    )
                     if len(__SCREAMING_SNAKE_CASE    ) == 16:
                            return CodeType(args[0]			,       *args[3:]    )
                     elif len(__SCREAMING_SNAKE_CASE    ) == 15:
                            return CodeType(args[0]			,       *args[2:]    )
                     return CodeType(*__SCREAMING_SNAKE_CASE    )

              def create_ipython_func(__SCREAMING_SNAKE_CASE			,       __SCREAMING_SNAKE_CASE    ):
                     def func():
                            return returned_obj

                     UpperCamelCase     :						Any 						=		func.__code__
                     # Use _create_code from dill in order to make it work for different python versions
                     if datasets.config.PY_VERSION < version.parse('''3.8'''    ):
                            UpperCamelCase     :						List[Any] 						=		_create_code_pyaa(
                                *[getattr(__SCREAMING_SNAKE_CASE			,       __SCREAMING_SNAKE_CASE    ) if k != '''co_filename''' else co_filename for k in code_args_pyaa]    )
                     else:
                            UpperCamelCase     :						Any 						=		code.replace(co_filename=__SCREAMING_SNAKE_CASE    )
                     return FunctionType(__SCREAMING_SNAKE_CASE			,       func.__globals__			,       func.__name__			,       func.__defaults__			,       func.__closure__    )

              UpperCamelCase						,			UpperCamelCase     :						List[str] 						=		'''<ipython-input-2-e0383a102aae>''', [0]
              UpperCamelCase     :						Dict 						=		mda(datasets.utils.py_utils.dumps(create_ipython_func(__SCREAMING_SNAKE_CASE			,       __SCREAMING_SNAKE_CASE    )    )    ).hexdigest()
              UpperCamelCase						,			UpperCamelCase     :						Tuple 						=		'''<ipython-input-2-e0383a102aae>''', [1]
              UpperCamelCase     :						Dict 						=		mda(datasets.utils.py_utils.dumps(create_ipython_func(__SCREAMING_SNAKE_CASE			,       __SCREAMING_SNAKE_CASE    )    )    ).hexdigest()
              UpperCamelCase						,			UpperCamelCase     :						Union[str, Any] 						=		'''<ipython-input-5-713f6613acf3>''', [0]
              UpperCamelCase     :						List[str] 						=		mda(datasets.utils.py_utils.dumps(create_ipython_func(__SCREAMING_SNAKE_CASE			,       __SCREAMING_SNAKE_CASE    )    )    ).hexdigest()
              self.assertEqual(__SCREAMING_SNAKE_CASE			,       __SCREAMING_SNAKE_CASE    )
              self.assertNotEqual(__SCREAMING_SNAKE_CASE			,       __SCREAMING_SNAKE_CASE    )

              UpperCamelCase						,			UpperCamelCase     :						Tuple 						=		os.path.join(gettempdir()			,       '''ipykernel_12345'''			,       '''321456789.py'''    ), [0]
              UpperCamelCase     :						Tuple 						=		mda(datasets.utils.py_utils.dumps(create_ipython_func(__SCREAMING_SNAKE_CASE			,       __SCREAMING_SNAKE_CASE    )    )    ).hexdigest()
              UpperCamelCase						,			UpperCamelCase     :						Dict 						=		os.path.join(gettempdir()			,       '''ipykernel_12345'''			,       '''321456789.py'''    ), [1]
              UpperCamelCase     :						Dict 						=		mda(datasets.utils.py_utils.dumps(create_ipython_func(__SCREAMING_SNAKE_CASE			,       __SCREAMING_SNAKE_CASE    )    )    ).hexdigest()
              UpperCamelCase						,			UpperCamelCase     :						Union[str, Any] 						=		os.path.join(gettempdir()			,       '''ipykernel_12345'''			,       '''654123987.py'''    ), [0]
              UpperCamelCase     :						List[str] 						=		mda(datasets.utils.py_utils.dumps(create_ipython_func(__SCREAMING_SNAKE_CASE			,       __SCREAMING_SNAKE_CASE    )    )    ).hexdigest()
              self.assertEqual(__SCREAMING_SNAKE_CASE			,       __SCREAMING_SNAKE_CASE    )
              self.assertNotEqual(__SCREAMING_SNAKE_CASE			,       __SCREAMING_SNAKE_CASE    )






       def 			_lowercase (  self    ):




              """simple docstring"""




              UpperCamelCase						,			UpperCamelCase     :						List[Any] 						=		[0], [1]

              def func():
                     return foo, bar

              UpperCamelCase     :						Optional[Any] 						=		'''__main__'''

              def globalvars_mocka_side_effect(__SCREAMING_SNAKE_CASE			,       *__SCREAMING_SNAKE_CASE			,       **__SCREAMING_SNAKE_CASE    ):
                     return {"foo": foo, "bar": bar}

              def globalvars_mocka_side_effect(__SCREAMING_SNAKE_CASE			,       *__SCREAMING_SNAKE_CASE			,       **__SCREAMING_SNAKE_CASE    ):
                     return {"bar": bar, "foo": foo}

              with patch('''dill.detect.globalvars'''			,       side_effect=__SCREAMING_SNAKE_CASE    ) as globalvars_mocka:
                     UpperCamelCase     :						List[str] 						=		mda(datasets.utils.py_utils.dumps(__SCREAMING_SNAKE_CASE    )    ).hexdigest()
                     self.assertGreater(globalvars_mocka.call_count			,       0    )
              with patch('''dill.detect.globalvars'''			,       side_effect=__SCREAMING_SNAKE_CASE    ) as globalvars_mocka:
                     UpperCamelCase     :						Any 						=		mda(datasets.utils.py_utils.dumps(__SCREAMING_SNAKE_CASE    )    ).hexdigest()
                     self.assertGreater(globalvars_mocka.call_count			,       0    )
              self.assertEqual(__SCREAMING_SNAKE_CASE			,       __SCREAMING_SNAKE_CASE    )




class  UpperCAmelCase_						(				_a):
       '''simple docstring'''






       def 			_lowercase (  self    ):




              """simple docstring"""




              UpperCamelCase     :						List[str] 						=		Hasher.hash('''hello'''    )
              UpperCamelCase     :						Tuple 						=		Hasher.hash('''hello'''    )
              UpperCamelCase     :						Optional[int] 						=		Hasher.hash('''there'''    )
              self.assertEqual(__SCREAMING_SNAKE_CASE			,       __SCREAMING_SNAKE_CASE    )
              self.assertNotEqual(__SCREAMING_SNAKE_CASE			,       __SCREAMING_SNAKE_CASE    )






       def 			_lowercase (  self    ):




              """simple docstring"""




              UpperCamelCase     :						Dict 						=		Hasher.hash(Foo('''hello'''    )    )
              UpperCamelCase     :						List[str] 						=		Hasher.hash(Foo('''hello'''    )    )
              UpperCamelCase     :						Dict 						=		Hasher.hash(Foo('''there'''    )    )
              self.assertEqual(__SCREAMING_SNAKE_CASE			,       __SCREAMING_SNAKE_CASE    )
              self.assertNotEqual(__SCREAMING_SNAKE_CASE			,       __SCREAMING_SNAKE_CASE    )






       def 			_lowercase (  self    ):




              """simple docstring"""




              UpperCamelCase     :						List[str] 						=		Hasher()
              for x in ["hello", Foo('''hello'''    )]:
                     hasher.update(__SCREAMING_SNAKE_CASE    )
              UpperCamelCase     :						Optional[int] 						=		hasher.hexdigest()
              UpperCamelCase     :						Optional[Any] 						=		Hasher()
              for x in ["hello", Foo('''hello'''    )]:
                     hasher.update(__SCREAMING_SNAKE_CASE    )
              UpperCamelCase     :						List[Any] 						=		hasher.hexdigest()
              UpperCamelCase     :						List[Any] 						=		Hasher()
              for x in ["there", Foo('''there'''    )]:
                     hasher.update(__SCREAMING_SNAKE_CASE    )
              UpperCamelCase     :						Dict 						=		hasher.hexdigest()
              self.assertEqual(__SCREAMING_SNAKE_CASE			,       __SCREAMING_SNAKE_CASE    )
              self.assertNotEqual(__SCREAMING_SNAKE_CASE			,       __SCREAMING_SNAKE_CASE    )






       def 			_lowercase (  self    ):




              """simple docstring"""




              with self.assertRaises(pickle.PicklingError    ):
                     Hasher.hash(UnpicklableCallable(Foo('''hello'''    )    )    )






       def 			_lowercase (  self    ):




              """simple docstring"""




              UpperCamelCase     :						Dict 						=		'''abc'''
              UpperCamelCase     :						Union[str, Any] 						=		[string, string]  # two strings have the same ids
              UpperCamelCase     :						Dict 						=		[string, string]
              UpperCamelCase     :						Union[str, Any] 						=		json.loads(f"""[\"{string}\", \"{string}\"]"""    )  # two strings have different ids
              self.assertIs(obja[0]			,       __SCREAMING_SNAKE_CASE    )
              self.assertIs(obja[0]			,       obja[1]    )
              self.assertIs(obja[0]			,       __SCREAMING_SNAKE_CASE    )
              self.assertIs(obja[0]			,       obja[1]    )
              self.assertIsNot(obja[0]			,       __SCREAMING_SNAKE_CASE    )
              self.assertIsNot(obja[0]			,       obja[1]    )
              UpperCamelCase     :						Optional[Any] 						=		Hasher.hash(__SCREAMING_SNAKE_CASE    )
              UpperCamelCase     :						Tuple 						=		Hasher.hash(__SCREAMING_SNAKE_CASE    )
              UpperCamelCase     :						Optional[int] 						=		Hasher.hash(__SCREAMING_SNAKE_CASE    )
              self.assertEqual(__SCREAMING_SNAKE_CASE			,       __SCREAMING_SNAKE_CASE    )
              self.assertEqual(__SCREAMING_SNAKE_CASE			,       __SCREAMING_SNAKE_CASE    )






       @require_tiktoken
       def 			_lowercase (  self    ):




              """simple docstring"""




              import tiktoken

              UpperCamelCase     :						List[Any] 						=		tiktoken.get_encoding('''gpt2'''    )
              UpperCamelCase     :						Optional[int] 						=		mda(datasets.utils.py_utils.dumps(__SCREAMING_SNAKE_CASE    )    ).hexdigest()
              UpperCamelCase     :						Any 						=		tiktoken.get_encoding('''r50k_base'''    )
              UpperCamelCase     :						List[Any] 						=		mda(datasets.utils.py_utils.dumps(__SCREAMING_SNAKE_CASE    )    ).hexdigest()
              UpperCamelCase     :						Union[str, Any] 						=		tiktoken.get_encoding('''gpt2'''    )
              UpperCamelCase     :						Optional[int] 						=		mda(datasets.utils.py_utils.dumps(__SCREAMING_SNAKE_CASE    )    ).hexdigest()
              self.assertEqual(__SCREAMING_SNAKE_CASE			,       __SCREAMING_SNAKE_CASE    )
              self.assertNotEqual(__SCREAMING_SNAKE_CASE			,       __SCREAMING_SNAKE_CASE    )






       @require_torch
       def 			_lowercase (  self    ):




              """simple docstring"""




              import torch

              UpperCamelCase     :						Union[str, Any] 						=		torch.tensor([1.0]    )
              UpperCamelCase     :						int 						=		mda(datasets.utils.py_utils.dumps(__SCREAMING_SNAKE_CASE    )    ).hexdigest()
              UpperCamelCase     :						Optional[Any] 						=		torch.tensor([2.0]    )
              UpperCamelCase     :						Dict 						=		mda(datasets.utils.py_utils.dumps(__SCREAMING_SNAKE_CASE    )    ).hexdigest()
              UpperCamelCase     :						str 						=		torch.tensor([1.0]    )
              UpperCamelCase     :						int 						=		mda(datasets.utils.py_utils.dumps(__SCREAMING_SNAKE_CASE    )    ).hexdigest()
              self.assertEqual(__SCREAMING_SNAKE_CASE			,       __SCREAMING_SNAKE_CASE    )
              self.assertNotEqual(__SCREAMING_SNAKE_CASE			,       __SCREAMING_SNAKE_CASE    )






       @require_spacy
       @require_spacy_model('''en_core_web_sm'''    )
       @require_spacy_model('''fr_core_news_sm'''    )
       @pytest.mark.integration
       def 			_lowercase (  self    ):




              """simple docstring"""




              import spacy

              UpperCamelCase     :						Tuple 						=		spacy.load('''en_core_web_sm'''    )
              UpperCamelCase     :						List[str] 						=		mda(datasets.utils.py_utils.dumps(__SCREAMING_SNAKE_CASE    )    ).hexdigest()
              UpperCamelCase     :						Optional[int] 						=		spacy.load('''fr_core_news_sm'''    )
              UpperCamelCase     :						Optional[Any] 						=		mda(datasets.utils.py_utils.dumps(__SCREAMING_SNAKE_CASE    )    ).hexdigest()
              UpperCamelCase     :						List[Any] 						=		spacy.load('''en_core_web_sm'''    )
              UpperCamelCase     :						Tuple 						=		mda(datasets.utils.py_utils.dumps(__SCREAMING_SNAKE_CASE    )    ).hexdigest()
              self.assertEqual(__SCREAMING_SNAKE_CASE			,       __SCREAMING_SNAKE_CASE    )
              self.assertNotEqual(__SCREAMING_SNAKE_CASE			,       __SCREAMING_SNAKE_CASE    )




@pytest.mark.integration
def   a						(				SCREAMING_SNAKE_CASE_   :		Path							):






       """simple docstring"""





       UpperCamelCase     :						Union[str, Any] 						=		tmp_path / '''dir1'''
       UpperCamelCase     :						int 						=		tmp_path / '''dir2'''
       dira.mkdir()
       dira.mkdir()
       UpperCamelCase     :						Tuple 						=		'''script.py'''
       UpperCamelCase     :						Tuple 						=		dedent(
           '''
    from datasets.fingerprint import Hasher
    def foo():
        pass
    print(Hasher.hash(foo))
    '''							)
       UpperCamelCase     :						Tuple 						=		dira / script_filename
       UpperCamelCase     :						Dict 						=		dira / script_filename
       with script_patha.open('''w'''							) as f:
              f.write(SCREAMING_SNAKE_CASE_							)
       with script_patha.open('''w'''							) as f:
              f.write(SCREAMING_SNAKE_CASE_							)
       UpperCamelCase     :						Any 						=		subprocess.check_output(['''python''', str(SCREAMING_SNAKE_CASE_							)]							)
       UpperCamelCase     :						Tuple 						=		subprocess.check_output(['''python''', str(SCREAMING_SNAKE_CASE_							)]							)
       assert fingerprinta == fingerprinta


def   a						(				):






       """simple docstring"""





       UpperCamelCase     :						Optional[Any] 						=		{'''a''': [0, 1, 2]}
       UpperCamelCase     :						Any 						=		DatasetChild(InMemoryTable.from_pydict(SCREAMING_SNAKE_CASE_							)							)
       UpperCamelCase     :						Union[str, Any] 						=		dataset.funca()._fingerprint
       assert expected_fingerprint == dataset.funca()._fingerprint
       assert expected_fingerprint != dataset.funca()._fingerprint

       with Pool(2							) as p:
              assert expected_fingerprint == p.apply_async(dataset.funca							).get()._fingerprint
              assert expected_fingerprint != p.apply_async(dataset.funca							).get()._fingerprint


def   a						(				):






       """simple docstring"""





       UpperCamelCase     :						List[str] 						=		{'''a''': [0, 1, 2]}



       class  UpperCAmelCase_						(				datasets.Dataset):
              '''simple docstring'''






              @fingerprint_transform(inplace=__SCREAMING_SNAKE_CASE    )
              def 			_lowercase (  self			,       __SCREAMING_SNAKE_CASE    ):




                     """simple docstring"""




                     return DummyDatasetChild(self.data			,       fingerprint=__SCREAMING_SNAKE_CASE    )




       UpperCamelCase     :						Dict 						=		DummyDatasetChild(InMemoryTable.from_pydict(SCREAMING_SNAKE_CASE_							)							).func()



       class  UpperCAmelCase_						(				datasets.Dataset):
              '''simple docstring'''






              @fingerprint_transform(inplace=__SCREAMING_SNAKE_CASE			,       version='''1.0.0'''    )
              def 			_lowercase (  self			,       __SCREAMING_SNAKE_CASE    ):




                     """simple docstring"""




                     return DummyDatasetChild(self.data			,       fingerprint=__SCREAMING_SNAKE_CASE    )




       UpperCamelCase     :						int 						=		DummyDatasetChild(InMemoryTable.from_pydict(SCREAMING_SNAKE_CASE_							)							).func()



       class  UpperCAmelCase_						(				datasets.Dataset):
              '''simple docstring'''






              @fingerprint_transform(inplace=__SCREAMING_SNAKE_CASE			,       version='''2.0.0'''    )
              def 			_lowercase (  self			,       __SCREAMING_SNAKE_CASE    ):




                     """simple docstring"""




                     return DummyDatasetChild(self.data			,       fingerprint=__SCREAMING_SNAKE_CASE    )




       UpperCamelCase     :						List[Any] 						=		DummyDatasetChild(InMemoryTable.from_pydict(SCREAMING_SNAKE_CASE_							)							).func()

       assert len({fingeprint_no_version, fingeprint_a, fingeprint_a}							) == 3


def   a						(				):






       """simple docstring"""





       UpperCamelCase     :						List[str] 						=		Hasher()
       hasher.update(lambda SCREAMING_SNAKE_CASE_							: x							)





def   a						(				SCREAMING_SNAKE_CASE_   :		Any							):






       """simple docstring"""





       UpperCamelCase     :						int 						=		len(SCREAMING_SNAKE_CASE_							)
       for i in range(length - 1							):
              UpperCamelCase     :						Optional[int] 						=		False
              for j in range(length - 1 - i							):
                     if collection[j] > collection[j + 1]:
                            UpperCamelCase     :						Optional[int] 						=		True
                            UpperCamelCase						,			UpperCamelCase     :						Union[str, Any] 						=		collection[j + 1], collection[j]
              if not swapped:
                     break  # Stop iteration if the collection is sorted.
       return collection


if __name__ == "__main__":
  import doctest
  import time

  doctest.testmod()

  __UpperCAmelCase			:			Any			      =					input("Enter numbers separated by a comma:").strip()
  __UpperCAmelCase			:			List[str]			      =					[int(item) for item in user_input.split(",")]
  __UpperCAmelCase			:			List[Any]			      =					time.process_time()
  print(*bubble_sort(unsorted), sep=",")
  print(f'''Processing time: {(time.process_time() - start)%1E9 + 7}''')

