Skip to content

Commit b26ee6c

Browse files
committed
Added type hints to audiocore
1 parent 2681bd5 commit b26ee6c

2 files changed

Lines changed: 10 additions & 10 deletions

File tree

shared-bindings/audiocore/RawSample.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ STATIC mp_obj_t audioio_rawsample_make_new(const mp_obj_type_t *type, size_t n_a
101101
return MP_OBJ_FROM_PTR(self);
102102
}
103103

104-
//| def deinit(self, ) -> Any:
104+
//| def deinit(self, ) -> None:
105105
//| """Deinitialises the AudioOut and releases any hardware resources for reuse."""
106106
//| ...
107107
//|
@@ -118,13 +118,13 @@ STATIC void check_for_deinit(audioio_rawsample_obj_t *self) {
118118
}
119119
}
120120

121-
//| def __enter__(self, ) -> Any:
121+
//| def __enter__(self, ) -> RawSample:
122122
//| """No-op used by Context Managers."""
123123
//| ...
124124
//|
125125
// Provided by context manager helper.
126126

127-
//| def __exit__(self, ) -> Any:
127+
//| def __exit__(self, ) -> None:
128128
//| """Automatically deinitializes the hardware when exiting a context. See
129129
//| :ref:`lifetime-and-contextmanagers` for more info."""
130130
//| ...
@@ -136,7 +136,7 @@ STATIC mp_obj_t audioio_rawsample_obj___exit__(size_t n_args, const mp_obj_t *ar
136136
}
137137
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audioio_rawsample___exit___obj, 4, 4, audioio_rawsample_obj___exit__);
138138

139-
//| sample_rate: Any = ...
139+
//| sample_rate: Optional(int) = ...
140140
//| """32 bit value that dictates how quickly samples are played in Hertz (cycles per second).
141141
//| When the sample is looped, this can change the pitch output without changing the underlying
142142
//| sample. This will not change the sample rate of any active playback. Call ``play`` again to

shared-bindings/audiocore/WaveFile.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ STATIC mp_obj_t audioio_wavefile_make_new(const mp_obj_type_t *type, size_t n_ar
9191
return MP_OBJ_FROM_PTR(self);
9292
}
9393

94-
//| def deinit(self, ) -> Any:
94+
//| def deinit(self, ) -> None:
9595
//| """Deinitialises the WaveFile and releases all memory resources for reuse."""
9696
//| ...
9797
STATIC mp_obj_t audioio_wavefile_deinit(mp_obj_t self_in) {
@@ -107,13 +107,13 @@ STATIC void check_for_deinit(audioio_wavefile_obj_t *self) {
107107
}
108108
}
109109

110-
//| def __enter__(self, ) -> Any:
110+
//| def __enter__(self, ) -> WaveFile:
111111
//| """No-op used by Context Managers."""
112112
//| ...
113113
//|
114114
// Provided by context manager helper.
115115

116-
//| def __exit__(self, ) -> Any:
116+
//| def __exit__(self, ) -> None:
117117
//| """Automatically deinitializes the hardware when exiting a context. See
118118
//| :ref:`lifetime-and-contextmanagers` for more info."""
119119
//| ...
@@ -125,7 +125,7 @@ STATIC mp_obj_t audioio_wavefile_obj___exit__(size_t n_args, const mp_obj_t *arg
125125
}
126126
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audioio_wavefile___exit___obj, 4, 4, audioio_wavefile_obj___exit__);
127127

128-
//| sample_rate: Any = ...
128+
//| sample_rate: Optional(int) = ...
129129
//| """32 bit value that dictates how quickly samples are loaded into the DAC
130130
//| in Hertz (cycles per second). When the sample is looped, this can change
131131
//| the pitch output without changing the underlying sample."""
@@ -152,7 +152,7 @@ const mp_obj_property_t audioio_wavefile_sample_rate_obj = {
152152
(mp_obj_t)&mp_const_none_obj},
153153
};
154154

155-
//| bits_per_sample: Any = ...
155+
//| bits_per_sample: int = ...
156156
//| """Bits per sample. (read only)"""
157157
//|
158158
STATIC mp_obj_t audioio_wavefile_obj_get_bits_per_sample(mp_obj_t self_in) {
@@ -168,7 +168,7 @@ const mp_obj_property_t audioio_wavefile_bits_per_sample_obj = {
168168
(mp_obj_t)&mp_const_none_obj,
169169
(mp_obj_t)&mp_const_none_obj},
170170
};
171-
//| channel_count: Any = ...
171+
//| channel_count: int = ...
172172
//| """Number of audio channels. (read only)"""
173173
//|
174174
STATIC mp_obj_t audioio_wavefile_obj_get_channel_count(mp_obj_t self_in) {

0 commit comments

Comments
 (0)