urschrei / pyzotero

Pyzotero: a Python client for the Zotero API
https://pyzotero.readthedocs.org
Other
908 stars 99 forks source link

Add functools wrap for dynamic documentation #109

Closed fmagin closed 4 years ago

fmagin commented 4 years ago

This is just a little convenience feature that sets __wrapped__ on functions that are annotated with tcache, retrieve and backoff_check. Probably only useful for retrieve functions, but might as well be consistent. This means that zot.items.__wrapped__ contains <function pyzotero.zotero.Zotero.items(self, **kwargs)> which allows IPython to show the documentation of this function instead of the wrapped_f function defined inside retrieve.

Not sure if anyone ever really uses this API with IPython but at least for interactive exploring and playing around it is quite helpful.

fmagin commented 4 years ago

This and possible related changes for better integration into IPython might be helpful or a full solution for https://github.com/urschrei/pyzotero/issues/92

urschrei commented 4 years ago

Hi Florian, this seems like a convenient and useful addition. Thanks!