





from __future__ import annotations

from typing import Any



class       A__     :





      def __init__(				self ,							A_ = 6     ):
       '''simple docstring'''




       UpperCamelCase			:      Node | None 			=     None
       UpperCamelCase			:      Node | None 			=     None
       self.create_linked_list(A_     )





      def  __UpperCamelCase(				self ,							A_     ):
       '''simple docstring'''




       UpperCamelCase			:      Tuple 			=     Node()
       UpperCamelCase			:      str 			=     current_node
       UpperCamelCase			:      str 			=     current_node
       UpperCamelCase			:      Dict 			=     current_node
       for _ in range(1 ,							A_     ):
        UpperCamelCase			:      str 			=     Node()
        UpperCamelCase			:      Union[str, Any] 			=     current_node
        UpperCamelCase			:      str 			=     previous_node
        UpperCamelCase			:      Optional[Any] 			=     current_node
       UpperCamelCase			:      int 			=     self.front
       UpperCamelCase			:      List[Any] 			=     previous_node





      def  __UpperCamelCase(				self     ):
       '''simple docstring'''




       return (
           self.front == self.rear
           and self.front is not None
           and self.front.data is None
       )





      def  __UpperCamelCase(				self     ):
       '''simple docstring'''




       self.check_can_perform_operation()
       return self.front.data if self.front else None





      def  __UpperCamelCase(				self ,							A_     ):
       '''simple docstring'''




       if self.rear is None:
        return

       self.check_is_full()
       if not self.is_empty():
        UpperCamelCase			:      List[str] 			=     self.rear.next
       if self.rear:
        UpperCamelCase			:      Dict 			=     data





      def  __UpperCamelCase(				self     ):
       '''simple docstring'''




       self.check_can_perform_operation()
       if self.rear is None or self.front is None:
        return None
       if self.front == self.rear:
        UpperCamelCase			:      Union[str, Any] 			=     self.front.data
        UpperCamelCase			:      Any 			=     None
        return data

       UpperCamelCase			:      str 			=     self.front
       UpperCamelCase			:      List[Any] 			=     old_front.next
       UpperCamelCase			:      Any 			=     old_front.data
       UpperCamelCase			:      str 			=     None
       return data





      def  __UpperCamelCase(				self     ):
       '''simple docstring'''




       if self.is_empty():
        raise Exception("Empty Queue"     )





      def  __UpperCamelCase(				self     ):
       '''simple docstring'''




       if self.rear and self.rear.next == self.front:
        raise Exception("Full Queue"     )



class       A__     :





      def __init__(				self     ):
       '''simple docstring'''




       UpperCamelCase			:      Any | None 			=     None
       UpperCamelCase			:      Node | None 			=     None
       UpperCamelCase			:      Node | None 			=     None


if __name__ == "__main__":
    import doctest

    doctest.testmod()







from typing import Callable, Optional

from .. import Features
from ..packaged_modules.generator.generator import Generator
from .abc import AbstractDatasetInputStream



class       A__     ( __snake_case    ):





      def __init__(				self ,							A_ ,							A_ = None ,							A_ = None ,							A_ = False ,							A_ = False ,							A_ = None ,							A_ = None ,							**A_ ,							):
       '''simple docstring'''




       super().__init__(
           features=A_ ,							cache_dir=A_ ,							keep_in_memory=A_ ,							streaming=A_ ,							num_proc=A_ ,							**A_ ,							)
       UpperCamelCase			:      Optional[int] 			=     Generator(
           cache_dir=A_ ,							features=A_ ,							generator=A_ ,							gen_kwargs=A_ ,							**A_ ,							)





      def  __UpperCamelCase(				self     ):
       '''simple docstring'''




       if self.streaming:
        UpperCamelCase			:      Optional[Any] 			=     self.builder.as_streaming_dataset(split="train"     )
       # Build regular (map-style) dataset
       else:
        UpperCamelCase			:      Union[str, Any] 			=     None
        UpperCamelCase			:      Union[str, Any] 			=     None
        UpperCamelCase			:      List[Any] 			=     None
        UpperCamelCase			:      List[str] 			=     None

        self.builder.download_and_prepare(
            download_config=A_ ,							download_mode=A_ ,							verification_mode=A_ ,							base_path=A_ ,							num_proc=self.num_proc ,							)
        UpperCamelCase			:      int 			=     self.builder.as_dataset(
            split="train" ,							verification_mode=A_ ,							in_memory=self.keep_in_memory     )
       return dataset
