



import textwrap

import pyarrow as pa
import pytest

from datasets import Features, Value
from datasets.packaged_modules.json.json import Json
@pytest.fixture
def 						snake_case__							(       __lowercase							)		->		Optional[Any]:







						"""simple docstring"""

						A__						:				Any         =			tmp_path / "file.jsonl"
						A__						:				List[str]         =			textwrap.dedent(
						    "\\n        {\"col_1\": -1}\n        {\"col_1\": 1, \"col_2\": 2}\n        {\"col_1\": 10, \"col_2\": 20}\n        "							)
						with open(snake_case_				,  "w"							) as f:
												f.write(snake_case_							)
						return str(snake_case_							)
@pytest.fixture
def 						snake_case__							(       __lowercase							)		->		str:







						"""simple docstring"""

						A__						:				Dict         =			tmp_path / "file_utf16_encoded.jsonl"
						A__						:				Union[str, Any]         =			textwrap.dedent(
						    "\\n        {\"col_1\": -1}\n        {\"col_1\": 1, \"col_2\": 2}\n        {\"col_1\": 10, \"col_2\": 20}\n        "							)
						with open(snake_case_				,  "w"				,  encoding="utf-16"							) as f:
												f.write(snake_case_							)
						return str(snake_case_							)
@pytest.fixture
def 						snake_case__							(       __lowercase							)		->		Optional[int]:







						"""simple docstring"""

						A__						:				Tuple         =			tmp_path / "file_with_list_of_dicts.json"
						A__						:				Optional[Any]         =			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(snake_case_				,  "w"							) as f:
												f.write(snake_case_							)
						return str(snake_case_							)
@pytest.fixture
def 						snake_case__							(       __lowercase							)		->		Any:







						"""simple docstring"""

						A__						:				int         =			tmp_path / "file_with_list_of_dicts_field.json"
						A__						:				str         =			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(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 						snake_case__							(       __lowercase				,  __lowercase				,  __lowercase							)		->		Union[str, Any]:







						"""simple docstring"""

						A__						:				Optional[Any]         =			Json(**snake_case_							)
						A__						:				Tuple         =			json._generate_tables([[request.getfixturevalue(snake_case_							)]]							)
						A__						:				Any         =			pa.concat_tables([table for _, table in generator]							)
						assert pa_table.to_pydict() == {"col_1": [-1, 1, 1_0], "col_2": [None, 2, 2_0]}




@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 						snake_case__							(       __lowercase				,  __lowercase				,  __lowercase							)		->		Optional[int]:







						"""simple docstring"""

						A__						:				Optional[Any]         =			Json(**snake_case_							)
						A__						:				Tuple         =			json._generate_tables([[request.getfixturevalue(snake_case_							)]]							)
						A__						:				Tuple         =			pa.concat_tables([table for _, table in generator]							)
						assert pa_table.to_pydict() == {"col_1": [-1, 1, 1_0], "col_2": [None, 2, 2_0], "missing_col": [None, None, None]}






from __future__ import annotations

from enum import Enum, unique
from typing import TypeVar

# Create a generic variable that can be 'Enum', or any subclass.
a_    :				List[str]					=			TypeVar('T', bound='Enum')



@unique
class  SCREAMING_SNAKE_CASE_  ( SCREAMING_SNAKE_CASE__			):


  """simple docstring"""





  _a								=							80
  _a								=							70
  _a								=							60
  _a								=							50
  _a								=							40
  _a								=							30
  _a								=							20
  _a								=							10



@unique
class  SCREAMING_SNAKE_CASE_  ( SCREAMING_SNAKE_CASE__			):


  """simple docstring"""





  _a								=							24
  _a								=							21
  _a								=							18
  _a								=							15
  _a								=							12
  _a								=							9
  _a								=							6
  _a								=							3
  _a								=							2
  _a								=							1
  _a								=							-1
  _a								=							-2
  _a								=							-3
  _a								=							-6
  _a								=							-9
  _a								=							-12
  _a								=							-15
  _a								=							-18
  _a								=							-21
  _a								=							-24





  @classmethod
  def 			__A      (  cls						)		->   dict:





       '''simple docstring'''







       return {unit.name: unit.value for unit in cls if unit.value > 0}







  @classmethod
  def 			__A      (  cls						)		->   dict:





       '''simple docstring'''







       return {unit.name: unit.value for unit in cls if unit.value < 0}




def   _SCREAMING_SNAKE_CASE      (	snake_case_		:						float						):
     __magic_name__				=       SIUnit.get_positive() if value > 0 else SIUnit.get_negative()
     for name_prefix, value_prefix in prefixes.items():
          __magic_name__				=       value / (10**value_prefix)
          if numerical_part > 1:
               return f'{numerical_part!s} {name_prefix}'
     return str(snake_case_						)




def   _SCREAMING_SNAKE_CASE      (	snake_case_		:						float						):
     for prefix in BinaryUnit:
          __magic_name__				=       value / (2**prefix.value)
          if numerical_part > 1:
               return f'{numerical_part!s} {prefix.name}'
     return str(snake_case_						)


if __name__ == "__main__":
    import doctest

    doctest.testmod()