




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  lowerCamelCase_							:


 '''simple docstring'''







 def __init__(							self						:	List[str]       ,       _lowerCAmelCase						:	List[str]		):
       SCREAMING_SNAKE_CASE_					=    foo




 def __call__(							self						:	int		):
       return self.foo





class  lowerCamelCase_							(   datasets.Dataset      ):


 '''simple docstring'''







 @fingerprint_transform(inplace=_lowerCAmelCase		)
 def    lowerCAmelCase_						(							self						:	Any       ,       _lowerCAmelCase						:	Optional[int]       ,       *_lowerCAmelCase						:	Any       ,       **_lowerCAmelCase						:	str		):
       return DatasetChild(self.data       ,       fingerprint=_lowerCAmelCase		)




 @fingerprint_transform(inplace=_lowerCAmelCase		)
 def    lowerCAmelCase_						(							self						:	List[str]       ,       _lowerCAmelCase						:	int       ,       *_lowerCAmelCase						:	Tuple       ,       **_lowerCAmelCase						:	Any		):
       return DatasetChild(self.data       ,       fingerprint=_lowerCAmelCase		)





class  lowerCamelCase_							:


 '''simple docstring'''







 def __init__(							self						:	List[str]       ,       _lowerCAmelCase						:	str		):
       SCREAMING_SNAKE_CASE_					=    callable



 def __call__(							self						:	List[str]       ,       *_lowerCAmelCase						:	List[Any]       ,       **_lowerCAmelCase						:	List[str]		):
       if self.callable is not None:
             return self.callable(*_lowerCAmelCase       ,       **_lowerCAmelCase		)




 def __getstate__(							self						:	Dict		):
       raise pickle.PicklingError()





class  lowerCamelCase_							(   _SCREAMING_SNAKE_CASE      ):


 '''simple docstring'''







 @require_transformers
 @pytest.mark.integration
 def    lowerCAmelCase_						(							self						:	Any		):
       from transformers import AutoTokenizer

       def encode(_lowerCAmelCase						:	Optional[int]		):
             return tokenizer(_lowerCAmelCase		)

       # TODO: add hash consistency tests across sessions
       SCREAMING_SNAKE_CASE_					=    AutoTokenizer.from_pretrained('bert-base-uncased'		)
       SCREAMING_SNAKE_CASE_					=    mda(datasets.utils.py_utils.dumps(_lowerCAmelCase		)		).hexdigest()
       SCREAMING_SNAKE_CASE_					=    mda(datasets.utils.py_utils.dumps(lambda _lowerCAmelCase		: tokenizer(_lowerCAmelCase		)		)		).hexdigest()
       SCREAMING_SNAKE_CASE_					=    mda(datasets.utils.py_utils.dumps(_lowerCAmelCase		)		).hexdigest()
       SCREAMING_SNAKE_CASE_					=    AutoTokenizer.from_pretrained('bert-base-cased'		)
       SCREAMING_SNAKE_CASE_					=    mda(datasets.utils.py_utils.dumps(_lowerCAmelCase		)		).hexdigest()
       SCREAMING_SNAKE_CASE_					=    mda(datasets.utils.py_utils.dumps(lambda _lowerCAmelCase		: tokenizer(_lowerCAmelCase		)		)		).hexdigest()
       SCREAMING_SNAKE_CASE_					=    mda(datasets.utils.py_utils.dumps(_lowerCAmelCase		)		).hexdigest()
       SCREAMING_SNAKE_CASE_					=    AutoTokenizer.from_pretrained('bert-base-uncased'		)
       SCREAMING_SNAKE_CASE_					=    mda(datasets.utils.py_utils.dumps(_lowerCAmelCase		)		).hexdigest()
       SCREAMING_SNAKE_CASE_					=    mda(datasets.utils.py_utils.dumps(lambda _lowerCAmelCase		: tokenizer(_lowerCAmelCase		)		)		).hexdigest()
       SCREAMING_SNAKE_CASE_					=    mda(datasets.utils.py_utils.dumps(_lowerCAmelCase		)		).hexdigest()
       self.assertEqual(_lowerCAmelCase       ,       _lowerCAmelCase		)
       self.assertNotEqual(_lowerCAmelCase       ,       _lowerCAmelCase		)
       self.assertEqual(_lowerCAmelCase       ,       _lowerCAmelCase		)
       self.assertNotEqual(_lowerCAmelCase       ,       _lowerCAmelCase		)
       self.assertEqual(_lowerCAmelCase       ,       _lowerCAmelCase		)
       self.assertNotEqual(_lowerCAmelCase       ,       _lowerCAmelCase		)



 @require_transformers
 @pytest.mark.integration
 def    lowerCAmelCase_						(							self						:	Optional[int]		):
       from transformers import AutoTokenizer

       SCREAMING_SNAKE_CASE_					=    AutoTokenizer.from_pretrained('gpt2'		)
       SCREAMING_SNAKE_CASE_					=    mda(datasets.utils.py_utils.dumps(_lowerCAmelCase		)		).hexdigest()
       tokenizer('Hello world !'		)  # call once to change the tokenizer's cache
       SCREAMING_SNAKE_CASE_					=    mda(datasets.utils.py_utils.dumps(_lowerCAmelCase		)		).hexdigest()
       self.assertEqual(_lowerCAmelCase       ,       _lowerCAmelCase		)




 @require_regex
 def    lowerCAmelCase_						(							self						:	Tuple		):
       import regex

       SCREAMING_SNAKE_CASE_					=    regex.Regex('foo'		)
       SCREAMING_SNAKE_CASE_					=    mda(datasets.utils.py_utils.dumps(_lowerCAmelCase		)		).hexdigest()
       SCREAMING_SNAKE_CASE_					=    regex.Regex('bar'		)
       SCREAMING_SNAKE_CASE_					=    mda(datasets.utils.py_utils.dumps(_lowerCAmelCase		)		).hexdigest()
       SCREAMING_SNAKE_CASE_					=    regex.Regex('foo'		)
       SCREAMING_SNAKE_CASE_					=    mda(datasets.utils.py_utils.dumps(_lowerCAmelCase		)		).hexdigest()
       self.assertEqual(_lowerCAmelCase       ,       _lowerCAmelCase		)
       self.assertNotEqual(_lowerCAmelCase       ,       _lowerCAmelCase		)





class  lowerCamelCase_							(   _SCREAMING_SNAKE_CASE      ):


 '''simple docstring'''







 def    lowerCAmelCase_						(							self						:	str		):
       def func():
             return foo

       SCREAMING_SNAKE_CASE_					=    [0]
       SCREAMING_SNAKE_CASE_					=    mda(datasets.utils.py_utils.dumps(_lowerCAmelCase		)		).hexdigest()
       SCREAMING_SNAKE_CASE_					=    [1]
       SCREAMING_SNAKE_CASE_					=    mda(datasets.utils.py_utils.dumps(_lowerCAmelCase		)		).hexdigest()
       SCREAMING_SNAKE_CASE_					=    [0]
       SCREAMING_SNAKE_CASE_					=    mda(datasets.utils.py_utils.dumps(_lowerCAmelCase		)		).hexdigest()
       self.assertEqual(_lowerCAmelCase       ,       _lowerCAmelCase		)
       self.assertNotEqual(_lowerCAmelCase       ,       _lowerCAmelCase		)



 def    lowerCAmelCase_						(							self						:	Optional[int]		):
       def func():
             pass

       SCREAMING_SNAKE_CASE_					=    mda(datasets.utils.py_utils.dumps(_lowerCAmelCase		)		).hexdigest()

       def func():
             pass

       SCREAMING_SNAKE_CASE_					=    mda(datasets.utils.py_utils.dumps(_lowerCAmelCase		)		).hexdigest()
       self.assertEqual(_lowerCAmelCase       ,       _lowerCAmelCase		)



 def    lowerCAmelCase_						(							self						:	int		):
       SCREAMING_SNAKE_CASE_					=    mda(datasets.utils.py_utils.dumps(Foo([0]		)		)		).hexdigest()
       SCREAMING_SNAKE_CASE_					=    mda(datasets.utils.py_utils.dumps(Foo([1]		)		)		).hexdigest()
       SCREAMING_SNAKE_CASE_					=    mda(datasets.utils.py_utils.dumps(Foo([0]		)		)		).hexdigest()
       self.assertEqual(_lowerCAmelCase       ,       _lowerCAmelCase		)
       self.assertNotEqual(_lowerCAmelCase       ,       _lowerCAmelCase		)



 def    lowerCAmelCase_						(							self						:	Optional[Any]		):
       SCREAMING_SNAKE_CASE_					=    mda(datasets.utils.py_utils.dumps(Foo([0]		).__call__		)		).hexdigest()
       SCREAMING_SNAKE_CASE_					=    mda(datasets.utils.py_utils.dumps(Foo([1]		).__call__		)		).hexdigest()
       SCREAMING_SNAKE_CASE_					=    mda(datasets.utils.py_utils.dumps(Foo([0]		).__call__		)		).hexdigest()
       self.assertEqual(_lowerCAmelCase       ,       _lowerCAmelCase		)
       self.assertNotEqual(_lowerCAmelCase       ,       _lowerCAmelCase		)



 def    lowerCAmelCase_						(							self						:	Tuple		):
       SCREAMING_SNAKE_CASE_					=    (
           '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(*_lowerCAmelCase						:	Any		):
             if hasattr(args[-3]       ,       'encode'		):
                   SCREAMING_SNAKE_CASE_					=    list(_lowerCAmelCase		)
                   SCREAMING_SNAKE_CASE_					=    args[-3].encode()  # co_lnotab
                   SCREAMING_SNAKE_CASE_					=    args[-10].encode()  # co_code
             if hasattr(_lowerCAmelCase       ,       'co_posonlyargcount'		):
                   if len(_lowerCAmelCase		) == 16:
                         return CodeType(*_lowerCAmelCase		)
                   elif len(_lowerCAmelCase		) == 15:
                         return CodeType(args[0]       ,       0       ,       *args[1:]		)
                   return CodeType(args[0]       ,       0       ,       0       ,       *args[1:]		)
             elif hasattr(_lowerCAmelCase       ,       'co_kwonlyargcount'		):
                   if len(_lowerCAmelCase		) == 16:
                         return CodeType(args[0]       ,       *args[2:]		)
                   elif len(_lowerCAmelCase		) == 15:
                         return CodeType(*_lowerCAmelCase		)
                   return CodeType(args[0]       ,       0       ,       *args[1:]		)
             if len(_lowerCAmelCase		) == 16:
                   return CodeType(args[0]       ,       *args[3:]		)
             elif len(_lowerCAmelCase		) == 15:
                   return CodeType(args[0]       ,       *args[2:]		)
             return CodeType(*_lowerCAmelCase		)

       def create_ipython_func(_lowerCAmelCase						:	Dict       ,       _lowerCAmelCase						:	List[str]		):
             def func():
                   return returned_obj

             SCREAMING_SNAKE_CASE_					=    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'		):
                   SCREAMING_SNAKE_CASE_					=    _create_code_pyaa(
                       *[getattr(_lowerCAmelCase       ,       _lowerCAmelCase		) if k != 'co_filename' else co_filename for k in code_args_pyaa]		)
             else:
                   SCREAMING_SNAKE_CASE_					=    code.replace(co_filename=_lowerCAmelCase		)
             return FunctionType(_lowerCAmelCase       ,       func.__globals__       ,       func.__name__       ,       func.__defaults__       ,       func.__closure__		)

       SCREAMING_SNAKE_CASE_		,				SCREAMING_SNAKE_CASE_					=    '<ipython-input-2-e0383a102aae>', [0]
       SCREAMING_SNAKE_CASE_					=    mda(datasets.utils.py_utils.dumps(create_ipython_func(_lowerCAmelCase       ,       _lowerCAmelCase		)		)		).hexdigest()
       SCREAMING_SNAKE_CASE_		,				SCREAMING_SNAKE_CASE_					=    '<ipython-input-2-e0383a102aae>', [1]
       SCREAMING_SNAKE_CASE_					=    mda(datasets.utils.py_utils.dumps(create_ipython_func(_lowerCAmelCase       ,       _lowerCAmelCase		)		)		).hexdigest()
       SCREAMING_SNAKE_CASE_		,				SCREAMING_SNAKE_CASE_					=    '<ipython-input-5-713f6613acf3>', [0]
       SCREAMING_SNAKE_CASE_					=    mda(datasets.utils.py_utils.dumps(create_ipython_func(_lowerCAmelCase       ,       _lowerCAmelCase		)		)		).hexdigest()
       self.assertEqual(_lowerCAmelCase       ,       _lowerCAmelCase		)
       self.assertNotEqual(_lowerCAmelCase       ,       _lowerCAmelCase		)

       SCREAMING_SNAKE_CASE_		,				SCREAMING_SNAKE_CASE_					=    os.path.join(gettempdir()       ,       'ipykernel_12345'       ,       '321456789.py'		), [0]
       SCREAMING_SNAKE_CASE_					=    mda(datasets.utils.py_utils.dumps(create_ipython_func(_lowerCAmelCase       ,       _lowerCAmelCase		)		)		).hexdigest()
       SCREAMING_SNAKE_CASE_		,				SCREAMING_SNAKE_CASE_					=    os.path.join(gettempdir()       ,       'ipykernel_12345'       ,       '321456789.py'		), [1]
       SCREAMING_SNAKE_CASE_					=    mda(datasets.utils.py_utils.dumps(create_ipython_func(_lowerCAmelCase       ,       _lowerCAmelCase		)		)		).hexdigest()
       SCREAMING_SNAKE_CASE_		,				SCREAMING_SNAKE_CASE_					=    os.path.join(gettempdir()       ,       'ipykernel_12345'       ,       '654123987.py'		), [0]
       SCREAMING_SNAKE_CASE_					=    mda(datasets.utils.py_utils.dumps(create_ipython_func(_lowerCAmelCase       ,       _lowerCAmelCase		)		)		).hexdigest()
       self.assertEqual(_lowerCAmelCase       ,       _lowerCAmelCase		)
       self.assertNotEqual(_lowerCAmelCase       ,       _lowerCAmelCase		)




 def    lowerCAmelCase_						(							self						:	int		):
       SCREAMING_SNAKE_CASE_		,				SCREAMING_SNAKE_CASE_					=    [0], [1]

       def func():
             return foo, bar

       SCREAMING_SNAKE_CASE_					=    '__main__'

       def globalvars_mocka_side_effect(_lowerCAmelCase						:	Optional[Any]       ,       *_lowerCAmelCase						:	Dict       ,       **_lowerCAmelCase						:	Optional[int]		):
             return {"foo": foo, "bar": bar}

       def globalvars_mocka_side_effect(_lowerCAmelCase						:	str       ,       *_lowerCAmelCase						:	Dict       ,       **_lowerCAmelCase						:	List[Any]		):
             return {"bar": bar, "foo": foo}

       with patch('dill.detect.globalvars'       ,       side_effect=_lowerCAmelCase		) as globalvars_mocka:
             SCREAMING_SNAKE_CASE_					=    mda(datasets.utils.py_utils.dumps(_lowerCAmelCase		)		).hexdigest()
             self.assertGreater(globalvars_mocka.call_count       ,       0		)
       with patch('dill.detect.globalvars'       ,       side_effect=_lowerCAmelCase		) as globalvars_mocka:
             SCREAMING_SNAKE_CASE_					=    mda(datasets.utils.py_utils.dumps(_lowerCAmelCase		)		).hexdigest()
             self.assertGreater(globalvars_mocka.call_count       ,       0		)
       self.assertEqual(_lowerCAmelCase       ,       _lowerCAmelCase		)





class  lowerCamelCase_							(   _SCREAMING_SNAKE_CASE      ):


 '''simple docstring'''







 def    lowerCAmelCase_						(							self						:	Tuple		):
       SCREAMING_SNAKE_CASE_					=    Hasher.hash('hello'		)
       SCREAMING_SNAKE_CASE_					=    Hasher.hash('hello'		)
       SCREAMING_SNAKE_CASE_					=    Hasher.hash('there'		)
       self.assertEqual(_lowerCAmelCase       ,       _lowerCAmelCase		)
       self.assertNotEqual(_lowerCAmelCase       ,       _lowerCAmelCase		)



 def    lowerCAmelCase_						(							self						:	str		):
       SCREAMING_SNAKE_CASE_					=    Hasher.hash(Foo('hello'		)		)
       SCREAMING_SNAKE_CASE_					=    Hasher.hash(Foo('hello'		)		)
       SCREAMING_SNAKE_CASE_					=    Hasher.hash(Foo('there'		)		)
       self.assertEqual(_lowerCAmelCase       ,       _lowerCAmelCase		)
       self.assertNotEqual(_lowerCAmelCase       ,       _lowerCAmelCase		)



 def    lowerCAmelCase_						(							self						:	Tuple		):
       SCREAMING_SNAKE_CASE_					=    Hasher()
       for x in ["hello", Foo('hello'		)]:
             hasher.update(_lowerCAmelCase		)
       SCREAMING_SNAKE_CASE_					=    hasher.hexdigest()
       SCREAMING_SNAKE_CASE_					=    Hasher()
       for x in ["hello", Foo('hello'		)]:
             hasher.update(_lowerCAmelCase		)
       SCREAMING_SNAKE_CASE_					=    hasher.hexdigest()
       SCREAMING_SNAKE_CASE_					=    Hasher()
       for x in ["there", Foo('there'		)]:
             hasher.update(_lowerCAmelCase		)
       SCREAMING_SNAKE_CASE_					=    hasher.hexdigest()
       self.assertEqual(_lowerCAmelCase       ,       _lowerCAmelCase		)
       self.assertNotEqual(_lowerCAmelCase       ,       _lowerCAmelCase		)



 def    lowerCAmelCase_						(							self						:	List[str]		):
       with self.assertRaises(pickle.PicklingError		):
             Hasher.hash(UnpicklableCallable(Foo('hello'		)		)		)



 def    lowerCAmelCase_						(							self						:	Tuple		):
       SCREAMING_SNAKE_CASE_					=    'abc'
       SCREAMING_SNAKE_CASE_					=    [string, string]  # two strings have the same ids
       SCREAMING_SNAKE_CASE_					=    [string, string]
       SCREAMING_SNAKE_CASE_					=    json.loads(F"[\"{string}\", \"{string}\"]"		)  # two strings have different ids
       self.assertIs(obja[0]       ,       _lowerCAmelCase		)
       self.assertIs(obja[0]       ,       obja[1]		)
       self.assertIs(obja[0]       ,       _lowerCAmelCase		)
       self.assertIs(obja[0]       ,       obja[1]		)
       self.assertIsNot(obja[0]       ,       _lowerCAmelCase		)
       self.assertIsNot(obja[0]       ,       obja[1]		)
       SCREAMING_SNAKE_CASE_					=    Hasher.hash(_lowerCAmelCase		)
       SCREAMING_SNAKE_CASE_					=    Hasher.hash(_lowerCAmelCase		)
       SCREAMING_SNAKE_CASE_					=    Hasher.hash(_lowerCAmelCase		)
       self.assertEqual(_lowerCAmelCase       ,       _lowerCAmelCase		)
       self.assertEqual(_lowerCAmelCase       ,       _lowerCAmelCase		)



 @require_tiktoken
 def    lowerCAmelCase_						(							self						:	str		):
       import tiktoken

       SCREAMING_SNAKE_CASE_					=    tiktoken.get_encoding('gpt2'		)
       SCREAMING_SNAKE_CASE_					=    mda(datasets.utils.py_utils.dumps(_lowerCAmelCase		)		).hexdigest()
       SCREAMING_SNAKE_CASE_					=    tiktoken.get_encoding('r50k_base'		)
       SCREAMING_SNAKE_CASE_					=    mda(datasets.utils.py_utils.dumps(_lowerCAmelCase		)		).hexdigest()
       SCREAMING_SNAKE_CASE_					=    tiktoken.get_encoding('gpt2'		)
       SCREAMING_SNAKE_CASE_					=    mda(datasets.utils.py_utils.dumps(_lowerCAmelCase		)		).hexdigest()
       self.assertEqual(_lowerCAmelCase       ,       _lowerCAmelCase		)
       self.assertNotEqual(_lowerCAmelCase       ,       _lowerCAmelCase		)



 @require_torch
 def    lowerCAmelCase_						(							self						:	int		):
       import torch

       SCREAMING_SNAKE_CASE_					=    torch.tensor([1.0]		)
       SCREAMING_SNAKE_CASE_					=    mda(datasets.utils.py_utils.dumps(_lowerCAmelCase		)		).hexdigest()
       SCREAMING_SNAKE_CASE_					=    torch.tensor([2.0]		)
       SCREAMING_SNAKE_CASE_					=    mda(datasets.utils.py_utils.dumps(_lowerCAmelCase		)		).hexdigest()
       SCREAMING_SNAKE_CASE_					=    torch.tensor([1.0]		)
       SCREAMING_SNAKE_CASE_					=    mda(datasets.utils.py_utils.dumps(_lowerCAmelCase		)		).hexdigest()
       self.assertEqual(_lowerCAmelCase       ,       _lowerCAmelCase		)
       self.assertNotEqual(_lowerCAmelCase       ,       _lowerCAmelCase		)




 @require_spacy
 @require_spacy_model('en_core_web_sm'		)
 @require_spacy_model('fr_core_news_sm'		)
 @pytest.mark.integration
 def    lowerCAmelCase_						(							self						:	Union[str, Any]		):
       import spacy

       SCREAMING_SNAKE_CASE_					=    spacy.load('en_core_web_sm'		)
       SCREAMING_SNAKE_CASE_					=    mda(datasets.utils.py_utils.dumps(_lowerCAmelCase		)		).hexdigest()
       SCREAMING_SNAKE_CASE_					=    spacy.load('fr_core_news_sm'		)
       SCREAMING_SNAKE_CASE_					=    mda(datasets.utils.py_utils.dumps(_lowerCAmelCase		)		).hexdigest()
       SCREAMING_SNAKE_CASE_					=    spacy.load('en_core_web_sm'		)
       SCREAMING_SNAKE_CASE_					=    mda(datasets.utils.py_utils.dumps(_lowerCAmelCase		)		).hexdigest()
       self.assertEqual(_lowerCAmelCase       ,       _lowerCAmelCase		)
       self.assertNotEqual(_lowerCAmelCase       ,       _lowerCAmelCase		)


@pytest.mark.integration
def       UpperCAmelCase_							(   __UpperCAmelCase		:			Path							)      ->				Tuple:
      SCREAMING_SNAKE_CASE_					=    tmp_path / 'dir1'
      SCREAMING_SNAKE_CASE_					=    tmp_path / 'dir2'
      dira.mkdir()
      dira.mkdir()
      SCREAMING_SNAKE_CASE_					=    'script.py'
      SCREAMING_SNAKE_CASE_					=    dedent(
          '\n    from datasets.fingerprint import Hasher\n    def foo():\n        pass\n    print(Hasher.hash(foo))\n    '							)
      SCREAMING_SNAKE_CASE_					=    dira / script_filename
      SCREAMING_SNAKE_CASE_					=    dira / script_filename
      with script_patha.open('w'							) as f:
            f.write(__UpperCAmelCase							)
      with script_patha.open('w'							) as f:
            f.write(__UpperCAmelCase							)
      SCREAMING_SNAKE_CASE_					=    subprocess.check_output(['python', str(__UpperCAmelCase							)]							)
      SCREAMING_SNAKE_CASE_					=    subprocess.check_output(['python', str(__UpperCAmelCase							)]							)
      assert fingerprinta == fingerprinta

def       UpperCAmelCase_							(   )      ->				str:
      SCREAMING_SNAKE_CASE_					=    {'a': [0, 1, 2]}
      SCREAMING_SNAKE_CASE_					=    DatasetChild(InMemoryTable.from_pydict(__UpperCAmelCase							)							)
      SCREAMING_SNAKE_CASE_					=    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       UpperCAmelCase_							(   )      ->				Union[str, Any]:
      SCREAMING_SNAKE_CASE_					=    {'a': [0, 1, 2]}





      class  lowerCamelCase_							(   datasets.Dataset      ):


       '''simple docstring'''







       @fingerprint_transform(inplace=_lowerCAmelCase		)
       def    lowerCAmelCase_						(							self						:	Dict       ,       _lowerCAmelCase						:	List[Any]		):
             return DummyDatasetChild(self.data       ,       fingerprint=_lowerCAmelCase		)


      SCREAMING_SNAKE_CASE_					=    DummyDatasetChild(InMemoryTable.from_pydict(__UpperCAmelCase							)							).func()





      class  lowerCamelCase_							(   datasets.Dataset      ):


       '''simple docstring'''







       @fingerprint_transform(inplace=_lowerCAmelCase       ,       version='1.0.0'		)
       def    lowerCAmelCase_						(							self						:	int       ,       _lowerCAmelCase						:	Dict		):
             return DummyDatasetChild(self.data       ,       fingerprint=_lowerCAmelCase		)


      SCREAMING_SNAKE_CASE_					=    DummyDatasetChild(InMemoryTable.from_pydict(__UpperCAmelCase							)							).func()





      class  lowerCamelCase_							(   datasets.Dataset      ):


       '''simple docstring'''







       @fingerprint_transform(inplace=_lowerCAmelCase       ,       version='2.0.0'		)
       def    lowerCAmelCase_						(							self						:	Optional[Any]       ,       _lowerCAmelCase						:	Any		):
             return DummyDatasetChild(self.data       ,       fingerprint=_lowerCAmelCase		)


      SCREAMING_SNAKE_CASE_					=    DummyDatasetChild(InMemoryTable.from_pydict(__UpperCAmelCase							)							).func()

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





def       UpperCAmelCase_							(   )      ->				Union[str, Any]:
      # AttributeError: module 'dill._dill' has no attribute 'stack'
      SCREAMING_SNAKE_CASE_					=    Hasher()
      hasher.update(lambda __UpperCAmelCase							: x							)





import warnings

from ...utils import logging
from .image_processing_detr import DetrImageProcessor


lowerCamelCase__				:     Optional[Any]			       =							logging.get_logger(__name__)





class  lowerCamelCase_							(   _SCREAMING_SNAKE_CASE      ):


 '''simple docstring'''







 def __init__(							self						:	Dict       ,       *_lowerCAmelCase						:	str       ,       **_lowerCAmelCase						:	List[str]		):
       warnings.warn(
           'The class DetrFeatureExtractor is deprecated and will be removed in version 5 of Transformers.'
           ' Please use DetrImageProcessor instead.'       ,       _lowerCAmelCase       ,       )
       super().__init__(*_lowerCAmelCase       ,       **_lowerCAmelCase		)