




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

					def __init__(    self			,	__lowercase ):







						'''simple docstring'''




						lowerCamelCase_							:		int							       =							foo





					def __call__(    self ):







						'''simple docstring'''




						return self.foo


class     __SCREAMING_SNAKE_CASE							(		datasets.Dataset  ):

					@fingerprint_transform(inplace=__lowercase )
					def      lowercase_							(    self			,	__lowercase			,	*__lowercase			,	**__lowercase ):







						'''simple docstring'''




						return DatasetChild(self.data			,	fingerprint=__lowercase )





					@fingerprint_transform(inplace=__lowercase )
					def      lowercase_							(    self			,	__lowercase			,	*__lowercase			,	**__lowercase ):







						'''simple docstring'''




						return DatasetChild(self.data			,	fingerprint=__lowercase )


class     __SCREAMING_SNAKE_CASE							:

					def __init__(    self			,	__lowercase ):







						'''simple docstring'''




						lowerCamelCase_							:		str							       =							callable

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







						'''simple docstring'''




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





					def __getstate__(    self ):







						'''simple docstring'''




						raise pickle.PicklingError()


class     __SCREAMING_SNAKE_CASE							(		lowerCamelCase  ):

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







						'''simple docstring'''




						from transformers import AutoTokenizer

						def encode(__lowercase ):
							return tokenizer(__lowercase )

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

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







						'''simple docstring'''




						from transformers import AutoTokenizer

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





					@require_regex
					def      lowercase_							(    self ):







						'''simple docstring'''




						import regex

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


class     __SCREAMING_SNAKE_CASE							(		lowerCamelCase  ):

					def      lowercase_							(    self ):







						'''simple docstring'''




						def func():
							return foo

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

					def      lowercase_							(    self ):







						'''simple docstring'''




						def func():
							pass

						lowerCamelCase_							:		int							       =							mda(datasets.utils.py_utils.dumps(__lowercase ) ).hexdigest()

						def func():
							pass

						lowerCamelCase_							:		str							       =							mda(datasets.utils.py_utils.dumps(__lowercase ) ).hexdigest()
						self.assertEqual(__lowercase			,	__lowercase )

					def      lowercase_							(    self ):







						'''simple docstring'''




						lowerCamelCase_							:		Any							       =							mda(datasets.utils.py_utils.dumps(Foo([0] ) ) ).hexdigest()
						lowerCamelCase_							:		Optional[Any]							       =							mda(datasets.utils.py_utils.dumps(Foo([1] ) ) ).hexdigest()
						lowerCamelCase_							:		List[Any]							       =							mda(datasets.utils.py_utils.dumps(Foo([0] ) ) ).hexdigest()
						self.assertEqual(__lowercase			,	__lowercase )
						self.assertNotEqual(__lowercase			,	__lowercase )

					def      lowercase_							(    self ):







						'''simple docstring'''




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

					def      lowercase_							(    self ):







						'''simple docstring'''




						lowerCamelCase_							:		Dict							       =							(
						    '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(*__lowercase ):
							if hasattr(args[-3]			,	'encode' ):
								lowerCamelCase_							:		Union[str, Any]							       =							list(__lowercase )
								lowerCamelCase_							:		Optional[Any]							       =							args[-3].encode()  # co_lnotab
								lowerCamelCase_							:		int							       =							args[-10].encode()  # co_code
							if hasattr(__lowercase			,	'co_posonlyargcount' ):
								if len(__lowercase ) == 16:
									return CodeType(*__lowercase )
								elif len(__lowercase ) == 15:
									return CodeType(args[0]			,	0			,	*args[1:] )
								return CodeType(args[0]			,	0			,	0			,	*args[1:] )
							elif hasattr(__lowercase			,	'co_kwonlyargcount' ):
								if len(__lowercase ) == 16:
									return CodeType(args[0]			,	*args[2:] )
								elif len(__lowercase ) == 15:
									return CodeType(*__lowercase )
								return CodeType(args[0]			,	0			,	*args[1:] )
							if len(__lowercase ) == 16:
								return CodeType(args[0]			,	*args[3:] )
							elif len(__lowercase ) == 15:
								return CodeType(args[0]			,	*args[2:] )
							return CodeType(*__lowercase )

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

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

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

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





					def      lowercase_							(    self ):







						'''simple docstring'''




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

						def func():
							return foo, bar

						lowerCamelCase_							:		Optional[Any]							       =							'__main__'

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

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

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


class     __SCREAMING_SNAKE_CASE							(		lowerCamelCase  ):

					def      lowercase_							(    self ):







						'''simple docstring'''




						lowerCamelCase_							:		int							       =							Hasher.hash('hello' )
						lowerCamelCase_							:		List[Any]							       =							Hasher.hash('hello' )
						lowerCamelCase_							:		List[str]							       =							Hasher.hash('there' )
						self.assertEqual(__lowercase			,	__lowercase )
						self.assertNotEqual(__lowercase			,	__lowercase )

					def      lowercase_							(    self ):







						'''simple docstring'''




						lowerCamelCase_							:		Any							       =							Hasher.hash(Foo('hello' ) )
						lowerCamelCase_							:		List[Any]							       =							Hasher.hash(Foo('hello' ) )
						lowerCamelCase_							:		Tuple							       =							Hasher.hash(Foo('there' ) )
						self.assertEqual(__lowercase			,	__lowercase )
						self.assertNotEqual(__lowercase			,	__lowercase )

					def      lowercase_							(    self ):







						'''simple docstring'''




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

					def      lowercase_							(    self ):







						'''simple docstring'''




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

					def      lowercase_							(    self ):







						'''simple docstring'''




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

					@require_tiktoken
					def      lowercase_							(    self ):







						'''simple docstring'''




						import tiktoken

						lowerCamelCase_							:		List[Any]							       =							tiktoken.get_encoding('gpt2' )
						lowerCamelCase_							:		List[Any]							       =							mda(datasets.utils.py_utils.dumps(__lowercase ) ).hexdigest()
						lowerCamelCase_							:		Tuple							       =							tiktoken.get_encoding('r50k_base' )
						lowerCamelCase_							:		Any							       =							mda(datasets.utils.py_utils.dumps(__lowercase ) ).hexdigest()
						lowerCamelCase_							:		Optional[int]							       =							tiktoken.get_encoding('gpt2' )
						lowerCamelCase_							:		int							       =							mda(datasets.utils.py_utils.dumps(__lowercase ) ).hexdigest()
						self.assertEqual(__lowercase			,	__lowercase )
						self.assertNotEqual(__lowercase			,	__lowercase )

					@require_torch
					def      lowercase_							(    self ):







						'''simple docstring'''




						import torch

						lowerCamelCase_							:		int							       =							torch.tensor([1.0] )
						lowerCamelCase_							:		Dict							       =							mda(datasets.utils.py_utils.dumps(__lowercase ) ).hexdigest()
						lowerCamelCase_							:		Dict							       =							torch.tensor([2.0] )
						lowerCamelCase_							:		List[str]							       =							mda(datasets.utils.py_utils.dumps(__lowercase ) ).hexdigest()
						lowerCamelCase_							:		Any							       =							torch.tensor([1.0] )
						lowerCamelCase_							:		List[Any]							       =							mda(datasets.utils.py_utils.dumps(__lowercase ) ).hexdigest()
						self.assertEqual(__lowercase			,	__lowercase )
						self.assertNotEqual(__lowercase			,	__lowercase )





					@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

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






@pytest.mark.integration
def  snake_case (							A      )							->							Optional[int]:




	'''simple docstring'''


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






def  snake_case (							)							->							Any:




	'''simple docstring'''


	lowerCamelCase_							:		Any							       =							{'a': [0, 1, 2]}
	lowerCamelCase_							:		Dict							       =							DatasetChild(InMemoryTable.from_pydict(A      )      )
	lowerCamelCase_							:		int							       =							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  snake_case (							)							->							Any:




	'''simple docstring'''


	lowerCamelCase_							:		int							       =							{'a': [0, 1, 2]}


	class     __SCREAMING_SNAKE_CASE							(		datasets.Dataset  ):

						@fingerprint_transform(inplace=__lowercase )
						def      lowercase_							(    self			,	__lowercase ):







							'''simple docstring'''




							return DummyDatasetChild(self.data			,	fingerprint=__lowercase )
	lowerCamelCase_							:		Optional[Any]							       =							DummyDatasetChild(InMemoryTable.from_pydict(A      )      ).func()


	class     __SCREAMING_SNAKE_CASE							(		datasets.Dataset  ):

						@fingerprint_transform(inplace=__lowercase			,	version='1.0.0' )
						def      lowercase_							(    self			,	__lowercase ):







							'''simple docstring'''




							return DummyDatasetChild(self.data			,	fingerprint=__lowercase )
	lowerCamelCase_							:		Any							       =							DummyDatasetChild(InMemoryTable.from_pydict(A      )      ).func()


	class     __SCREAMING_SNAKE_CASE							(		datasets.Dataset  ):

						@fingerprint_transform(inplace=__lowercase			,	version='2.0.0' )
						def      lowercase_							(    self			,	__lowercase ):







							'''simple docstring'''




							return DummyDatasetChild(self.data			,	fingerprint=__lowercase )
	lowerCamelCase_							:		Any							       =							DummyDatasetChild(InMemoryTable.from_pydict(A      )      ).func()

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






def  snake_case (							)							->							List[Any]:




	'''simple docstring'''


	lowerCamelCase_							:		Tuple							       =							Hasher()
	hasher.update(lambda A      : x      )






UpperCamelCase__		=						{
    "kilogram": 1,
    "gram": pow(1_0, 3),
    "milligram": pow(1_0, 6),
    "metric-ton": pow(1_0, -3),
    "long-ton": 0.0_009_842_073,
    "short-ton": 0.0_011_023_122,
    "pound": 2.2_046_244_202,
    "stone": 0.1_574_731_728,
    "ounce": 35.273_990_723,
    "carrat": 5_0_0_0,
    "atomic-mass-unit": 6.022136652e26,
}

UpperCamelCase__		=						{
    "kilogram": 1,
    "gram": pow(1_0, -3),
    "milligram": pow(1_0, -6),
    "metric-ton": pow(1_0, 3),
    "long-ton": 1_016.04_608,
    "short-ton": 907.184,
    "pound": 0.453_592,
    "stone": 6.35_029,
    "ounce": 0.0_283_495,
    "carrat": 0.0_002,
    "atomic-mass-unit": 1.660540199e-27,
}






def  snake_case (							A						,       A						,       A      )							->							float:




	'''simple docstring'''


	if to_type not in KILOGRAM_CHART or from_type not in WEIGHT_TYPE_CHART:
		lowerCamelCase_							:		Union[str, Any]							       =							(
		    f"Invalid 'from_type' or 'to_type' value: {from_type!r}, {to_type!r}\n"
		    f"Supported values are: {', '.join(A      )}"
		)
		raise ValueError(A      )
	return value * KILOGRAM_CHART[to_type] * WEIGHT_TYPE_CHART[from_type]


if __name__ == "__main__":
							import doctest

							doctest.testmod()
