"""simple docstring"""






import itertools
from dataclasses import dataclass
from typing import Optional

import pandas as pd
import pyarrow as pa

import datasets
from datasets.table import table_cast


@dataclass
class     UpperCAmelCase						(datasets.BuilderConfig  ):



    """simple docstring"""

    _UpperCAmelCase	:Optional[datasets.Features]						    = None



class     UpperCAmelCase						(datasets.ArrowBasedBuilder  ):



    """simple docstring"""

    _UpperCAmelCase	:Optional[Any]						    = PandasConfig






    def _snake_case			(   self							):
       return datasets.DatasetInfo(features=self.config.features							)






    def _snake_case			(   self    ,			_UpperCAmelCase							):
       if not self.config.data_files:
          raise ValueError(F"""At least one data file must be specified, but got data_files={self.config.data_files}"""							)
       lowercase__:   Union[str, Any]					=      dl_manager.download_and_extract(self.config.data_files							)
       if isinstance(_UpperCAmelCase    ,			(str, list, tuple)							):
          lowercase__:   Tuple					=      data_files
          if isinstance(_UpperCAmelCase    ,			_UpperCAmelCase							):
             lowercase__:   Union[str, Any]					=      [files]
          # Use `dl_manager.iter_files` to skip hidden files in an extracted archive
          lowercase__:   Any					=      [dl_manager.iter_files(_UpperCAmelCase							) for file in files]
          return [datasets.SplitGenerator(name=datasets.Split.TRAIN    ,			gen_kwargs={'''files''': files}							)]
       lowercase__:   List[Any]					=      []
       for split_name, files in data_files.items():
          if isinstance(_UpperCAmelCase    ,			_UpperCAmelCase							):
             lowercase__:   List[str]					=      [files]
          # Use `dl_manager.iter_files` to skip hidden files in an extracted archive
          lowercase__:   int					=      [dl_manager.iter_files(_UpperCAmelCase							) for file in files]
          splits.append(datasets.SplitGenerator(name=_UpperCAmelCase    ,			gen_kwargs={'''files''': files}							)							)
       return splits






    def _snake_case			(   self    ,			_UpperCAmelCase							):
       if self.config.features is not None:
          # more expensive cast to support nested features with keys in a different order
          # allows str <-> int/float or str to Audio for example
          lowercase__:   List[str]					=      table_cast(_UpperCAmelCase    ,			self.config.features.arrow_schema							)
       return pa_table






    def _snake_case			(   self    ,			_UpperCAmelCase							):
       for i, file in enumerate(itertools.chain.from_iterable(_UpperCAmelCase							)							):
          with open(_UpperCAmelCase    ,			'''rb'''							) as f:
             lowercase__:   Optional[Any]					=      pa.Table.from_pandas(pd.read_pickle(_UpperCAmelCase							)							)
             yield i, self._cast_table(_UpperCAmelCase							)

"""simple docstring"""






from __future__ import annotations

from math import pi, sqrt



def SCREAMING_SNAKE_CASE__			(   __UpperCAmelCase       ,    __UpperCAmelCase )  ->  tuple:

   if inductance <= 0:
      raise ValueError('''Inductance cannot be 0 or negative''' )

   elif capacitance <= 0:
      raise ValueError('''Capacitance cannot be 0 or negative''' )

   else:
      return (
          "Resonant frequency",
          float(1 / (2 * pi * (sqrt(inductance * capacitance ))) ),
      )


if __name__ == "__main__":
       import doctest

       doctest.testmod()
