



from unittest import TestCase

from datasets import Sequence, Value
from datasets.arrow_dataset import Dataset

class 					_A (			__UpperCAmelCase					):



       def 	_lowerCamelCase    (	self							:  int):


           '''simple docstring'''

           return [
               {"col_1": 3, "col_2": "a"},
               {"col_1": 2, "col_2": "b"},
               {"col_1": 1, "col_2": "c"},
               {"col_1": 0, "col_2": "d"},
           ]



       def 	_lowerCamelCase    (	self							:  Tuple):


           '''simple docstring'''

           __a		 =       {'''col_1''': [3, 2, 1, 0], '''col_2''': ['''a''', '''b''', '''c''', '''d''']}
           return Dataset.from_dict(__SCREAMING_SNAKE_CASE)



       def 	_lowerCamelCase    (	self							:  Any):


           '''simple docstring'''

           __a		 =       self._create_example_records()
           __a		 =       Dataset.from_list(__SCREAMING_SNAKE_CASE)
           self.assertListEqual(dset.column_names  ,	['''col_1''', '''col_2'''])
           for i, r in enumerate(__SCREAMING_SNAKE_CASE):
               self.assertDictEqual(__SCREAMING_SNAKE_CASE  ,	example_records[i])



       def 	_lowerCamelCase    (	self							:  Optional[Any]):


           '''simple docstring'''

           __a		 =       self._create_example_records()
           __a		 =       Dataset.from_list(__SCREAMING_SNAKE_CASE)
           __a		 =       Dataset.from_dict({k: [r[k] for r in example_records] for k in example_records[0]})
           self.assertEqual(dset.info  ,	dset_from_dict.info)



       def 	_lowerCamelCase    (	self							:  int):  # checks what happens with missing columns


           '''simple docstring'''

           __a		 =       [{'''col_1''': 1}, {'''col_2''': '''x'''}]
           __a		 =       Dataset.from_list(__SCREAMING_SNAKE_CASE)
           self.assertDictEqual(dset[0]  ,	{'''col_1''': 1})
           self.assertDictEqual(dset[1]  ,	{'''col_1''': None})  # NB: first record is used for columns



       def 	_lowerCamelCase    (	self							:  Optional[Any]):  # checks if the type can be inferred from the second record


           '''simple docstring'''

           __a		 =       [{'''col_1''': []}, {'''col_1''': [1, 2]}]
           __a		 =       Dataset.from_list(__SCREAMING_SNAKE_CASE)
           self.assertEqual(dset.info.features['''col_1''']  ,	Sequence(Value('''int64''')))





       def 	_lowerCamelCase    (	self							:  List[Any]):


           '''simple docstring'''

           __a		 =       Dataset.from_list([])
           self.assertEqual(len(__SCREAMING_SNAKE_CASE)  ,	0)
           self.assertListEqual(dset.column_names  ,	[])










# Lint as: python3
import dataclasses
import re
from dataclasses import dataclass
from functools import total_ordering
from typing import Optional, Union


__snake_case		:List[str]   	=  re.compile(r'''^(?P<major>\d+)''' r'''\.(?P<minor>\d+)''' r'''\.(?P<patch>\d+)$''')

@total_ordering
@dataclass
class 					_A :
       UpperCamelCase__						:					str
       UpperCamelCase__						:					Optional[str]		      =		None
       UpperCamelCase__						:					Optional[Union[str, int]]		      =		None
       UpperCamelCase__						:					Optional[Union[str, int]]		      =		None
       UpperCamelCase__						:					Optional[Union[str, int]]		      =		None



       def 	_lowerCamelCase    (	self							:  Union[str, Any]):


           '''simple docstring'''

           __a ,     __a ,     __a		 =       _str_to_version_tuple(self.version_str)



       def __repr__(	self							:  Tuple):


           '''simple docstring'''

           return F'{self.tuple[0]}.{self.tuple[1]}.{self.tuple[2]}'



       @property
       def 	_lowerCamelCase    (	self							:  Optional[int]):


           '''simple docstring'''

           return self.major, self.minor, self.patch



       def 	_lowerCamelCase    (	self							:  Any  ,	__SCREAMING_SNAKE_CASE							:  Optional[int]):


           '''simple docstring'''

           if isinstance(__SCREAMING_SNAKE_CASE  ,	__SCREAMING_SNAKE_CASE):
               return Version(__SCREAMING_SNAKE_CASE)
           elif isinstance(__SCREAMING_SNAKE_CASE  ,	__SCREAMING_SNAKE_CASE):
               return other
           raise TypeError(F'{other} (type {type(__SCREAMING_SNAKE_CASE)}) cannot be compared to version.')



       def __eq__(	self							:  int  ,	__SCREAMING_SNAKE_CASE							:  Any):


           '''simple docstring'''

           try:
               __a		 =       self._validate_operand(__SCREAMING_SNAKE_CASE)
           except (TypeError, ValueError):
               return False
           else:
               return self.tuple == other.tuple



       def __lt__(	self							:  str  ,	__SCREAMING_SNAKE_CASE							:  Tuple):


           '''simple docstring'''

           __a		 =       self._validate_operand(__SCREAMING_SNAKE_CASE)
           return self.tuple < other.tuple



       def __hash__(	self							:  Optional[Any]):


           '''simple docstring'''

           return hash(_version_tuple_to_str(self.tuple))



       @classmethod
       def 	_lowerCamelCase    (	cls							:  List[str]  ,	__SCREAMING_SNAKE_CASE							:  Optional[Any]):


           '''simple docstring'''

           __a		 =       {f.name for f in dataclasses.fields(cls)}
           return cls(**{k: v for k, v in dic.items() if k in field_names})





       def 	_lowerCamelCase    (	self							:  int):


           '''simple docstring'''

           return self.version_str





def   __snake_case			(    _UpperCAmelCase       ):
    __a		 =       _VERSION_REG.match(_UpperCAmelCase       )
    if not res:
        raise ValueError(f'Invalid version \'{version_str}\'. Format should be x.y.z with {{x,y,z}} being digits.'       )
    return tuple(int(_UpperCAmelCase       ) for v in [res.group('''major'''       ), res.group('''minor'''       ), res.group('''patch'''       )]       )





def   __snake_case			(    _UpperCAmelCase       ):
    return ".".join(str(_UpperCAmelCase       ) for v in version_tuple       )





