Added type hints to audiomp3

This commit is contained in:
dherrada 2020-07-02 12:00:40 -04:00
parent 24bca06db0
commit e114b31a7a

View File

@ -89,7 +89,7 @@ STATIC mp_obj_t audiomp3_mp3file_make_new(const mp_obj_type_t *type, size_t n_ar
return MP_OBJ_FROM_PTR(self); return MP_OBJ_FROM_PTR(self);
} }
//| def deinit(self, ) -> Any: //| def deinit(self, ) -> None:
//| """Deinitialises the MP3 and releases all memory resources for reuse.""" //| """Deinitialises the MP3 and releases all memory resources for reuse."""
//| ... //| ...
//| //|
@ -106,13 +106,13 @@ STATIC void check_for_deinit(audiomp3_mp3file_obj_t *self) {
} }
} }
//| def __enter__(self, ) -> Any: //| def __enter__(self, ) -> MP3:
//| """No-op used by Context Managers.""" //| """No-op used by Context Managers."""
//| ... //| ...
//| //|
// Provided by context manager helper. // Provided by context manager helper.
//| def __exit__(self, ) -> Any: //| def __exit__(self, ) -> None:
//| """Automatically deinitializes the hardware when exiting a context. See //| """Automatically deinitializes the hardware when exiting a context. See
//| :ref:`lifetime-and-contextmanagers` for more info.""" //| :ref:`lifetime-and-contextmanagers` for more info."""
//| ... //| ...
@ -124,7 +124,7 @@ STATIC mp_obj_t audiomp3_mp3file_obj___exit__(size_t n_args, const mp_obj_t *arg
} }
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audiomp3_mp3file___exit___obj, 4, 4, audiomp3_mp3file_obj___exit__); STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audiomp3_mp3file___exit___obj, 4, 4, audiomp3_mp3file_obj___exit__);
//| file: Any = ... //| file: Optional[file] = ...
//| """File to play back.""" //| """File to play back."""
//| //|
STATIC mp_obj_t audiomp3_mp3file_obj_get_file(mp_obj_t self_in) { STATIC mp_obj_t audiomp3_mp3file_obj_get_file(mp_obj_t self_in) {
@ -154,7 +154,7 @@ const mp_obj_property_t audiomp3_mp3file_file_obj = {
//| sample_rate: Any = ... //| sample_rate: Optional[int] = ...
//| """32 bit value that dictates how quickly samples are loaded into the DAC //| """32 bit value that dictates how quickly samples are loaded into the DAC
//| in Hertz (cycles per second). When the sample is looped, this can change //| in Hertz (cycles per second). When the sample is looped, this can change
//| the pitch output without changing the underlying sample.""" //| the pitch output without changing the underlying sample."""
@ -181,7 +181,7 @@ const mp_obj_property_t audiomp3_mp3file_sample_rate_obj = {
(mp_obj_t)&mp_const_none_obj}, (mp_obj_t)&mp_const_none_obj},
}; };
//| bits_per_sample: Any = ... //| bits_per_sample: int = ...
//| """Bits per sample. (read only)""" //| """Bits per sample. (read only)"""
//| //|
STATIC mp_obj_t audiomp3_mp3file_obj_get_bits_per_sample(mp_obj_t self_in) { STATIC mp_obj_t audiomp3_mp3file_obj_get_bits_per_sample(mp_obj_t self_in) {
@ -198,7 +198,7 @@ const mp_obj_property_t audiomp3_mp3file_bits_per_sample_obj = {
(mp_obj_t)&mp_const_none_obj}, (mp_obj_t)&mp_const_none_obj},
}; };
//| channel_count: Any = ... //| channel_count: int = ...
//| """Number of audio channels. (read only)""" //| """Number of audio channels. (read only)"""
//| //|
STATIC mp_obj_t audiomp3_mp3file_obj_get_channel_count(mp_obj_t self_in) { STATIC mp_obj_t audiomp3_mp3file_obj_get_channel_count(mp_obj_t self_in) {
@ -215,7 +215,7 @@ const mp_obj_property_t audiomp3_mp3file_channel_count_obj = {
(mp_obj_t)&mp_const_none_obj}, (mp_obj_t)&mp_const_none_obj},
}; };
//| rms_level: Any = ... //| rms_level: float = ...
//| """The RMS audio level of a recently played moment of audio. (read only)""" //| """The RMS audio level of a recently played moment of audio. (read only)"""
//| //|
STATIC mp_obj_t audiomp3_mp3file_obj_get_rms_level(mp_obj_t self_in) { STATIC mp_obj_t audiomp3_mp3file_obj_get_rms_level(mp_obj_t self_in) {