




from unittest import TestCase

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


class 				UpperCamelCase_    ( UpperCAmelCase__     ):

    '''simple docstring'''






    def        SCREAMING_SNAKE_CASE							(			self      :	Dict)						->Union[str, Any]:





           '''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        SCREAMING_SNAKE_CASE							(			self      :	Any)						->Union[str, Any]:





           '''simple docstring'''

           A__       =    {"""col_1""": [3, 2, 1, 0], """col_2""": ["""a""", """b""", """c""", """d"""]}
           return Dataset.from_dict(_SCREAMING_SNAKE_CASE)


    def        SCREAMING_SNAKE_CASE							(			self      :	Optional[Any])						->Dict:





           '''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        SCREAMING_SNAKE_CASE							(			self      :	Union[str, Any])						->Union[str, 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        SCREAMING_SNAKE_CASE							(			self      :	Any)						->Optional[Any]:  # 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        SCREAMING_SNAKE_CASE							(			self      :	List[str])						->Tuple:  # 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        SCREAMING_SNAKE_CASE							(			self      :	Any)						->Optional[int]:





           '''simple docstring'''

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







"""simple docstring"""
from __future__ import annotations



class       SCREAMING_SNAKE_CASE__  :

   def __init__(   self      ,     _SCREAMING_SNAKE_CASE						)  ->      None:





    '''simple docstring'''




    UpperCAmelCase	:					Any	=	data
    UpperCAmelCase	:					Node | None	=	None
    UpperCAmelCase	:					Node | None	=	None

def       _snake_case						(						UpperCamelCase						:		Node | None						):  # In Order traversal of the tree
 if tree:
  display(tree.left						)
  print(tree.data						)
  display(tree.right						)

def       _snake_case						(						UpperCamelCase						:		Node | None						):
 return 1 + max(depth_of_tree(tree.left						)			,		depth_of_tree(tree.right						)						) if tree else 0

def       _snake_case						(						UpperCamelCase						:		Node						):
 if not tree:
  return True
 if tree.left and tree.right:
  return is_full_binary_tree(tree.left						) and is_full_binary_tree(tree.right						)
 else:
  return not tree.left and not tree.right

def       _snake_case						(						):  # Main function for testing.
 UpperCAmelCase	:					int	=	Node(1						)
 UpperCAmelCase	:					Tuple	=	Node(2						)
 UpperCAmelCase	:					Any	=	Node(3						)
 UpperCAmelCase	:					Optional[int]	=	Node(4						)
 UpperCAmelCase	:					Any	=	Node(5						)
 UpperCAmelCase	:					Optional[int]	=	Node(6						)
 UpperCAmelCase	:					int	=	Node(7						)
 UpperCAmelCase	:					str	=	Node(8						)
 UpperCAmelCase	:					str	=	Node(9						)

 print(is_full_binary_tree(UpperCamelCase						)						)
 print(depth_of_tree(UpperCamelCase						)						)
 print("""Tree is: """						)
 display(UpperCamelCase						)


if __name__ == "__main__":
      main()
