Skip to content

Commit 8f46979

Browse files
committed
Enable automated documentation for Compress and Decompress members
1 parent d50bdd5 commit 8f46979

2 files changed

Lines changed: 35 additions & 4 deletions

File tree

‎docs/index.rst‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,12 @@ API Documentation: isal_zlib
9999
.. automodule:: isal.isal_zlib
100100
:members:
101101

102+
.. autoclass:: Compress
103+
:members:
104+
105+
.. autoclass:: Decompress
106+
:members:
107+
102108
========================
103109
API-documentation: igzip
104110
========================
@@ -115,7 +121,10 @@ API Documentation: igzip_lib
115121
============================
116122

117123
.. automodule:: isal.igzip_lib
118-
:members: compress, decompress, IgzipDecompressor
124+
:members: compress, decompress,
125+
126+
.. autoclass:: IgzipDecompressor
127+
:members:
119128

120129
==========================
121130
python -m isal.igzip usage

‎src/isal/isal_zlib.c‎

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -627,10 +627,20 @@ static PyType_Spec Comptype_spec = {
627627

628628
#define COMP_OFF(x) offsetof(decompobject, x)
629629

630+
PyDoc_STRVAR(Decomp_unconsumed_tail,
631+
"A bytes object that contains any data that was not consumed by the last\n"
632+
"decompress() call because it exceeded the limit for the uncompressed data\n"
633+
"buffer. This data has not yet been seen by the zlib machinery, so you must\n"
634+
"feed it (possibly with further data concatenated to it) back to a \n"
635+
"subsequent decompress() method call in order to get correct output.");
636+
630637
static PyMemberDef Decomp_members[] = {
631-
{"unused_data", T_OBJECT, COMP_OFF(unused_data), READONLY},
632-
{"unconsumed_tail", T_OBJECT, COMP_OFF(unconsumed_tail), READONLY},
633-
{"eof", T_BOOL, COMP_OFF(eof), READONLY},
638+
{"unused_data", T_OBJECT, COMP_OFF(unused_data), READONLY,
639+
"Data found after the end of the compressed stream."},
640+
{"unconsumed_tail", T_OBJECT, COMP_OFF(unconsumed_tail), READONLY,
641+
Decomp_unconsumed_tail},
642+
{"eof", T_BOOL, COMP_OFF(eof), READONLY,
643+
"True if the end-of-stream marker has been reached."},
634644
{NULL},
635645
};
636646

@@ -734,6 +744,18 @@ PyInit_isal_zlib(void)
734744
return NULL;
735745
get_isal_zlib_state(m)->Decomptype = Decomptype;
736746

747+
if (PyType_Ready(Comptype) != 0)
748+
return NULL;
749+
Py_INCREF(Comptype);
750+
if (PyModule_AddObject(m, "Compress", (PyObject *)Comptype) < 0) {
751+
return NULL;
752+
}
753+
if (PyType_Ready(Decomptype) != 0)
754+
return NULL;
755+
Py_INCREF(Decomptype);
756+
if (PyModule_AddObject(m, "Decompress", (PyObject *)Decomptype) < 0) {
757+
return NULL;
758+
}
737759

738760
PyModule_AddIntConstant(m, "MAX_WBITS", ISAL_DEF_MAX_HIST_BITS);
739761
PyModule_AddIntConstant(m, "DEFLATED", Z_DEFLATED);

0 commit comments

Comments
 (0)