
from io import BytesIO
from typing import List, Union

import requests

from ..utils import add_end_docstrings, is_decord_available, is_torch_available, logging, requires_backends
from .base import PIPELINE_INIT_ARGS, Pipeline


if is_decord_available():
  import numpy as np
  from decord import VideoReader


if is_torch_available():
  from ..models.auto.modeling_auto import MODEL_FOR_VIDEO_CLASSIFICATION_MAPPING

lowercase  : Optional[Any]						   =						logging.get_logger(__name__)

@add_end_docstrings(lowerCAmelCase					)
class __snake_case		(				lowerCAmelCase					):
    def __init__(  self		,*snake_case		,**snake_case				):



           '''simple docstring'''







           super().__init__(*snake_case		,**snake_case				)
           requires_backends(self		,"""decord"""				)
           self.check_model_type(snake_case				)
    def 				_SCREAMING_SNAKE_CASE	(  self		,snake_case=None		,snake_case=None		,snake_case=None				):



           '''simple docstring'''







           lowercase							:					List[Any]	     =				{}
           if frame_sampling_rate is not None:
                  lowercase							:					Optional[int]	     =				frame_sampling_rate
           if num_frames is not None:
                  lowercase							:					Dict	     =				num_frames

           lowercase							:					int	     =				{}
           if top_k is not None:
                  lowercase							:					int	     =				top_k
           return preprocess_params, {}, postprocess_params
    def __call__(  self		,snake_case		,**snake_case				):



           '''simple docstring'''







           return super().__call__(snake_case		,**snake_case				)
    def 				_SCREAMING_SNAKE_CASE	(  self		,snake_case		,snake_case=None		,snake_case=1				):



           '''simple docstring'''







           if num_frames is None:
                  lowercase							:					Union[str, Any]	     =				self.model.config.num_frames

           if video.startswith("""http://"""				) or video.startswith("""https://"""				):
                  lowercase							:					List[Any]	     =				BytesIO(requests.get(snake_case				).content				)

           lowercase							:					str	     =				VideoReader(snake_case				)
           videoreader.seek(0				)

           lowercase							:					Any	     =				0
           lowercase							:					str	     =				num_frames * frame_sampling_rate - 1
           lowercase							:					Optional[Any]	     =				np.linspace(snake_case		,snake_case		,num=snake_case		,dtype=np.intaa				)

           lowercase							:					Optional[Any]	     =				videoreader.get_batch(snake_case				).asnumpy()
           lowercase							:					Union[str, Any]	     =				list(snake_case				)

           lowercase							:					List[str]	     =				self.image_processor(snake_case		,return_tensors=self.framework				)
           return model_inputs
    def 				_SCREAMING_SNAKE_CASE	(  self		,snake_case				):



           '''simple docstring'''







           lowercase							:					Optional[int]	     =				self.model(**snake_case				)
           return model_outputs
    def 				_SCREAMING_SNAKE_CASE	(  self		,snake_case		,snake_case=5				):



           '''simple docstring'''







           if top_k > self.model.config.num_labels:
                  lowercase							:					Union[str, Any]	     =				self.model.config.num_labels

           if self.framework == "pt":
                  lowercase							:					Tuple	     =				model_outputs.logits.softmax(-1				)[0]
                  lowercase							:					Tuple	     =				probs.topk(snake_case				)
           else:
                  raise ValueError(f"Unsupported framework: {self.framework}"				)

           lowercase							:					Dict	     =				scores.tolist()
           lowercase							:					List[Any]	     =				ids.tolist()
           return [{"score": score, "label": self.model.config.idalabel[_id]} for score, _id in zip(snake_case		,snake_case				)]


import math
from datetime import datetime, timedelta







def 						_snake_case(  SCREAMING_SNAKE_CASE__    )			->   datetime:
       lowercase							:					Any	     =				year % 19
       lowercase							:					Optional[int]	     =				year % 4
       lowercase							:					Any	     =				year % 7
       lowercase							:					str	     =				math.floor(year / 100    )
       lowercase							:					List[str]	     =				math.floor((13 + 8 * leap_day_inhibits) / 25    )
       lowercase							:					Tuple	     =				leap_day_inhibits / 4
       lowercase							:					Any	     =				(
           15 - lunar_orbit_correction + leap_day_inhibits - leap_day_reinstall_number
       ) % 30
       lowercase							:					Union[str, Any]	     =				(4 + leap_day_inhibits - leap_day_reinstall_number) % 7

       # days to be added to March 21
       lowercase							:					str	     =				(19 * metonic_cycle + secular_moon_shift) % 30

       # PHM -> Paschal Full Moon
       lowercase							:					List[Any]	     =				(
           2 * julian_leap_year
           + 4 * non_leap_year
           + 6 * days_to_add
           + century_starting_point
       ) % 7

       if days_to_add == 29 and days_from_phm_to_sunday == 6:
              return datetime(SCREAMING_SNAKE_CASE__ ,     4 ,     19    )
       elif days_to_add == 28 and days_from_phm_to_sunday == 6:
              return datetime(SCREAMING_SNAKE_CASE__ ,     4 ,     18    )
       else:
              return datetime(SCREAMING_SNAKE_CASE__ ,     3 ,     22    ) + timedelta(
                  days=int(days_to_add + days_from_phm_to_sunday    )    )


if __name__ == "__main__":
  for year in (1994, 2000, 2010, 2021, 2023):
    lowercase  : List[str]						   =							"""will be""" if year > datetime.now().year else """was"""
    print(F'''Easter in {year} {tense} {gauss_easter(year)}''')
