






from collections import OrderedDict
from typing import TYPE_CHECKING, Any, Mapping, Optional, Union

from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig, OnnxSeqaSeqConfigWithPast
from ...utils import logging


if TYPE_CHECKING:
     from ...feature_extraction_utils import FeatureExtractionMixin
     from ...tokenization_utils_base import PreTrainedTokenizerBase
     from ...utils import TensorType

UpperCAmelCase__				   =		logging.get_logger(__name__)

UpperCAmelCase__				   =		{
    "openai/whisper-base": "https://huggingface.co/openai/whisper-base/resolve/main/config.json",
}

# fmt: off
UpperCAmelCase__				   =		[
    1, 2, 7, 8, 9, 10, 14, 25,
    26, 27, 28, 29, 31, 58, 59, 60, 61, 62,
    63, 90, 91, 92, 93, 357, 366, 438, 532, 685,
    705, 796, 930, 1058, 1220, 1267, 1279, 1303, 1343, 1377,
    1391, 1635, 1782, 1875, 2162, 2361, 2488, 3467, 4008, 4211,
    4600, 4808, 5299, 5855, 6329, 7203, 9609, 9959, 10563, 10786,
    11420, 11709, 11907, 13163, 13697, 13700, 14808, 15306, 16410, 16791,
    17992, 19203, 19510, 20724, 22305, 22935, 27007, 30109, 30420, 33409,
    34949, 40283, 40493, 40549, 47282, 49146, 50257, 50359, 50360, 50361
]
UpperCAmelCase__				   =		[
    1, 2, 7, 8, 9, 10, 14, 25,
    26, 27, 28, 29, 31, 58, 59, 60, 61, 62,
    63, 90, 91, 92, 93, 359, 503, 522, 542, 873,
    893, 902, 918, 922, 931, 1350, 1853, 1982, 2460, 2627,
    3246, 3253, 3268, 3536, 3846, 3961, 4183, 4667, 6585, 6647,
    7273, 9061, 9383, 10428, 10929, 11938, 12033, 12331, 12562, 13793,
    14157, 14635, 15265, 15618, 16553, 16604, 18362, 18956, 20075, 21675,
    22520, 26130, 26161, 26435, 28279, 29464, 31650, 32302, 32470, 36865,
    42863, 47425, 49870, 50254, 50258, 50360, 50361, 50362
]






class 		lowercase_					(	lowercase   ):






      '''simple docstring'''




      __snake_case       =  '''whisper'''
      __snake_case       =  ['''past_key_values''']
      __snake_case       =  {'''num_attention_heads''': '''encoder_attention_heads''', '''hidden_size''': '''d_model'''}







      def __init__(      self      :						Any ,					__UpperCAmelCase      :						Union[str, Any]=51_865 ,					__UpperCAmelCase      :						str=80 ,					__UpperCAmelCase      :						Any=6 ,					__UpperCAmelCase      :						Optional[Any]=4 ,					__UpperCAmelCase      :						Any=6 ,					__UpperCAmelCase      :						Any=4 ,					__UpperCAmelCase      :						Any=1_536 ,					__UpperCAmelCase      :						Any=1_536 ,					__UpperCAmelCase      :						str=0.0 ,					__UpperCAmelCase      :						Union[str, Any]=0.0 ,					__UpperCAmelCase      :						Optional[int]=50_257 ,					__UpperCAmelCase      :						Any=True ,					__UpperCAmelCase      :						List[Any]=True ,					__UpperCAmelCase      :						Any="gelu" ,					__UpperCAmelCase      :						List[Any]=256 ,					__UpperCAmelCase      :						Tuple=0.0 ,					__UpperCAmelCase      :						Dict=0.0 ,					__UpperCAmelCase      :						List[Any]=0.0 ,					__UpperCAmelCase      :						str=0.02 ,					__UpperCAmelCase      :						List[Any]=False ,					__UpperCAmelCase      :						str=1_500 ,					__UpperCAmelCase      :						str=448 ,					__UpperCAmelCase      :						Tuple=50_256 ,					__UpperCAmelCase      :						Dict=50_256 ,					__UpperCAmelCase      :						Tuple=50_256 ,					__UpperCAmelCase      :						int=None ,					__UpperCAmelCase      :						int=[220, 50_256] ,					__UpperCAmelCase      :						Optional[int]=False ,					__UpperCAmelCase      :						Tuple=256 ,					__UpperCAmelCase      :						List[str]=False ,					__UpperCAmelCase      :						Union[str, Any]=0.05 ,					__UpperCAmelCase      :						Dict=10 ,					__UpperCAmelCase      :						List[Any]=2 ,					__UpperCAmelCase      :						Union[str, Any]=0.0 ,					__UpperCAmelCase      :						List[Any]=10 ,					__UpperCAmelCase      :						Optional[Any]=0 ,					__UpperCAmelCase      :						Union[str, Any]=7 ,					**__UpperCAmelCase      :						Optional[Any] ,					)    ->Optional[int]:




       """simple docstring"""


       a		  =      vocab_size
       a		  =      num_mel_bins
       a		  =      d_model
       a		  =      encoder_layers
       a		  =      encoder_attention_heads
       a		  =      decoder_layers
       a		  =      decoder_attention_heads
       a		  =      decoder_ffn_dim
       a		  =      encoder_ffn_dim
       a		  =      dropout
       a		  =      attention_dropout
       a		  =      activation_dropout
       a		  =      activation_function
       a		  =      init_std
       a		  =      encoder_layerdrop
       a		  =      decoder_layerdrop
       a		  =      use_cache
       a		  =      encoder_layers
       a		  =      scale_embedding  # scale factor will be sqrt(d_model) if True
       a		  =      max_source_positions
       a		  =      max_target_positions

       # Audio Classification-specific parameters. Feel free to ignore for other classes.
       a		  =      classifier_proj_size
       a		  =      use_weighted_layer_sum

       # fine-tuning config parameters for SpecAugment: https://arxiv.org/abs/1904.08779
       a		  =      apply_spec_augment
       a		  =      mask_time_prob
       a		  =      mask_time_length
       a		  =      mask_time_min_masks
       a		  =      mask_feature_prob
       a		  =      mask_feature_length
       a		  =      mask_feature_min_masks

       a		  =      median_filter_width

       super().__init__(
           pad_token_id=__UpperCAmelCase ,					bos_token_id=__UpperCAmelCase ,					eos_token_id=__UpperCAmelCase ,					is_encoder_decoder=__UpperCAmelCase ,					decoder_start_token_id=__UpperCAmelCase ,					suppress_tokens=__UpperCAmelCase ,					begin_suppress_tokens=__UpperCAmelCase ,					**__UpperCAmelCase ,					)






class 		lowercase_					(	lowercase   ):






      '''simple docstring'''




      @property
      def       __lowerCAmelCase					(      self      :						Optional[int]  )    ->Mapping[str, Mapping[int, str]]:




       """simple docstring"""


       a		  =      OrderedDict(
           [
               ('''input_features''', {0: '''batch''', 1: '''feature_size''', 2: '''encoder_sequence'''}),
           ]  )
       if self.use_past:
        a		  =      {0: '''batch'''}
       else:
        a		  =      {0: '''batch''', 1: '''decoder_sequence'''}

       if self.use_past:
        self.fill_with_past_key_values_(__UpperCAmelCase ,					direction='''inputs'''  )

       return common_inputs







      def       __lowerCAmelCase					(      self      :						List[Any] ,					__UpperCAmelCase      :						Union["PreTrainedTokenizerBase", "FeatureExtractionMixin"] ,					__UpperCAmelCase      :						int = -1 ,					__UpperCAmelCase      :						int = -1 ,					__UpperCAmelCase      :						bool = False ,					__UpperCAmelCase      :						Optional["TensorType"] = None ,					__UpperCAmelCase      :						int = 22_050 ,					__UpperCAmelCase      :						float = 5.0 ,					__UpperCAmelCase      :						int = 220 ,					)    ->Mapping[str, Any]:




       """simple docstring"""


       a		  =      OrderedDict()
       a		  =      OnnxConfig.generate_dummy_inputs(
           self ,					preprocessor=preprocessor.feature_extractor ,					batch_size=__UpperCAmelCase ,					framework=__UpperCAmelCase ,					sampling_rate=__UpperCAmelCase ,					time_duration=__UpperCAmelCase ,					frequency=__UpperCAmelCase ,					)
       a		  =      encoder_inputs['''input_features'''].shape[2]
       a		  =      encoder_sequence_length // 2 if self.use_past else seq_length

       a		  =      super().generate_dummy_inputs(
           preprocessor.tokenizer ,					__UpperCAmelCase ,					__UpperCAmelCase ,					__UpperCAmelCase ,					__UpperCAmelCase  )

       a		  =      encoder_inputs.pop('''input_features'''  )
       a		  =      decoder_inputs.pop('''decoder_input_ids'''  )

       if "past_key_values" in decoder_inputs:
        a		  =      decoder_inputs.pop('''past_key_values'''  )

       return dummy_inputs







      @property
      def       __lowerCAmelCase					(      self      :						Optional[int]  )    ->float:




       """simple docstring"""


       return 1e-3










from __future__ import annotations

UpperCAmelCase__				   =		"Muhammad Umer Farooq"
UpperCAmelCase__				   =		"MIT"
UpperCAmelCase__				   =		"1.0.0"
UpperCAmelCase__				   =		"Muhammad Umer Farooq"
UpperCAmelCase__				   =		"contact@muhammadumerfarooq.me"
UpperCAmelCase__				   =		"Alpha"

import re
from html.parser import HTMLParser
from urllib import parse

import requests






class 		lowercase_					(	lowercase   ):






      '''simple docstring'''




      def __init__(      self      :						Union[str, Any] ,					__UpperCAmelCase      :						str  )    ->None:




       """simple docstring"""


       super().__init__()
       a		  =      []
       a		  =      domain







      def       __lowerCAmelCase					(      self      :						List[str] ,					__UpperCAmelCase      :						str ,					__UpperCAmelCase      :						list[tuple[str, str | None]]  )    ->None:




       """simple docstring"""


       if tag == "a":
        # Check the list of defined attributes.
        for name, value in attrs:
         # If href is defined, and not empty nor # print it.
         if name == "href" and value != "#" and value != "":
          # If not already in urls.
          if value not in self.urls:
           a		  =      parse.urljoin(self.domain ,					__UpperCAmelCase  )
           self.urls.append(__UpperCAmelCase  )
def 						_a    (      a :str )							->			str:
 return ".".join(get_sub_domain_name(a ).split('''.''' )[-2:] )
def 						_a    (      a :str )							->			str:
 return parse.urlparse(a ).netloc
def 						_a    (      a :str = "https://github.com" )							->			list[str]:
 a		  =      get_domain_name(a )

 # Initialize the parser
 a		  =      Parser(a )

 try:
  # Open URL
  a		  =      requests.get(a )

  # pass the raw HTML to the parser to get links
  parser.feed(r.text )

  # Get links and loop through
  a		  =      set()
  for link in parser.urls:
   # open URL.
   # read = requests.get(link)
   try:
    a		  =      requests.get(a )
    # Get the valid email.
    a		  =      re.findall('''[a-zA-Z0-9]+@''' + domain	,							read.text )
    # If not in list then append it.
    for email in emails:
     valid_emails.add(a )
   except ValueError:
    pass
 except ValueError:
  raise SystemExit(1 )

 # Finally return a sorted list of email addresses with no duplicates.
 return sorted(a )


if __name__ == "__main__":
     UpperCAmelCase__				   =		emails_from_url("https://github.com")
     print(f"""{len(emails)} emails found:""")
     print("\n".join(sorted(emails)))


