




import textwrap

import pyarrow as pa
import pytest

from datasets import Features, Value
from datasets.packaged_modules.json.json import Json




@pytest.fixture
def 		A_	(							snake_case							:				Optional[Any]	) ->      Tuple:



						'''simple docstring'''

						__UpperCamelCase       					=     tmp_path / '''file.jsonl'''
						__UpperCamelCase       					=     textwrap.dedent(
						    '''\
        {"col_1": -1}
        {"col_1": 1, "col_2": 2}
        {"col_1": 10, "col_2": 20}
        '''	)
						with open(snake_case	, '''w'''	) as f:
												f.write(snake_case	)
						return str(snake_case	)




@pytest.fixture
def 		A_	(							snake_case							:				str	) ->      str:



						'''simple docstring'''

						__UpperCamelCase       					=     tmp_path / '''file_utf16_encoded.jsonl'''
						__UpperCamelCase       					=     textwrap.dedent(
						    '''\
        {"col_1": -1}
        {"col_1": 1, "col_2": 2}
        {"col_1": 10, "col_2": 20}
        '''	)
						with open(snake_case	, '''w'''	, encoding='''utf-16'''	) as f:
												f.write(snake_case	)
						return str(snake_case	)




@pytest.fixture
def 		A_	(							snake_case							:				Optional[int]	) ->      List[str]:



						'''simple docstring'''

						__UpperCamelCase       					=     tmp_path / '''file_with_list_of_dicts.json'''
						__UpperCamelCase       					=     textwrap.dedent(
						    '''\
        [
            {"col_1": -1},
            {"col_1": 1, "col_2": 2},
            {"col_1": 10, "col_2": 20}
        ]
        '''	)
						with open(snake_case	, '''w'''	) as f:
												f.write(snake_case	)
						return str(snake_case	)




@pytest.fixture
def 		A_	(							snake_case							:				List[str]	) ->      Union[str, Any]:



						'''simple docstring'''

						__UpperCamelCase       					=     tmp_path / '''file_with_list_of_dicts_field.json'''
						__UpperCamelCase       					=     textwrap.dedent(
						    '''\
        {
            "field1": 1,
            "field2": "aabb",
            "field3": [
                {"col_1": -1},
                {"col_1": 1, "col_2": 2},
                {"col_1": 10, "col_2": 20}
            ]
        }
        '''	)
						with open(snake_case	, '''w'''	) as f:
												f.write(snake_case	)
						return str(snake_case	)




@pytest.mark.parametrize(
    '''file_fixture, config_kwargs'''	, [
        ('''jsonl_file''', {}),
        ('''jsonl_file_utf16_encoded''', {'''encoding''': '''utf-16'''}),
        ('''json_file_with_list_of_dicts''', {}),
        ('''json_file_with_list_of_dicts_field''', {'''field''': '''field3'''}),
    ]	, )
def 		A_	(							snake_case							:				Dict	, snake_case							:				List[Any]	, snake_case							:				Union[str, Any]	) ->      Tuple:



						'''simple docstring'''

						__UpperCamelCase       					=     Json(**snake_case	)
						__UpperCamelCase       					=     json._generate_tables([[request.getfixturevalue(snake_case	)]]	)
						__UpperCamelCase       					=     pa.concat_tables([table for _, table in generator]	)
						assert pa_table.to_pydict() == {"col_1": [-1, 1, 10], "col_2": [None, 2, 20]}




@pytest.mark.parametrize(
    '''file_fixture, config_kwargs'''	, [
        (
            '''jsonl_file''',
            {'''features''': Features({'''col_1''': Value('''int64'''	), '''col_2''': Value('''int64'''	), '''missing_col''': Value('''string'''	)}	)},
        ),
        (
            '''json_file_with_list_of_dicts''',
            {'''features''': Features({'''col_1''': Value('''int64'''	), '''col_2''': Value('''int64'''	), '''missing_col''': Value('''string'''	)}	)},
        ),
        (
            '''json_file_with_list_of_dicts_field''',
            {
                '''field''': '''field3''',
                '''features''': Features(
                    {'''col_1''': Value('''int64'''	), '''col_2''': Value('''int64'''	), '''missing_col''': Value('''string'''	)}	),
            },
        ),
    ]	, )
def 		A_	(							snake_case							:				str	, snake_case							:				int	, snake_case							:				Any	) ->      Any:



						'''simple docstring'''

						__UpperCamelCase       					=     Json(**snake_case	)
						__UpperCamelCase       					=     json._generate_tables([[request.getfixturevalue(snake_case	)]]	)
						__UpperCamelCase       					=     pa.concat_tables([table for _, table in generator]	)
						assert pa_table.to_pydict() == {"col_1": [-1, 1, 10], "col_2": [None, 2, 20], "missing_col": [None, None, None]}






def 		A_	(							snake_case							:				Union[str, Any]	, snake_case							:				Tuple	, snake_case							:				Optional[Any]	) ->      Union[str, Any]:



						'''simple docstring'''

						assert b != 0, "This cannot accept modulo that is == 0"
						if n == 0:
												return 1

						if n % 2 == 1:
												return (bin_exp_mod(snake_case	, n - 1	, snake_case	) * a) % b

						__UpperCamelCase       					=     bin_exp_mod(snake_case	, n / 2	, snake_case	)
						return (r * r) % b


if __name__ == "__main__":
				try:
								lowercase__							:							Dict													=     int(input("Enter Base : ").strip())
								lowercase__							:							Dict													=     int(input("Enter Power : ").strip())
								lowercase__							:							Dict													=     int(input("Enter Modulo : ").strip())
				except ValueError:
								print("Invalid literal for integer")

				print(bin_exp_mod(BASE, POWER, MODULO))




