Added type hints to audiopwmio

This commit is contained in:
dherrada 2020-07-02 12:07:03 -04:00
parent e169da3532
commit ed476a417c

View File

@ -114,7 +114,7 @@ STATIC mp_obj_t audiopwmio_pwmaudioout_make_new(const mp_obj_type_t *type, size_
return MP_OBJ_FROM_PTR(self);
}
//| def deinit(self, ) -> Any:
//| def deinit(self, ) -> None:
//| """Deinitialises the PWMAudioOut and releases any hardware resources for reuse."""
//| ...
//|
@ -130,13 +130,13 @@ STATIC void check_for_deinit(audiopwmio_pwmaudioout_obj_t *self) {
raise_deinited_error();
}
}
//| def __enter__(self, ) -> Any:
//| def __enter__(self, ) -> PWMAudioOut:
//| """No-op used by Context Managers."""
//| ...
//|
// Provided by context manager helper.
//| def __exit__(self, ) -> Any:
//| def __exit__(self, ) -> None:
//| """Automatically deinitializes the hardware when exiting a context. See
//| :ref:`lifetime-and-contextmanagers` for more info."""
//| ...
@ -148,7 +148,7 @@ STATIC mp_obj_t audiopwmio_pwmaudioout_obj___exit__(size_t n_args, const mp_obj_
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audiopwmio_pwmaudioout___exit___obj, 4, 4, audiopwmio_pwmaudioout_obj___exit__);
//| def play(self, sample: Any, *, loop: Any = False) -> Any:
//| def play(self, sample: Union[audiocore.WaveFile, audiocore.RawSample, audiomixer.Mixer], *, loop: bool = False) -> None:
//| """Plays the sample once when loop=False and continuously when loop=True.
//| Does not block. Use `playing` to block.
//|
@ -177,7 +177,7 @@ STATIC mp_obj_t audiopwmio_pwmaudioout_obj_play(size_t n_args, const mp_obj_t *p
}
MP_DEFINE_CONST_FUN_OBJ_KW(audiopwmio_pwmaudioout_play_obj, 1, audiopwmio_pwmaudioout_obj_play);
//| def stop(self, ) -> Any:
//| def stop(self, ) -> None:
//| """Stops playback and resets to the start of the sample."""
//| ...
//|
@ -189,7 +189,7 @@ STATIC mp_obj_t audiopwmio_pwmaudioout_obj_stop(mp_obj_t self_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(audiopwmio_pwmaudioout_stop_obj, audiopwmio_pwmaudioout_obj_stop);
//| playing: Any = ...
//| playing: bool = ...
//| """True when an audio sample is being output even if `paused`. (read-only)"""
//|
STATIC mp_obj_t audiopwmio_pwmaudioout_obj_get_playing(mp_obj_t self_in) {
@ -206,7 +206,7 @@ const mp_obj_property_t audiopwmio_pwmaudioout_playing_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| def pause(self, ) -> Any:
//| def pause(self, ) -> None:
//| """Stops playback temporarily while remembering the position. Use `resume` to resume playback."""
//| ...
//|
@ -222,7 +222,7 @@ STATIC mp_obj_t audiopwmio_pwmaudioout_obj_pause(mp_obj_t self_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(audiopwmio_pwmaudioout_pause_obj, audiopwmio_pwmaudioout_obj_pause);
//| def resume(self, ) -> Any:
//| def resume(self, ) -> None:
//| """Resumes sample playback after :py:func:`pause`."""
//| ...
//|
@ -238,7 +238,7 @@ STATIC mp_obj_t audiopwmio_pwmaudioout_obj_resume(mp_obj_t self_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(audiopwmio_pwmaudioout_resume_obj, audiopwmio_pwmaudioout_obj_resume);
//| paused: Any = ...
//| paused: bool = ...
//| """True when playback is paused. (read-only)"""
//|
STATIC mp_obj_t audiopwmio_pwmaudioout_obj_get_paused(mp_obj_t self_in) {