Damien Elmes
9dda5cf6ca
fall back on stock json if orjson unavailable
2020-03-21 21:24:21 +10:00
Damien Elmes
9afbcd4178
remove old finder code; add search hooks to browser & remove old one
2020-03-21 16:38:46 +10:00
Damien Elmes
a5787781d7
add note searching
2020-03-21 09:00:05 +10:00
Damien Elmes
307aadfd8a
don't set deck.sched.today in test
2020-03-21 08:12:32 +10:00
Damien Elmes
daa848bb4d
update tests to reflect what now constitutes an error
2020-03-21 08:12:01 +10:00
Damien Elmes
868c463fb1
tests need to flush before searching
2020-03-21 08:10:52 +10:00
Damien Elmes
5debd3e0f8
add the ability to provide a custom sort order; use backend for find
2020-03-21 07:55:21 +10:00
Damien Elmes
bca5f2ddff
prototype of integration
...
no ordering yet, and no tests
2020-03-20 21:15:23 +10:00
Damien Elmes
d7daa63dbd
make sure we set db to None so we can tell when we've closed the DB
2020-03-20 21:15:23 +10:00
Damien Elmes
ba17567617
drop the separate i18n backend
2020-03-20 21:15:23 +10:00
Damien Elmes
874bc085fe
support opening and closing the DB while keeping backend alive
...
This is safer than just dropping the backend, as .close() will
block if something else is holding the mutex. Also means we can
drop the extra I18nBackend code.
Media syncing still needs fixing.
2020-03-20 21:15:23 +10:00
Damien Elmes
d0d6aa1433
drop usage of flushSched()
2020-03-20 21:15:23 +10:00
Damien Elmes
7986a79530
remove db.close()
2020-03-20 21:15:23 +10:00
Damien Elmes
fa12213e98
move .reopen() to mw; fix exporting
2020-03-20 21:15:23 +10:00
Damien Elmes
0f38514ad7
drop the DB progress handler code
...
This code was an awful hack to provide some semblance of UI
responsiveness while executing DB statements on the main thread.
Instead, we can just run DB statements in a background thread now,
keeping the UI responsive.
2020-03-20 21:15:23 +10:00
Damien Elmes
90de4a267d
drop lock() and setAutocommit()
...
We no longer need to worry about pysqlite implicitly beginning
transactions, and can be more explicit about beginning/ending
transactions
save() now also has a trx argument controlling whether a
transaction should be started / left open
2020-03-20 21:15:23 +10:00
Damien Elmes
63e3357068
pass weakref in from storage to fix type checking/code completion
2020-03-20 21:15:23 +10:00
Damien Elmes
db1508e27c
support first_row_only
2020-03-20 21:15:23 +10:00
Damien Elmes
e14c5e4745
proper implementation of executemany(); drop executescript()
2020-03-20 21:15:23 +10:00
Damien Elmes
ae06b9e446
add Collection struct, and get media check working again
...
- media check no longer needs collection to be closed
- use savepoints for operations initiated by Rust, so they are
atomic without forcing a commit
2020-03-20 21:15:23 +10:00
Damien Elmes
2cd7885ec0
add begin/commit/rollback, and support creating collections
...
all but one unit test is now passing
2020-03-20 21:15:23 +10:00
Damien Elmes
6db4418f05
drop log= argument from Collection
2020-03-20 21:15:23 +10:00
Damien Elmes
818401e464
remove remaining db kwargs
2020-03-20 21:15:23 +10:00
Damien Elmes
874ee80a68
add a temporary executemany()
2020-03-20 21:15:23 +10:00
Damien Elmes
b51e575a9d
drop the protobuf prototype
2020-03-20 21:15:23 +10:00
Damien Elmes
b876d97770
use (or)json for DB bridge
...
Some initial testing with orjson indicates performance varies from
slightly better than pysqlite to about 2x slower depending on the type
of query.
Performance could be improved by building the Python list in rspy
instead of sending back json that needs to be decoded, but it may make
more sense to rewrite the hotspots in Rust instead. More testing is
required in any case.
2020-03-20 21:15:23 +10:00
Damien Elmes
04ca8ec038
initial work on DB handling in Rust
...
committing the Protobuf implementation for posterity, but will replace
it with json, as Protobuf measures about 6x slower for some workloads
like 'select * from notes'
2020-03-20 21:15:23 +10:00
Damien Elmes
77cf7dd4b7
tweak db type hints
2020-03-20 21:15:23 +10:00
Damien Elmes
b5c6134d80
drop usage of pysqlite Cursor
2020-03-20 21:15:23 +10:00
Damien Elmes
0b1d96fce0
tweak layout of db methods
2020-03-20 21:15:23 +10:00
Damien Elmes
5778459d7c
drop .cursor()
2020-03-20 21:15:23 +10:00
Damien Elmes
87415c0d7f
use total_changes() sqlite func
2020-03-20 21:15:23 +10:00
Damien Elmes
5f442ae95e
drop the schema <11 upgrade code
2020-03-20 21:15:23 +10:00
Damien Elmes
527d269681
drop context manager
2020-03-20 21:15:23 +10:00
Damien Elmes
f4d4078537
drop named sql arguments
2020-03-20 21:15:23 +10:00
Damien Elmes
c8b9afac0c
drop progress handler and timeout arg
2020-03-20 21:15:23 +10:00
Damien Elmes
8ef28f8571
drop echo and text factory
2020-03-20 21:15:23 +10:00
Damien Elmes
c1252d68f0
clone db.py into dbproxy.py
2020-03-20 21:15:23 +10:00
evandrocoan
1ade1a1a0f
Fixed moved comment line on qt/aqt/main.py, long variables names on
...
pylib/Makefile and qt/Makefile, and rg --version not going to /dev/null
on .github/scripts/trailing-newlines.sh
2020-03-18 11:36:50 -03:00
evandrocoan
802c5b59cb
Fixed mypy and pylint not building on Windows
...
1. error: unused 'type: ignore' comment
2. Module 'pywintypes' has no 'error' member
3. Module 'win32pipe' has no 'SetNamedPipeHandleState' member,
but source is unavailable. Consider adding this module to
extension-pkg-whitelist if you want to perform analysis based on
run-time introspection of living objects.
2020-03-17 19:48:16 -03:00
evandrocoan
07a24c0d42
Fixed make check for pylint not working on Windows due
...
F:\Python\python.exe: can't open file '/cygdrive/f/anki/pyenv/Scripts/pylint': [Errno 2] No such file or directory
2020-03-17 19:48:16 -03:00
evandrocoan
88ea0b18bf
Fixed test_importing.py unit tests failing on windows with
...
PermissionError: [Errno 13] Permission denied
2020-03-17 12:49:36 -03:00
evandrocoan
9dd54c421b
Fixed UnicodeEncodeError: 'charmap' codec can't encode character
...
'\u2068' in position 2724: character maps to <undefined> for
pylib/tests/test_stats.py
2020-03-17 12:49:25 -03:00
evandrocoan
2e54d315e1
Fixed BeautifulSoup breaking string paths
...
https://anki.tenderapp.com/discussions/ankidesktop/39543-anki-is-replacing-the-character-by-when-i-exit-the-html-edit-mode-ctrlshiftx
2020-03-12 21:19:09 -03:00
Damien Elmes
1f26bac890
Merge pull request #501 from evandroforks/fix_beautiful_soup
...
Renamed BeautifulSoup import name for consistency with other usages of it
2020-03-11 15:55:15 +10:00
Damien Elmes
2f24e3f5e2
don't error when an add-on passes None to CardStats
...
https://anki.tenderapp.com/discussions/beta-testing/1842-syncing-message
2020-03-11 15:18:28 +10:00
Damien Elmes
5fd2eaba21
Spanish is 'es' on disk
2020-03-11 14:53:19 +10:00
Damien Elmes
25724c28b6
Revert "es-ES -> es"
...
This reverts commit eae52de71e
.
This change broke Anki:
https://anki.tenderapp.com/discussions/ankidesktop/39589-lang_to_disk_lang-startup-error
2020-03-11 14:52:35 +10:00
evandrocoan
c7bf6f3a8d
Renamed _decode_htmlescapes s variable
2020-03-10 13:57:09 -03:00
Damien Elmes
131d37dca5
add switch in prefs for new timezone handling code; bump sync version
...
AD devs: before updating the sync version to 10, please make sure
the new timezone code has been ported over. The core change to the
scheduler is in _updateCutoff():
9736e4a970/pylib/anki/schedv2.py (L1357)
with the following supporting Python functions:
9736e4a970/pylib/anki/schedv2.py (L1410)
_timing_today() is calculated in Rust (lines up to 92, the rest are
tests):
9736e4a970/rslib/src/sched/cutoff.rs (L20)
The change went through a few iterations before stabilising, so it's
probably easier to refer to the above code than the patches that got
us to that point.
2020-03-10 17:50:18 +10:00
Damien Elmes
0f4c3ab611
add restore media action
2020-03-10 13:35:09 +10:00
Damien Elmes
6ad2a1f9a3
add empty trash action in aqt
2020-03-10 12:49:40 +10:00
Damien Elmes
862e2b48f0
add col.weakref() and fix more reference cycles in pylib
2020-03-05 09:47:47 +10:00
Damien Elmes
6b204274c0
fix retain cycle caused by col.tr
...
We can't use a weakref.proxy with a method, so manually proxy the
call instead.
2020-03-05 09:45:51 +10:00
Arthur Milchior
0c9de3b19c
hooks for limit new/rev for a single deck
2020-03-04 16:11:13 +01:00
Arthur Milchior
c4b2ab96a6
single return in sched2 _deckRevLimitSingle
2020-03-04 16:07:15 +01:00
Damien Elmes
c35afd4aaa
add diffing script
2020-03-04 21:34:18 +10:00
Damien Elmes
e95eea68ec
remove a few more common methods
2020-03-04 21:33:44 +10:00
Damien Elmes
c14132332b
use _deckLimit() in a few more places
2020-03-04 21:24:09 +10:00
Damien Elmes
f054fa14d6
reuse _leftToday()
2020-03-04 12:26:57 +10:00
Damien Elmes
0e8339358b
import tidyup
2020-03-04 12:25:02 +10:00
Damien Elmes
e8bdd8616b
reuse _deckNewLimitSingle()
2020-03-04 12:23:56 +10:00
Damien Elmes
2079854d3f
reuse v2's _logRev()
2020-03-04 12:23:42 +10:00
Damien Elmes
961026b04b
remove duplicate methods from sched.py
2020-03-04 12:14:26 +10:00
Damien Elmes
1c09d80558
add some type hints that were only in the v1 scheduler
2020-03-04 12:10:38 +10:00
Damien Elmes
8c3e4a8bee
make v1 scheduler inherit from v2 so we can delete duplicate code
2020-03-04 11:41:23 +10:00
Damien Elmes
ffe6ecf44c
use weakref for backrefs so collection doesn't need to be garbage collected
2020-03-03 21:25:32 +10:00
Damien Elmes
a8e6fbd0fd
fix backend not deallocating due to circular reference
2020-03-03 21:12:38 +10:00
Damien Elmes
9f73d67b5a
Merge pull request #478 from Arthur-Milchior/missing_constant
...
countsIdx return a queue type.
2020-03-02 15:43:31 +10:00
Alan Du
6c2dda6c9c
Monkeytype qt/aqt/reviewer.py
2020-03-01 10:16:08 -05:00
Arthur Milchior
ab9999dbc9
countsIdx return a queue type.
...
I missed this constant before
2020-03-01 13:00:36 +01:00
Damien Elmes
8960d12aac
add nfd tag fix to db check
...
we already normalize in the editor and importing, so perhaps these
tags were from an old version
https://anki.tenderapp.com/discussions/ankidesktop/39120-bug-filter-do-not-work-with-tags-which-contain-german-letters-like
2020-03-01 11:21:25 +10:00
Damien Elmes
7bde0556cb
Merge pull request #473 from evandroforks/fix_docs_urllink
...
Fixed anki website docs link on pylib/anki/consts.py
2020-02-29 21:39:11 +10:00
Damien Elmes
ba4fe71eba
make logging explicit, and support logging to a file
2020-02-29 20:44:01 +10:00
evandrocoan
21b66cd86b
Fixed anki website docs link on pylib/anki/consts.py
2020-02-28 22:18:19 -03:00
Alan Du
7c971837ff
Add some more types
2020-02-27 21:27:59 -05:00
Alan Du
f8af9c509b
Monkeytype pylib/anki/importing/supermemo_xml.py
2020-02-27 19:27:32 -05:00
Alan Du
2879dc1158
Type pylib/anki/schedv2.py
2020-02-27 19:27:32 -05:00
Alan Du
b451f4e3f2
Monkeytype anki/rsbackend.py
2020-02-27 19:27:32 -05:00
Alan Du
02dd30f2a0
Monkeytype pylib/anki/sched.py
2020-02-27 19:27:32 -05:00
Alan Du
b157ee7570
Monkeytype pylib/anki/find.py
2020-02-27 19:27:32 -05:00
Damien Elmes
43f5d13ed6
migrate strings with trailing newlines to fluent
2020-02-27 20:36:40 +10:00
Alan Du
2476e120ad
Fix type warning
2020-02-27 00:07:19 -05:00
Alan Du
53b088f09a
Monkeytype pylib/anki/latex.py
2020-02-27 00:07:19 -05:00
Alan Du
b83e44b688
Monkeytype pylib/anki/stdmodels.py
2020-02-27 00:07:19 -05:00
Alan Du
ad90af3c37
Monkeytype pylib/anki/stats.py
2020-02-27 00:07:19 -05:00
Alan Du
1942d97cf5
Monkeytype pylib/anki/template.py
2020-02-27 00:07:19 -05:00
Alan Du
78a002d666
Monkeytype anki/tags.py
2020-02-27 00:07:19 -05:00
Alan Du
ac76c61a2f
Monkeytype pylib/anki/errors.py
2020-02-27 00:07:19 -05:00
Alan Du
750a3e4aed
Monkeytype pylib/anki/db.py
2020-02-27 00:07:19 -05:00
Alan Du
948c09e84b
Monkeytype pylib/anki/decks.py
2020-02-27 00:07:19 -05:00
evandrocoan
ba3a84f89a
Merge remote-tracking branch 'danielelmes/master' into fix_windows_build
...
# Conflicts:
# CONTRIBUTORS
2020-02-27 00:54:16 -03:00
Alan Du
cbeb47f8df
Improve mypy config
...
- Make mypy stricter
- Warn for unnecessary workarounds
2020-02-26 22:22:40 -05:00
evandrocoan
dc049ce26a
Merge remote-tracking branch 'danielelmes/master' into fix_windows_build
...
# Conflicts:
# Makefile
2020-02-27 00:20:34 -03:00
Damien Elmes
4d917cc65b
add self.col.tr() shortcut
2020-02-27 12:33:15 +10:00
Damien Elmes
0c49431719
FString -> TR
2020-02-27 12:25:19 +10:00
Damien Elmes
644670d0d6
return a localized error for all error kinds
...
some errors are not yet localized, but now the Python code
doesn't need to think about which property to use
2020-02-27 10:46:24 +10:00
Damien Elmes
fbbbbd6a7d
tweak rounding
...
- avoid rounding minutes
- round the seconds taken in the card info screen
- provide different precise and imprecise modes, since we need
to display seconds to multiple decimals in some areas
2020-02-25 17:29:06 +10:00
evandrocoan
ac4933faca
Merge remote-tracking branch 'danielelmes/master' into fix_windows_build
...
# Conflicts:
# Makefile
2020-02-25 03:16:57 -03:00
evandrocoan
26cdff29ec
Renamed FIND_EXEC to FIND, replaced IS_WINDOWS by specific commands
...
as PYTHON_BIN, ACTIVE_SCRIPT and INSTALL_PYAUDIO.
Fixed echo statements not using @ to suppress double message output.
Deprecated the usage of ECHOCMD := /bin/echo -e because it has no
effect: https://stackoverflow.com/questions/60387684/how-to-make-the-makefile-echos-to-use-bin-echo-e
# Conflicts:
# Makefile
2020-02-25 03:15:11 -03:00