
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						(  SCREAMING_SNAKE_CASE							):




			"""simple docstring"""


			UpperCAmelCase__		:List[str] 		=    tmp_path / 'file.jsonl'
			UpperCAmelCase__		:Optional[Any] 		=    textwrap.dedent(
			    '\\n        {"col_1": -1}\n        {"col_1": 1, "col_2": 2}\n        {"col_1": 10, "col_2": 20}\n        '							)
			with open(__lowerCamelCase     ,						'w'							) as f:
						f.write(__lowerCamelCase							)
			return str(__lowerCamelCase							)




@pytest.fixture
def 		A						(  SCREAMING_SNAKE_CASE							):




			"""simple docstring"""


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




@pytest.fixture
def 		A						(  SCREAMING_SNAKE_CASE							):




			"""simple docstring"""


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




@pytest.fixture
def 		A						(  SCREAMING_SNAKE_CASE							):




			"""simple docstring"""


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




@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						(  SCREAMING_SNAKE_CASE     ,						SCREAMING_SNAKE_CASE     ,						SCREAMING_SNAKE_CASE							):




			"""simple docstring"""


			UpperCAmelCase__		:Tuple 		=    Json(**__lowerCamelCase							)
			UpperCAmelCase__		:List[Any] 		=    json._generate_tables([[request.getfixturevalue(__lowerCamelCase							)]]							)
			UpperCAmelCase__		:Tuple 		=    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						(  SCREAMING_SNAKE_CASE     ,						SCREAMING_SNAKE_CASE     ,						SCREAMING_SNAKE_CASE							):




			"""simple docstring"""


			UpperCAmelCase__		:Optional[int] 		=    Json(**__lowerCamelCase							)
			UpperCAmelCase__		:Union[str, Any] 		=    json._generate_tables([[request.getfixturevalue(__lowerCamelCase							)]]							)
			UpperCAmelCase__		:List[str] 		=    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]}







from math import sqrt


def  A__ (       __lowerCamelCase						):
   SCREAMING_SNAKE_CASE_	=      [1]
   for i in range(2,  int(sqrt(__lowerCamelCase						)						) + 1,  1						):
      if number % i == 0:
         values.append(__lowerCamelCase						)
         if int(number // i						) != i:
            values.append(int(number // i						)						)
   return sorted(__lowerCamelCase						)


def  A__ (       __lowerCamelCase						):
   return sum(factors(__lowerCamelCase						)						) > n


def  A__ (       __lowerCamelCase						):
   SCREAMING_SNAKE_CASE_	=      factors(__lowerCamelCase						)
   SCREAMING_SNAKE_CASE_	=      len(__lowerCamelCase						)
   SCREAMING_SNAKE_CASE_	=      [[0 for i in range(number + 1						)] for j in range(r + 1						)]
   for i in range(r + 1						):
      SCREAMING_SNAKE_CASE_	=      True

   for i in range(1,  number + 1						):
      SCREAMING_SNAKE_CASE_	=      False

   for i in range(1,  r + 1						):
      for j in range(1,  number + 1						):
         if j < values[i - 1]:
            SCREAMING_SNAKE_CASE_	=      subset[i - 1][j]
         else:
            SCREAMING_SNAKE_CASE_	=      subset[i - 1][j] or subset[i - 1][j - values[i - 1]]

   return subset[r][number] != 0


def  A__ (       __lowerCamelCase						):
   return abundant(__lowerCamelCase						) and not semi_perfect(__lowerCamelCase						)


if __name__ == "__main__":
   import doctest

   doctest.testmod(verbose=True)
   for number in (69, 70, 71):
      print(F"""{number} is {'' if weird(number) else 'not '}weird.""")


