'''simple docstring'''

class 				_lowercase     :


 '''simple docstring'''






 def __init__(      self   :	Optional[Any]      ,       SCREAMING_SNAKE_CASE__   :	int							)  ->    Any:
  __lowerCAmelCase											=						n
  __lowerCAmelCase											=						[None] * self.n
  __lowerCAmelCase											=						0  # index of the first element
  __lowerCAmelCase											=						0
  __lowerCAmelCase											=						0
 def __len__(      self   :	Union[str, Any]							)  ->    int:
  return self.size
 def a					(      self   :	str							)  ->    bool:
  return self.size == 0
 def a					(      self   :	List[Any]							)  ->    Optional[int]:
  return False if self.is_empty() else self.array[self.front]
 def a					(      self   :	List[str]      ,       SCREAMING_SNAKE_CASE__   :	Optional[Any]							)  ->    Optional[Any]:
  if self.size >= self.n:
   raise Exception("""QUEUE IS FULL"""							)

  __lowerCAmelCase											=						data
  __lowerCAmelCase											=						(self.rear + 1) % self.n
  self.size += 1
  return self





 def a					(      self   :	int							)  ->    Dict:
  if self.size == 0:
   raise Exception("""UNDERFLOW"""							)

  __lowerCAmelCase											=						self.array[self.front]
  __lowerCAmelCase											=						None
  __lowerCAmelCase											=						(self.front + 1) % self.n
  self.size -= 1
  return temp







'''simple docstring'''

from unittest import TestCase

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







class 				_lowercase     (				UpperCAmelCase__			):


 '''simple docstring'''






 def a					(      self   :	int							)  ->    Optional[Any]:
  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 a					(      self   :	List[Any]							)  ->    Any:
  __lowerCAmelCase											=						{"""col_1""": [3, 2, 1, 0], """col_2""": ["""a""", """b""", """c""", """d"""]}
  return Dataset.from_dict(SCREAMING_SNAKE_CASE__							)
 def a					(      self   :	List[Any]							)  ->    Tuple:
  __lowerCAmelCase											=						self._create_example_records()
  __lowerCAmelCase											=						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 a					(      self   :	Tuple							)  ->    List[str]:
  __lowerCAmelCase											=						self._create_example_records()
  __lowerCAmelCase											=						Dataset.from_list(SCREAMING_SNAKE_CASE__							)
  __lowerCAmelCase											=						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 a					(      self   :	List[str]							)  ->    List[str]:  # checks what happens with missing columns
  __lowerCAmelCase											=						[{"""col_1""": 1}, {"""col_2""": """x"""}]
  __lowerCAmelCase											=						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 a					(      self   :	Dict							)  ->    Optional[int]:  # checks if the type can be inferred from the second record
  __lowerCAmelCase											=						[{"""col_1""": []}, {"""col_1""": [1, 2]}]
  __lowerCAmelCase											=						Dataset.from_list(SCREAMING_SNAKE_CASE__							)
  self.assertEqual(dset.info.features["""col_1"""]      ,       Sequence(Value("""int64"""							)							)							)





 def a					(      self   :	Optional[Any]							)  ->    Tuple:
  __lowerCAmelCase											=						Dataset.from_list([]							)
  self.assertEqual(len(SCREAMING_SNAKE_CASE__							)      ,       0							)
  self.assertListEqual(dset.column_names      ,       []							)






