Skip to content

Commit 00759a3

Browse files
authored
add proper param types in register_callbacks (xmlsec#228)
Signed-off-by: oleg.hoefling <[email protected]> Signed-off-by: oleg.hoefling <[email protected]>
1 parent 21ce916 commit 00759a3

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/main.c

+9-4
Original file line numberDiff line numberDiff line change
@@ -275,18 +275,23 @@ static PyObject* PyXmlSec_PyIORegisterDefaultCallbacks(PyObject *self) {
275275
}
276276

277277
static char PyXmlSec_PyIORegisterCallbacks__doc__[] = \
278+
"register_callbacks(input_match_callback, input_open_callback, input_read_callback, input_close_callback) -> None\n"
278279
"Register globally a custom set of IO callbacks with xmlsec.\n\n"
279-
":param callable input_match_callback: A callable that takes a filename `bytestring` and "
280+
":param input_match_callback: A callable that takes a filename `bytestring` and "
280281
"returns a boolean as to whether the other callbacks in this set can handle that name.\n"
281-
":param callable input_open_callback: A callable that takes a filename and returns some "
282+
":type input_match_callback: ~collections.abc.Callable[[bytes], bool]\n"
283+
":param input_open_callback: A callable that takes a filename and returns some "
282284
"context object (e.g. a file object) that the remaining callables in this set will be passed "
283285
"during handling.\n"
286+
":type input_open_callback: ~collections.abc.Callable[[bytes], Any]\n"
284287
// FIXME: How do we handle failures in ^^ (e.g. can't find the file)?
285-
":param callable input_read_callback: A callable that that takes the context object from the "
288+
":param input_read_callback: A callable that that takes the context object from the "
286289
"open callback and a buffer, and should fill the buffer with data (e.g. BytesIO.readinto()). "
287290
"xmlsec will call this function several times until there is no more data returned.\n"
288-
":param callable input_close_callback: A callable that takes the context object from the "
291+
":type input_read_callback: ~collections.abc.Callable[[Any, memoryview], int]\n"
292+
":param input_close_callback: A callable that takes the context object from the "
289293
"open callback and can do any resource cleanup necessary.\n"
294+
":type input_close_callback: ~collections.abc.Callable[[Any], None]\n"
290295
;
291296
static PyObject* PyXmlSec_PyIORegisterCallbacks(PyObject *self, PyObject *args, PyObject *kwargs) {
292297
static char *kwlist[] = {

0 commit comments

Comments
 (0)