Damien Elmes
7fceffa890
rework the new scheduler's rollover/day counting code
...
The previous implementation interpreted the creation date as a local
time, and applied the rollover to that. If the initial creation date
was around midnight local time, even a one hour change due to daylight
savings could result in Anki skipping or doubling up on a day. To
address this, the rollover is now applied to the current time instead
of the creation date.
The new code needs the current time passed into it. This makes it
easier to unit test, and for AnkiWeb to be able to use the user's local
timezone.
The new timezone code is currently disabled, as this code needs to be
ported to all clients before it can be activated.
2019-12-27 21:53:20 +10:00
Michal Pokorný (Rai)
70db8c211e
Rename constants
2019-12-26 00:38:54 +01:00
Rai
2568a8aaf2
Merge branch 'master' into ref
2019-12-25 23:10:28 +01:00
Damien Elmes
2c14aab073
Merge pull request #387 from agentydragon/classmethods
...
Use @classmethod on methods that do not depends on instance state
2019-12-26 07:52:51 +10:00
Damien Elmes
95aa961eba
Merge pull request #388 from agentydragon/use-setdefault
...
Use dict.setdefault
2019-12-26 07:43:01 +10:00
Michal Pokorný (Rai)
19b833fb8d
Use dict.setdefault
2019-12-25 15:34:30 +01:00
Michal Pokorný (Rai)
764ff00dd1
Use @classmethod on methods that do not depends on instance state
2019-12-25 15:12:48 +01:00
Michal Pokorný (Rai)
1f5c039ac9
Use named groups instead of numbered groups to refer to clozeReg
2019-12-25 15:06:00 +01:00
Damien Elmes
0dce7b0a95
add a few type hints
2019-12-25 09:19:57 +10:00
Damien Elmes
8ef1fa7ed1
bridge->backend
2019-12-25 08:59:33 +10:00
Damien Elmes
9923938925
if db lock fails, explicitly close database
...
on Windows at least, the database file otherwise remains locked after
an exception is raised on a read only file
2019-12-24 19:57:54 +10:00
Damien Elmes
7a91f2be64
generate type stubs for Protobuf; disable pylint on rsbridge
2019-12-24 19:57:54 +10:00
Damien Elmes
65db02ddde
switch to Google's (C++) Protobuf implementation
...
Brings the 100 field test down from 3 secs to 0.15 secs.
"betterproto" indeed!
2019-12-24 19:57:54 +10:00
Damien Elmes
4347f10bcc
compute template requirements in Rust
...
on a 100 field template, what took ~75 seconds now takes ~3 seconds.
2019-12-24 19:57:54 +10:00
Damien Elmes
e05b77b083
use protobuf for python/rust bridge
...
If we go ahead with betterproto on the Python side, it will mean
bumping the minimum Python dependency to 3.7.
2019-12-24 19:57:54 +10:00
Damien Elmes
f85390437e
format
2019-12-24 19:57:54 +10:00
Damien Elmes
349c5ba049
make it possible to implement functionality in Rust
2019-12-24 19:57:54 +10:00
Damien Elmes
74532ba0de
add type hint to models
2019-12-24 14:06:31 +10:00
Damien Elmes
18419f9398
another pylint fix
2019-12-23 12:06:26 +10:00
Damien Elmes
0398cd4bd7
fix pylint
2019-12-23 11:56:03 +10:00
Damien Elmes
dfb3cd6444
fix some type errors/lints
2019-12-23 11:32:19 +10:00
Damien Elmes
9e245ae621
apply black to all files
2019-12-23 10:34:10 +10:00
Damien Elmes
79af342ee8
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
dd0bf6a544
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
c4b4f55a7a
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
1fe0d5ff09
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
9c7207e018
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)
090f11847e
Move repeated calls to _renderQA into local function
2019-12-23 00:32:09 +01:00
Michal Pokorný (Rai)
1c2e6666c4
Whitespace reformat to force 80-character line limit
2019-12-23 00:30:59 +01:00
Michal Pokorný (Rai)
02f3e8db98
Merge 'data' variable into its only usage site
2019-12-23 00:29:23 +01:00
Michal Pokorný (Rai)
c1e8e00bb4
Move QA data tuple into separate type alias
2019-12-23 00:27:14 +01:00
Damien Elmes
4f31a070be
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
232e0eafcf
Merge pull request #374 from agentydragon/mathjax-test
...
Fix bug in _removeFormattingFromMathjax
2019-12-23 07:43:16 +10:00
Michal Pokorný (Rai)
d157a006f6
Add some type declarations in tags.py
2019-12-22 14:50:42 +01:00
Michal Pokorný (Rai)
b474c0aa46
Add some type declarations in utils.py
2019-12-22 14:47:07 +01:00
Michal Pokorný (Rai)
0b3dbbbf2f
Don't repeat Python regex docs
2019-12-22 12:43:15 +01:00
Damien Elmes
910d2132df
fix race condition in tmp folder handling
2019-12-22 19:03:20 +10:00
Michal Pokorný (Rai)
8cc0384659
Fix bug in _removeFormattingFromMathjax
2019-12-22 05:47:45 +01:00
Michal Pokorný (Rai)
63ef6cc277
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
ed02a3fc7e
Model->NoteType
2019-12-22 08:58:56 +10:00
Damien Elmes
d1465375a7
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)
c22e22e8ae
Add types for models, templates and field dicts
2019-12-21 12:02:16 +01:00
Damien Elmes
3d9dafb371
avoid noreturn for now, as it's not supported on python <3.6.5
2019-12-21 16:54:40 +10:00
Damien Elmes
829f504740
Merge pull request #363 from ig3/bug/new-perday
...
Use _deckNewLimitSingle in _groupChildrenMain
2019-12-21 07:41:18 +10:00
Damien Elmes
92bdc5ff8a
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
2ac26f03fd
Use _deckNewLimitSingle in _groupChildrenMain
2019-12-21 09:26:51 +13:00
Damien Elmes
8095ad8e4b
use isort to tidy up imports
2019-12-20 19:19:29 +10:00
Damien Elmes
96bb318c8e
add a bunch of extra hints for mypy
2019-12-20 16:40:20 +10:00
Damien Elmes
de89c72511
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
dc0fdaeea5
add a bunch of annotations for mypy
2019-12-20 15:07:40 +10:00