




'''simple docstring'''






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





     def __init__(    self    :				Union[str, Any]    ,       __lowerCamelCase    :				Dict ):
           snake_case__					:      Tuple  			=						foo





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






class 					lowercase_			(	datasets.Dataset       ):





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





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






class 					lowercase_			:





     def __init__(    self    :				List[Any]    ,       __lowerCamelCase    :				Tuple ):
           snake_case__					:      str  			=						callable





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





     def __getstate__(    self    :				Optional[Any] ):
           raise pickle.PicklingError()






class 					lowercase_			(	lowerCAmelCase_       ):





     @require_transformers
     @pytest.mark.integration
     def  _lowerCAmelCase			(    self    :				List[str] ):
           from transformers import AutoTokenizer

           def encode(__lowerCamelCase    :				List[Any] ):
                 return tokenizer(__lowerCamelCase )

           # TODO: add hash consistency tests across sessions
           snake_case__					:      Optional[int]  			=						AutoTokenizer.from_pretrained('bert-base-uncased' )
           snake_case__					:      int  			=						mda(datasets.utils.py_utils.dumps(__lowerCamelCase ) ).hexdigest()
           snake_case__					:      int  			=						mda(datasets.utils.py_utils.dumps(lambda __lowerCamelCase : tokenizer(__lowerCamelCase ) ) ).hexdigest()
           snake_case__					:      List[Any]  			=						mda(datasets.utils.py_utils.dumps(__lowerCamelCase ) ).hexdigest()
           snake_case__					:      List[str]  			=						AutoTokenizer.from_pretrained('bert-base-cased' )
           snake_case__					:      Dict  			=						mda(datasets.utils.py_utils.dumps(__lowerCamelCase ) ).hexdigest()
           snake_case__					:      Union[str, Any]  			=						mda(datasets.utils.py_utils.dumps(lambda __lowerCamelCase : tokenizer(__lowerCamelCase ) ) ).hexdigest()
           snake_case__					:      str  			=						mda(datasets.utils.py_utils.dumps(__lowerCamelCase ) ).hexdigest()
           snake_case__					:      Dict  			=						AutoTokenizer.from_pretrained('bert-base-uncased' )
           snake_case__					:      Any  			=						mda(datasets.utils.py_utils.dumps(__lowerCamelCase ) ).hexdigest()
           snake_case__					:      Tuple  			=						mda(datasets.utils.py_utils.dumps(lambda __lowerCamelCase : tokenizer(__lowerCamelCase ) ) ).hexdigest()
           snake_case__					:      str  			=						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    :				Any ):
           from transformers import AutoTokenizer

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





     @require_regex
     def  _lowerCAmelCase			(    self    :				Dict ):
           import regex

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






class 					lowercase_			(	lowerCAmelCase_       ):





     def  _lowerCAmelCase			(    self    :				Union[str, Any] ):
           def func():
                 return foo

           snake_case__					:      Union[str, Any]  			=						[0]
           snake_case__					:      Optional[int]  			=						mda(datasets.utils.py_utils.dumps(__lowerCamelCase ) ).hexdigest()
           snake_case__					:      List[str]  			=						[1]
           snake_case__					:      List[str]  			=						mda(datasets.utils.py_utils.dumps(__lowerCamelCase ) ).hexdigest()
           snake_case__					:      int  			=						[0]
           snake_case__					:      List[Any]  			=						mda(datasets.utils.py_utils.dumps(__lowerCamelCase ) ).hexdigest()
           self.assertEqual(__lowerCamelCase    ,       __lowerCamelCase )
           self.assertNotEqual(__lowerCamelCase    ,       __lowerCamelCase )





     def  _lowerCAmelCase			(    self    :				Tuple ):
           def func():
                 pass

           snake_case__					:      Union[str, Any]  			=						mda(datasets.utils.py_utils.dumps(__lowerCamelCase ) ).hexdigest()

           def func():
                 pass

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





     def  _lowerCAmelCase			(    self    :				List[Any] ):
           snake_case__					:      Any  			=						mda(datasets.utils.py_utils.dumps(Foo([0] ) ) ).hexdigest()
           snake_case__					:      List[str]  			=						mda(datasets.utils.py_utils.dumps(Foo([1] ) ) ).hexdigest()
           snake_case__					:      Any  			=						mda(datasets.utils.py_utils.dumps(Foo([0] ) ) ).hexdigest()
           self.assertEqual(__lowerCamelCase    ,       __lowerCamelCase )
           self.assertNotEqual(__lowerCamelCase    ,       __lowerCamelCase )





     def  _lowerCAmelCase			(    self    :				List[str] ):
           snake_case__					:      Any  			=						mda(datasets.utils.py_utils.dumps(Foo([0] ).__call__ ) ).hexdigest()
           snake_case__					:      Optional[Any]  			=						mda(datasets.utils.py_utils.dumps(Foo([1] ).__call__ ) ).hexdigest()
           snake_case__					:      int  			=						mda(datasets.utils.py_utils.dumps(Foo([0] ).__call__ ) ).hexdigest()
           self.assertEqual(__lowerCamelCase    ,       __lowerCamelCase )
           self.assertNotEqual(__lowerCamelCase    ,       __lowerCamelCase )





     def  _lowerCAmelCase			(    self    :				Tuple ):
           snake_case__					:      List[Any]  			=						(
               '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    :				List[str] ):
                 if hasattr(args[-3]    ,       'encode' ):
                       snake_case__					:      str  			=						list(__lowerCamelCase )
                       snake_case__					:      Optional[int]  			=						args[-3].encode()  # co_lnotab
                       snake_case__					:      Optional[int]  			=						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    :				int    ,       __lowerCamelCase    :				Tuple ):
                 def func():
                       return returned_obj

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

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

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





     def  _lowerCAmelCase			(    self    :				int ):
           snake_case__					:      List[Any]  			=						[0], [1]

           def func():
                 return foo, bar

           snake_case__					:      Dict  			=						'__main__'

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

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

           with patch('dill.detect.globalvars'    ,       side_effect=__lowerCamelCase ) as globalvars_mocka:
                 snake_case__					:      Any  			=						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:
                 snake_case__					:      Tuple  			=						mda(datasets.utils.py_utils.dumps(__lowerCamelCase ) ).hexdigest()
                 self.assertGreater(globalvars_mocka.call_count    ,       0 )
           self.assertEqual(__lowerCamelCase    ,       __lowerCamelCase )






class 					lowercase_			(	lowerCAmelCase_       ):





     def  _lowerCAmelCase			(    self    :				List[str] ):
           snake_case__					:      Dict  			=						Hasher.hash('hello' )
           snake_case__					:      Dict  			=						Hasher.hash('hello' )
           snake_case__					:      str  			=						Hasher.hash('there' )
           self.assertEqual(__lowerCamelCase    ,       __lowerCamelCase )
           self.assertNotEqual(__lowerCamelCase    ,       __lowerCamelCase )





     def  _lowerCAmelCase			(    self    :				List[Any] ):
           snake_case__					:      Tuple  			=						Hasher.hash(Foo('hello' ) )
           snake_case__					:      List[str]  			=						Hasher.hash(Foo('hello' ) )
           snake_case__					:      Any  			=						Hasher.hash(Foo('there' ) )
           self.assertEqual(__lowerCamelCase    ,       __lowerCamelCase )
           self.assertNotEqual(__lowerCamelCase    ,       __lowerCamelCase )





     def  _lowerCAmelCase			(    self    :				Dict ):
           snake_case__					:      Any  			=						Hasher()
           for x in ["hello", Foo('hello' )]:
                 hasher.update(__lowerCamelCase )
           snake_case__					:      Optional[Any]  			=						hasher.hexdigest()
           snake_case__					:      Tuple  			=						Hasher()
           for x in ["hello", Foo('hello' )]:
                 hasher.update(__lowerCamelCase )
           snake_case__					:      Union[str, Any]  			=						hasher.hexdigest()
           snake_case__					:      Optional[int]  			=						Hasher()
           for x in ["there", Foo('there' )]:
                 hasher.update(__lowerCamelCase )
           snake_case__					:      Dict  			=						hasher.hexdigest()
           self.assertEqual(__lowerCamelCase    ,       __lowerCamelCase )
           self.assertNotEqual(__lowerCamelCase    ,       __lowerCamelCase )





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





     def  _lowerCAmelCase			(    self    :				List[str] ):
           snake_case__					:      str  			=						'abc'
           snake_case__					:      int  			=						[string, string]  # two strings have the same ids
           snake_case__					:      Optional[Any]  			=						[string, string]
           snake_case__					:      Union[str, Any]  			=						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] )
           snake_case__					:      str  			=						Hasher.hash(__lowerCamelCase )
           snake_case__					:      Dict  			=						Hasher.hash(__lowerCamelCase )
           snake_case__					:      Optional[int]  			=						Hasher.hash(__lowerCamelCase )
           self.assertEqual(__lowerCamelCase    ,       __lowerCamelCase )
           self.assertEqual(__lowerCamelCase    ,       __lowerCamelCase )





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

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





     @require_torch
     def  _lowerCAmelCase			(    self    :				Any ):
           import torch

           snake_case__					:      Any  			=						torch.tensor([1.0] )
           snake_case__					:      Tuple  			=						mda(datasets.utils.py_utils.dumps(__lowerCamelCase ) ).hexdigest()
           snake_case__					:      Dict  			=						torch.tensor([2.0] )
           snake_case__					:      int  			=						mda(datasets.utils.py_utils.dumps(__lowerCamelCase ) ).hexdigest()
           snake_case__					:      Dict  			=						torch.tensor([1.0] )
           snake_case__					:      Any  			=						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    :				Tuple ):
           import spacy

           snake_case__					:      Optional[Any]  			=						spacy.load('en_core_web_sm' )
           snake_case__					:      Dict  			=						mda(datasets.utils.py_utils.dumps(__lowerCamelCase ) ).hexdigest()
           snake_case__					:      Union[str, Any]  			=						spacy.load('fr_core_news_sm' )
           snake_case__					:      Optional[int]  			=						mda(datasets.utils.py_utils.dumps(__lowerCamelCase ) ).hexdigest()
           snake_case__					:      Any  			=						spacy.load('en_core_web_sm' )
           snake_case__					:      List[str]  			=						mda(datasets.utils.py_utils.dumps(__lowerCamelCase ) ).hexdigest()
           self.assertEqual(__lowerCamelCase    ,       __lowerCamelCase )
           self.assertNotEqual(__lowerCamelCase    ,       __lowerCamelCase )






@pytest.mark.integration
def 		UpperCamelCase__			(		__SCREAMING_SNAKE_CASE		)						->      List[Any]:
      snake_case__					:      int  			=						tmp_path / 'dir1'
      snake_case__					:      Optional[Any]  			=						tmp_path / 'dir2'
      dira.mkdir()
      dira.mkdir()
      snake_case__					:      List[Any]  			=						'script.py'
      snake_case__					:      Any  			=						dedent(
          '\n    from datasets.fingerprint import Hasher\n    def foo():\n        pass\n    print(Hasher.hash(foo))\n    '		)
      snake_case__					:      int  			=						dira / script_filename
      snake_case__					:      List[str]  			=						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		)
      snake_case__					:      Optional[int]  			=						subprocess.check_output(['python', str(__SCREAMING_SNAKE_CASE		)]		)
      snake_case__					:      List[Any]  			=						subprocess.check_output(['python', str(__SCREAMING_SNAKE_CASE		)]		)
      assert fingerprinta == fingerprinta






def 		UpperCamelCase__			(		)						->      Optional[Any]:
      snake_case__					:      Optional[int]  			=						{'a': [0, 1, 2]}
      snake_case__					:      Union[str, Any]  			=						DatasetChild(InMemoryTable.from_pydict(__SCREAMING_SNAKE_CASE		)		)
      snake_case__					:      List[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 		UpperCamelCase__			(		)						->      Optional[int]:
      snake_case__					:      int  			=						{'a': [0, 1, 2]}






      class 					lowercase_			(	datasets.Dataset       ):





           @fingerprint_transform(inplace=__lowerCamelCase )
           def  _lowerCAmelCase			(    self    :				Optional[int]    ,       __lowerCamelCase    :				int ):
                 return DummyDatasetChild(self.data    ,       fingerprint=__lowerCamelCase )



      snake_case__					:      str  			=						DummyDatasetChild(InMemoryTable.from_pydict(__SCREAMING_SNAKE_CASE		)		).func()






      class 					lowercase_			(	datasets.Dataset       ):





           @fingerprint_transform(inplace=__lowerCamelCase    ,       version='1.0.0' )
           def  _lowerCAmelCase			(    self    :				Optional[Any]    ,       __lowerCamelCase    :				List[str] ):
                 return DummyDatasetChild(self.data    ,       fingerprint=__lowerCamelCase )



      snake_case__					:      List[Any]  			=						DummyDatasetChild(InMemoryTable.from_pydict(__SCREAMING_SNAKE_CASE		)		).func()






      class 					lowercase_			(	datasets.Dataset       ):





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



      snake_case__					:      int  			=						DummyDatasetChild(InMemoryTable.from_pydict(__SCREAMING_SNAKE_CASE		)		).func()

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






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







'''simple docstring'''






def 		UpperCamelCase__			(		__SCREAMING_SNAKE_CASE = 1000		)						->      int:
      snake_case__					:      List[str]  			=						0
      snake_case__					:      int  			=						(n - 1) // 3
      total += ((terms) * (6 + (terms - 1) * 3)) // 2  # total of an A.P.
      snake_case__					:      Optional[Any]  			=						(n - 1) // 5
      total += ((terms) * (10 + (terms - 1) * 5)) // 2
      snake_case__					:      Tuple  			=						(n - 1) // 15
      total -= ((terms) * (30 + (terms - 1) * 15)) // 2
      return total


if __name__ == "__main__":
      print(F'{solution() = }')
