from typing import List, Optional, Union

import numpy as np

from ...feature_extraction_sequence_utils import SequenceFeatureExtractor
from ...feature_extraction_utils import BatchFeature
from ...utils import PaddingStrategy, TensorType, logging


__snake_case			      =    logging.get_logger(__name__)







class 			__snake_case   (     lowerCamelCase__   ):
 __lowerCamelCase    :   Union[str, Any]     =      ["""input_values""", """attention_mask"""]
 def __init__(  self		,   snake_case__=1		,   snake_case__=1_6000		,   snake_case__=0.0		,   snake_case__=False		,   snake_case__=True		,   **snake_case__		,   )	->							str:
       '''simple docstring'''





       super().__init__(feature_size=snake_case__		,   sampling_rate=snake_case__		,   padding_value=snake_case__		,   **snake_case__						)
       UpperCAmelCase    : Any      =return_attention_mask
       UpperCAmelCase    : str      =do_normalize
 @staticmethod
 def 	UpperCAmelCase__       (  snake_case__		,   snake_case__		,   snake_case__ = 0.0						)	->							List[np.ndarray]:
       '''simple docstring'''





       if attention_mask is not None:
             UpperCAmelCase    : List[str]      =np.array(snake_case__		,   np.intaa						)
             UpperCAmelCase    : List[str]      =[]

             for vector, length in zip(snake_case__		,   attention_mask.sum(-1						)						):
                   UpperCAmelCase    : int      =(vector - vector[:length].mean()) / np.sqrt(vector[:length].var() + 1e-7						)
                   if length < normed_slice.shape[0]:
                         UpperCAmelCase    : int      =padding_value

                   normed_input_values.append(snake_case__						)
       else:
             UpperCAmelCase    : List[Any]      =[(x - x.mean()) / np.sqrt(x.var() + 1e-7						) for x in input_values]

       return normed_input_values






 def __call__(  self		,   snake_case__		,   snake_case__ = False		,   snake_case__ = None		,   snake_case__ = False		,   snake_case__ = None		,   snake_case__ = None		,   snake_case__ = None		,   snake_case__ = None		,   **snake_case__		,   )	->							BatchFeature:
       '''simple docstring'''





       if sampling_rate is not None:
             if sampling_rate != self.sampling_rate:
                   raise ValueError(
                       f'''The model corresponding to this feature extractor: {self} was trained using a sampling rate of'''
                       f''' {self.sampling_rate}. Please make sure that the provided `raw_speech` input was sampled with'''
                       f''' {self.sampling_rate} and not {sampling_rate}.'''						)
       else:
             logger.warning(
                 '''It is strongly recommended to pass the ``sampling_rate`` argument to this function. '''
                 '''Failing to do so can result in silent errors that might be hard to debug.'''						)

       UpperCAmelCase    : int      =isinstance(snake_case__		,   np.ndarray						) and len(raw_speech.shape						) > 1
       if is_batched_numpy and len(raw_speech.shape						) > 2:
             raise ValueError(f'''Only mono-channel audio is supported for input to {self}'''						)
       UpperCAmelCase    : str      =is_batched_numpy or (
           isinstance(snake_case__		,   (list, tuple)						) and (isinstance(raw_speech[0]		,   (np.ndarray, tuple, list)						))
       )

       # always return batch
       if not is_batched:
             UpperCAmelCase    : List[str]      =[raw_speech]

       # convert into correct format for padding
       UpperCAmelCase    : Any      =BatchFeature({'''input_values''': raw_speech}						)

       UpperCAmelCase    : int      =self.pad(
           snake_case__		,   padding=snake_case__		,   max_length=snake_case__		,   truncation=snake_case__		,   pad_to_multiple_of=snake_case__		,   return_attention_mask=snake_case__		,   )

       # convert input values to correct format
       UpperCAmelCase    : Tuple      =padded_inputs['''input_values''']
       if not isinstance(input_values[0]		,   np.ndarray						):
             UpperCAmelCase    : str      =[np.asarray(snake_case__		,   dtype=np.floataa						) for array in input_values]
       elif (
           not isinstance(snake_case__		,   np.ndarray						)
           and isinstance(input_values[0]		,   np.ndarray						)
           and input_values[0].dtype is np.dtype(np.floataa						)
       ):
             UpperCAmelCase    : List[Any]      =[array.astype(np.floataa						) for array in input_values]
       elif isinstance(snake_case__		,   np.ndarray						) and input_values.dtype is np.dtype(np.floataa						):
             UpperCAmelCase    : Union[str, Any]      =input_values.astype(np.floataa						)

       # convert attention_mask to correct format
       UpperCAmelCase    : Dict      =padded_inputs.get('''attention_mask'''						)
       if attention_mask is not None:
             UpperCAmelCase    : Union[str, Any]      =[np.asarray(snake_case__		,   dtype=np.intaa						) for array in attention_mask]

       # zero-mean and unit-variance normalization
       if self.do_normalize:
             UpperCAmelCase    : Any      =(
                 attention_mask
                 if self._get_padding_strategies(snake_case__		,   max_length=snake_case__						) is not PaddingStrategy.DO_NOT_PAD
                 else None
             )
             UpperCAmelCase    : Union[str, Any]      =self.zero_mean_unit_var_norm(
                 padded_inputs['''input_values''']		,   attention_mask=snake_case__		,   padding_value=self.padding_value						)

       if return_tensors is not None:
             UpperCAmelCase    : Optional[int]      =padded_inputs.convert_to_tensors(snake_case__						)

       return padded_inputs

from collections import defaultdict





def   lowerCAmelCase_ (				__lowerCAmelCase = 5						)->  int:






      '''simple docstring'''





      UpperCAmelCase    : List[str]      =defaultdict(__lowerCAmelCase						)
      UpperCAmelCase    : Tuple      =0

      while True:
            UpperCAmelCase    : Any      =get_digits(__lowerCAmelCase						)
            freqs[digits].append(__lowerCAmelCase						)

            if len(freqs[digits]						) == max_base:
                  UpperCAmelCase    : Optional[int]      =freqs[digits][0] ** 3
                  return base

            num += 1





def   lowerCAmelCase_ (				__lowerCAmelCase						)->  str:






      '''simple docstring'''





      return "".join(sorted(str(num**3						)						)						)


if __name__ == "__main__":
     print(f'{solution() = }')
