Anki/anki
dequis 37ba8832f8 Make hooks.wrap preserve signatures, fixes hooking some pyqt5 callbacks
It looks like pyqt5 is playing dirty and checking the number of args of
functions before calling them. When using hooks.wrap, pyqt5 thinks it
can pass any amount of arguments (because *args) and you get exceptions
like this inside the wrap function, when calling the 'old' function:

>TypeError: onFindDupes() takes 1 positional argument but 2 were given

This commit fixes it by preserving the signature of the wrapped method,
by adding an optional dependency on the "decorator" module.

Making it an optional dependency is probably not the wisest idea but
since this is a small edge case it might be smoother to start like this.

I also added functools.wraps() as a fallback, which won't help much but
is slightly more correct.

See this article for details: https://hynek.me/articles/decorators/
2017-07-16 23:25:34 -03:00
..
importing Fix issue where null tag list crashes Mnemosyne import 2017-05-30 17:38:39 -04:00
template Stop inheriting from object 2017-02-07 00:21:33 +02:00
__init__.py bump version 2017-07-10 15:22:47 +10:00
ankiweb.certs bump version again, as new cert was missing an intermediate 2014-04-12 15:54:25 +09:00
cards.py Stop inheriting from object 2017-02-07 00:21:33 +02:00
collection.py when reviews have incorrect due date, make them due today 2017-05-09 12:27:23 +10:00
consts.py use a constant for the starting factor 2017-02-08 17:28:12 +10:00
db.py Stop inheriting from object 2017-02-07 00:21:33 +02:00
decks.py Merge branch 'master' of github.com:dae/anki 2017-02-08 17:28:30 +10:00
errors.py merged libanki and ankiqt into single distro 2012-12-21 16:51:59 +09:00
exporting.py Stop inheriting from object 2017-02-07 00:21:33 +02:00
find.py Allow special characters to be escaped 2017-02-28 08:10:43 +09:30
hooks.py Make hooks.wrap preserve signatures, fixes hooking some pyqt5 callbacks 2017-07-16 23:25:34 -03:00
js.py upgrade jquery & flot 2016-06-22 14:41:01 +10:00
lang.py add support for a few more languages 2016-06-29 16:37:29 +10:00
latex.py start port to python 3 2016-05-12 14:45:35 +10:00
media.py Revert "don't rely on cwd in media.py" 2017-04-11 12:50:33 +10:00
models.py Stop inheriting from object 2017-02-07 00:21:33 +02:00
notes.py Stop inheriting from object 2017-02-07 00:21:33 +02:00
sched.py Merge branch 'master' of github.com:dae/anki 2017-02-08 17:28:30 +10:00
sound.py make sure we don't use inherited ld_library_path when calling mplayer 2017-05-22 15:40:04 +10:00
stats.py Stop inheriting from object 2017-02-07 00:21:33 +02:00
statsbg.py merged libanki and ankiqt into single distro 2012-12-21 16:51:59 +09:00
stdmodels.py fix inconsistency in default note type names 2014-10-23 14:28:26 -05:00
storage.py fixes for sqlite on python 3.6 2017-01-13 17:00:03 +10:00
sync.py Stop inheriting from object 2017-02-07 00:21:33 +02:00
tags.py Merge pull request #169 from luoliyan/regex-tag-removal 2017-02-22 20:51:23 +10:00
utils.py use a clearer name for fmtQA() 2017-03-14 15:48:40 +09:00