


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'''







   a_				:							Optional[datasets.Features]    = None



class 							_UpperCamelCase (						datasets.ArrowBasedBuilder						):

   '''simple docstring'''







   a_				:							Optional[Any]    = PandasConfig

   def   _snake_case    (  self  : List[str]							):






         '''simple docstring'''



         return datasets.DatasetInfo(features=self.config.features							)

   def   _snake_case    (  self  : Optional[Any]       ,  _lowerCamelCase  : Any							):






         '''simple docstring'''



         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}"""							)
         __lowerCamelCase     :      List[Any]       						=						dl_manager.download_and_extract(self.config.data_files							)
         if isinstance(_lowerCamelCase       ,  (str, list, tuple)							):
               __lowerCamelCase     :      Dict       						=						data_files
               if isinstance(_lowerCamelCase       ,  _lowerCamelCase							):
                     __lowerCamelCase     :      Dict       						=						[files]
               # Use `dl_manager.iter_files` to skip hidden files in an extracted archive
               __lowerCamelCase     :      Optional[int]       						=						[dl_manager.iter_files(_lowerCamelCase							) for file in files]
               return [datasets.SplitGenerator(name=datasets.Split.TRAIN       ,  gen_kwargs={"""files""": files}							)]
         __lowerCamelCase     :      Optional[int]       						=						[]
         for split_name, files in data_files.items():
               if isinstance(_lowerCamelCase       ,  _lowerCamelCase							):
                     __lowerCamelCase     :      Optional[Any]       						=						[files]
               # Use `dl_manager.iter_files` to skip hidden files in an extracted archive
               __lowerCamelCase     :      int       						=						[dl_manager.iter_files(_lowerCamelCase							) for file in files]
               splits.append(datasets.SplitGenerator(name=_lowerCamelCase       ,  gen_kwargs={"""files""": files}							)							)
         return splits

   def   _snake_case    (  self  : List[str]       ,  _lowerCamelCase  : pa.Table							):






         '''simple docstring'''



         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
               __lowerCamelCase     :      Optional[Any]       						=						table_cast(_lowerCamelCase       ,  self.config.features.arrow_schema							)
         return pa_table


   def   _snake_case    (  self  : Dict       ,  _lowerCamelCase  : Tuple							):






         '''simple docstring'''



         for i, file in enumerate(itertools.chain.from_iterable(_lowerCamelCase							)							):
               with open(_lowerCamelCase       ,  """rb"""							) as f:
                     __lowerCamelCase     :      Optional[Any]       						=						pa.Table.from_pandas(pd.read_pickle(_lowerCamelCase							)							)
                     yield i, self._cast_table(_lowerCamelCase							)







def   _UpperCAmelCase       (     ):
      """simple docstring"""




      __lowerCamelCase     :      Optional[int]       						=						[31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]

      __lowerCamelCase     :      str       						=						6
      __lowerCamelCase     :      Optional[int]       						=						1
      __lowerCamelCase     :      Optional[int]       						=						1_901

      __lowerCamelCase     :      Optional[Any]       						=						0

      while year < 2_001:
            day += 7

            if (year % 4 == 0 and year % 100 != 0) or (year % 400 == 0):
                  if day > days_per_month[month - 1] and month != 2:
                        month += 1
                        __lowerCamelCase     :      Tuple       						=						day - days_per_month[month - 2]
                  elif day > 29 and month == 2:
                        month += 1
                        __lowerCamelCase     :      str       						=						day - 29
            else:
                  if day > days_per_month[month - 1]:
                        month += 1
                        __lowerCamelCase     :      Any       						=						day - days_per_month[month - 2]

            if month > 12:
                  year += 1
                  __lowerCamelCase     :      Optional[Any]       						=						1

            if year < 2_001 and day == 1:
                  sundays += 1
      return sundays


if __name__ == "__main__":
    print(solution())



