Commit graph

875 commits

Author SHA1 Message Date
Michal Pokorný (Rai)
567b3670b7 Use named groups instead of numbered groups to refer to clozeReg 2019-12-25 15:06:00 +01:00
Damien Elmes
4863431c93 add type hint to models 2019-12-24 14:06:31 +10:00
Damien Elmes
eb03b8b727 another pylint fix 2019-12-23 12:06:26 +10:00
Damien Elmes
f8419cf957 fix pylint 2019-12-23 11:56:03 +10:00
Damien Elmes
a0ca95a414 fix some type errors/lints 2019-12-23 11:32:19 +10:00
Damien Elmes
17af26dcb5 apply black to all files 2019-12-23 10:34:10 +10:00
Damien Elmes
9ebc15c748 add black, update for new isort
people updating from a previous build, make sure you run
pip install --reinstall requirements.check
2019-12-23 10:31:47 +10:00
Damien Elmes
b51cf71d35
Merge pull request #383 from agentydragon/all-ref
Move repeated calls to _renderQA into local function
2019-12-23 09:36:39 +10:00
Damien Elmes
29179771b3
Merge pull request #382 from agentydragon/whitespace
Whitespace reformat to force 80-character line limit
2019-12-23 09:35:56 +10:00
Damien Elmes
008bb6f0c3
Merge pull request #381 from agentydragon/move-data-var
Merge 'data' variable into its only usage site
2019-12-23 09:35:34 +10:00
Damien Elmes
45fd039bbf
Merge pull request #375 from agentydragon/stuff2
Use named tuple to represent QA data
2019-12-23 09:35:09 +10:00
Michal Pokorný (Rai)
13afb0dbff Move repeated calls to _renderQA into local function 2019-12-23 00:32:09 +01:00
Michal Pokorný (Rai)
1e9833ab2a Whitespace reformat to force 80-character line limit 2019-12-23 00:30:59 +01:00
Michal Pokorný (Rai)
8ceccbd164 Merge 'data' variable into its only usage site 2019-12-23 00:29:23 +01:00
Michal Pokorný (Rai)
c72051ba0d Move QA data tuple into separate type alias 2019-12-23 00:27:14 +01:00
Damien Elmes
30f5183b03
Merge pull request #378 from agentydragon/types-utils
Add some type declarations in utils.py
2019-12-23 09:24:20 +10:00
Damien Elmes
7d8969a711
Merge pull request #374 from agentydragon/mathjax-test
Fix bug in _removeFormattingFromMathjax
2019-12-23 07:43:16 +10:00
Michal Pokorný (Rai)
36bdb4ebe0 Add some type declarations in tags.py 2019-12-22 14:50:42 +01:00
Michal Pokorný (Rai)
202a31dc5a Add some type declarations in utils.py 2019-12-22 14:47:07 +01:00
Michal Pokorný (Rai)
5ff0547110 Don't repeat Python regex docs 2019-12-22 12:43:15 +01:00
Damien Elmes
af4d4af55d fix race condition in tmp folder handling 2019-12-22 19:03:20 +10:00
Michal Pokorný (Rai)
2d2f21bfe3 Fix bug in _removeFormattingFromMathjax 2019-12-22 05:47:45 +01:00
Michal Pokorný (Rai)
331781cf45 Document newly found bug in _removeFormattingFromMathjax
Also adds some comments I wrote to help me understand what's going
on in the code.

I hope to fix this bug myself, but I think it might be beyond what
you can do with Python regexes and might require writing a proper
parser.

So, as step 1, I'm adding in a couple comments explaining that the
bug exists and how to reproduce it.
2019-12-22 05:22:18 +01:00
Damien Elmes
7399e0bd2b Model->NoteType 2019-12-22 08:58:56 +10:00
Damien Elmes
079a00653e
Merge pull request #369 from agentydragon/typecheck-models
Add types for models, templates and field dicts
2019-12-22 08:19:40 +10:00
Michal Pokorný (Rai)
67a39c58cb Add types for models, templates and field dicts 2019-12-21 12:02:16 +01:00
Damien Elmes
bfcc837939 avoid noreturn for now, as it's not supported on python <3.6.5 2019-12-21 16:54:40 +10:00
Damien Elmes
f0f9278414
Merge pull request #363 from ig3/bug/new-perday
Use _deckNewLimitSingle in _groupChildrenMain
2019-12-21 07:41:18 +10:00
Damien Elmes
ed0b3d3374 add an example of how circular imports can be handled
The type name needs to be quoted so it is evaluated after the module
has been initialized.

In the future when we drop support for python 3.6, and mypy is updated,
we will be able to remove the quotes and use the following at
the top of the file instead:

from __future__ import annotations
2019-12-21 07:29:45 +10:00
Ian Goodacre
329ca71436 Use _deckNewLimitSingle in _groupChildrenMain 2019-12-21 09:26:51 +13:00
Damien Elmes
c1587254f4 use isort to tidy up imports 2019-12-20 19:19:29 +10:00
Damien Elmes
12093f2f2e add a bunch of extra hints for mypy 2019-12-20 16:40:20 +10:00
Damien Elmes
d8d7e78b6b remove typings from some other files
not used frequently enough to deal with the mypy errors they're causing
at the moment
2019-12-20 16:33:49 +10:00
Damien Elmes
b6b8df2dcf add a bunch of annotations for mypy 2019-12-20 15:07:40 +10:00
Damien Elmes
068b10103c fix media.check() sig 2019-12-20 11:58:50 +10:00
Damien Elmes
f170763ef1 exporting, latex 2019-12-20 11:47:19 +10:00
Damien Elmes
55795822b5 importing 2019-12-20 11:41:24 +10:00
Damien Elmes
c415a70e72 lang/media/storage 2019-12-20 11:27:01 +10:00
Damien Elmes
f74ee52c73 decks 2019-12-20 11:07:08 +10:00
Damien Elmes
efd78e66ef models 2019-12-20 11:07:08 +10:00
Damien Elmes
6ffe82ac54 db/hooks/utils 2019-12-20 11:07:08 +10:00
Damien Elmes
f69ef52845 collection 2019-12-20 11:07:08 +10:00
Damien Elmes
912e1bad03 cards/notes 2019-12-20 11:07:08 +10:00
Damien Elmes
9c16d59086 type hints for scheduler 2019-12-20 11:07:08 +10:00
Damien Elmes
6ecfff56c5 add pytype inferred types to anki/
I've corrected some obvious issues, and we can fix others over time.
Mypy tests are currently broken, as adding the type hints has increased
mypy's testing surface.
2019-12-20 11:07:08 +10:00
Damien Elmes
5418af00f7 Revert "DeckManager: _checkDeckTree ignore case"
This reverts commit 9955048aec.

This commit broke collections that had children under each of the
the duplicate names - it renames one of the decks, but the children
of the renamed deck are left without a parent, causing an error like

line 235, in deckDueList  nlim = min(nlim, lims[p][0])\n\nKeyError('..)

Rather than a more complicated approach, I think it's safer just to
leave the case or normalization-differing decks around for now, and
we can normalize things properly in a future schema upgrade.
2019-12-20 08:18:01 +10:00
Damien Elmes
cfd78367d4 don't set local offset in server mode 2019-12-17 17:10:56 +10:00
Damien Elmes
e59af745f7
Merge pull request #361 from Arthur-Milchior/testReqs
test req
2019-12-16 20:44:23 +10:00
Damien Elmes
d7cb7eaea0 avoid recalculating reqs in actions like adding cards 2019-12-16 20:27:58 +10:00
Damien Elmes
81e3acd599 fixes cycles in template imports 2019-12-16 18:16:26 +10:00