├── qt ├── aqt │ ├── py.typed │ ├── data │ │ ├── web │ │ │ ├── .prettierrc │ │ │ ├── imgs │ │ │ │ ├── more.png │ │ │ │ ├── text_sub.png │ │ │ │ ├── paperclip.png │ │ │ │ ├── text_bold.png │ │ │ │ ├── text_clear.png │ │ │ │ ├── text_cloze.png │ │ │ │ ├── text_super.png │ │ │ │ ├── text_under.png │ │ │ │ ├── media-record.png │ │ │ │ ├── text_italic.png │ │ │ │ ├── anki-logo-thin.png │ │ │ │ ├── BUILD.bazel │ │ │ │ └── refresh.svg │ │ │ ├── js │ │ │ │ ├── pycmd.d.ts │ │ │ │ ├── vendor │ │ │ │ │ ├── mathjax │ │ │ │ │ │ └── BUILD.bazel │ │ │ │ │ ├── BUILD.bazel │ │ │ │ │ └── browsersel.js │ │ │ │ ├── overview.ts │ │ │ │ ├── tsconfig.json │ │ │ │ ├── compile_ts.bzl │ │ │ │ ├── toolbar.ts │ │ │ │ ├── webview.ts │ │ │ │ ├── mathjax.js │ │ │ │ ├── deckbrowser.ts │ │ │ │ └── BUILD.bazel │ │ │ ├── BUILD.bazel │ │ │ ├── css │ │ │ │ ├── toolbar-bottom.scss │ │ │ │ ├── _card_counts.scss │ │ │ │ ├── BUILD.bazel │ │ │ │ ├── overview.scss │ │ │ │ ├── compile_sass.bzl │ │ │ │ └── webview.scss │ │ │ └── pages │ │ │ │ ├── defs.bzl │ │ │ │ └── BUILD.bazel │ │ └── BUILD.bazel │ ├── hooks_gen.py │ ├── wheel_description.txt │ ├── forms │ │ ├── icons │ │ │ ├── anki.png │ │ │ ├── media-record.png │ │ │ ├── heart.svg │ │ │ └── tag.svg │ │ ├── icons.qrc │ │ ├── build_rcc.py │ │ ├── compile.bzl │ │ ├── BUILD.bazel │ │ └── __init__.py │ ├── gui_hooks.py │ ├── schema_change_tracker.py │ └── pinnedmodules.py ├── tests │ ├── __init__.py │ ├── run_pytest.py │ ├── test_i18n.py │ ├── run_pylint.py │ ├── run_mypy.py │ └── run_format.py ├── README.md ├── linux │ ├── anki.png │ ├── README.md │ ├── anki.desktop │ ├── uninstall.sh │ ├── README.dist │ ├── anki.xml │ └── install.sh ├── tools │ ├── runanki.system.in │ ├── profile.py │ ├── extract_sass_colors.py │ └── build_ui.sh ├── .isort.cfg ├── runanki.py ├── .pylintrc └── bazelfixes.py ├── .bazelversion ├── pip ├── pyqt5 │ └── BUILD.bazel ├── update.py ├── BUILD.bazel ├── licenses.sh ├── requirements.in └── README.md ├── pylib ├── anki │ ├── py.typed │ ├── hooks_gen.py │ ├── backend_pb2.pyi │ ├── fluent_pb2.pyi │ ├── rsbackend_gen.py │ ├── wheel_description.txt │ ├── types.py │ ├── storage.py │ ├── sync.py │ ├── _rsbridge.pyi │ ├── statsbg.py │ ├── __init__.py │ ├── errors.py │ ├── buildinfo.py │ ├── importing │ │ ├── __init__.py │ │ └── base.py │ └── sound.py ├── tests │ ├── __init__.py │ ├── support │ │ ├── fake.png │ │ ├── text-update.txt │ │ ├── text-tags.txt │ │ ├── mnemo.db │ │ ├── media.apkg │ │ ├── anki12.anki │ │ ├── update1.apkg │ │ ├── update2.apkg │ │ ├── anki12-due.anki │ │ ├── anki12-broken.anki │ │ ├── anki2-alpha.anki2 │ │ ├── diffmodels1.anki │ │ ├── diffmodels2-1.apkg │ │ ├── diffmodels2-2.apkg │ │ ├── diffmodels2.anki │ │ ├── invalid-ords.anki │ │ ├── suspended12.anki │ │ ├── diffmodeltemplates-1.apkg │ │ ├── diffmodeltemplates-2.apkg │ │ └── text-2fields.txt │ ├── test_template.py │ ├── run_pylint.py │ ├── run_pytest.py │ ├── run_mypy.py │ ├── test_stats.py │ └── test_flags.py ├── tools │ ├── __init__.py │ ├── diff-sched.py │ └── protoc_wrapper.py ├── rsbridge │ ├── .gitignore │ ├── build.rs │ ├── cargo │ │ └── BUILD.bazel │ ├── Cargo.toml │ └── BUILD.bazel ├── README.md ├── .gitignore ├── .isort.cfg ├── .pylintrc └── mypy.ini ├── rslib ├── templates │ └── .empty ├── .gitignore ├── src │ ├── backend_proto.rs │ ├── fluent_proto.rs │ ├── storage │ │ ├── config │ │ │ ├── get.sql │ │ │ └── add.sql │ │ ├── notetype │ │ │ ├── get_notetype_names.sql │ │ │ ├── update_fields.sql │ │ │ ├── get_notetype.sql │ │ │ ├── update_notetype_config.sql │ │ │ ├── get_fields.sql │ │ │ ├── update_templates.sql │ │ │ ├── add_or_update.sql │ │ │ ├── update_notetype_core.sql │ │ │ ├── get_templates.sql │ │ │ ├── highest_card_ord.sql │ │ │ ├── field_names_for_notes.sql │ │ │ ├── delete_cards_for_template.sql │ │ │ ├── get_use_counts.sql │ │ │ ├── add_notetype.sql │ │ │ └── existing_cards.sql │ │ ├── tag │ │ │ └── add.sql │ │ ├── note │ │ │ ├── is_orphaned.sql │ │ │ ├── get.sql │ │ │ ├── update.sql │ │ │ ├── add_or_update.sql │ │ │ └── add.sql │ │ ├── graves │ │ │ └── add.sql │ │ ├── deck │ │ │ ├── get_deck.sql │ │ │ ├── update_deck.sql │ │ │ ├── cards_for_deck.sql │ │ │ ├── missing-decks.sql │ │ │ ├── update_active.sql │ │ │ ├── alloc_id.sql │ │ │ └── due_counts.sql │ │ ├── deckconf │ │ │ ├── get.sql │ │ │ ├── add_or_update.sql │ │ │ ├── update.sql │ │ │ └── add.sql │ │ ├── card │ │ │ ├── at_or_above_position.sql │ │ │ ├── search_cids_setup_ordered.sql │ │ │ ├── search_cids_setup.sql │ │ │ ├── fix_ivl.sql │ │ │ ├── fix_low_ease.sql │ │ │ ├── get_card.sql │ │ │ ├── update_card.sql │ │ │ ├── fix_due_new.sql │ │ │ ├── fix_due_other.sql │ │ │ ├── add_or_update.sql │ │ │ ├── fix_odue.sql │ │ │ ├── add_card.sql │ │ │ └── congrats.sql │ │ ├── revlog │ │ │ ├── studied_today.sql │ │ │ ├── get.sql │ │ │ ├── fix_props.sql │ │ │ └── add.sql │ │ └── upgrades │ │ │ ├── schema11_downgrade.sql │ │ │ └── schema14_upgrade.sql │ ├── search │ │ ├── mod.rs │ │ ├── deck_order.sql │ │ ├── notetype_order.sql │ │ ├── template_order.sql │ │ └── notes.rs │ ├── notetype │ │ ├── styling.css │ │ └── header.tex │ ├── stats │ │ ├── mod.rs │ │ └── card_stats.html │ ├── media │ │ └── schema.sql │ ├── prelude.rs │ ├── decks │ │ └── counts.rs │ ├── lib.rs │ └── version.rs ├── .cargo │ └── config ├── tests │ └── support │ │ └── mediacheck.anki2 ├── README.md └── build │ ├── write_fluent_proto.rs │ └── main.rs ├── cargo ├── remote │ ├── BUILD.bazel │ ├── BUILD.tap-1.0.0.bazel │ ├── BUILD.funty-1.1.0.bazel │ ├── BUILD.winapi-0.2.8.bazel │ ├── BUILD.take_mut-0.2.2.bazel │ ├── BUILD.try-lock-0.2.3.bazel │ ├── BUILD.ipnet-2.3.0.bazel │ ├── BUILD.nodrop-0.1.14.bazel │ ├── BUILD.sha1-0.6.0.bazel │ ├── BUILD.tower-service-0.3.0.bazel │ ├── BUILD.vcpkg-0.2.11.bazel │ ├── BUILD.wyz-0.2.0.bazel │ ├── BUILD.httpdate-0.3.2.bazel │ ├── BUILD.multimap-0.8.2.bazel │ ├── BUILD.unindent-0.1.7.bazel │ ├── BUILD.openssl-probe-0.1.2.bazel │ ├── BUILD.percent-encoding-2.1.0.bazel │ ├── BUILD.rustc-demangle-0.1.18.bazel │ ├── BUILD.version_check-0.9.2.bazel │ ├── BUILD.static_assertions-1.1.0.bazel │ ├── BUILD.foreign-types-shared-0.1.1.bazel │ ├── BUILD.futures-io-0.3.8.bazel │ ├── BUILD.tinyvec_macros-0.1.0.bazel │ ├── BUILD.fallible-streaming-iterator-0.1.9.bazel │ ├── BUILD.fnv-1.0.7.bazel │ ├── BUILD.either-1.6.1.bazel │ ├── BUILD.slab-0.4.2.bazel │ ├── BUILD.ppv-lite86-0.2.10.bazel │ ├── BUILD.spin-0.5.2.bazel │ ├── BUILD.type-map-0.3.0.bazel │ ├── BUILD.matches-0.1.8.bazel │ ├── BUILD.rand_hc-0.2.0.bazel │ ├── BUILD.untrusted-0.7.1.bazel │ ├── BUILD.cfg-if-0.1.10.bazel │ ├── BUILD.cfg-if-1.0.0.bazel │ ├── BUILD.fallible-iterator-0.2.0.bazel │ ├── BUILD.lock_api-0.4.2.bazel │ ├── BUILD.stable_deref_trait-1.2.0.bazel │ ├── BUILD.subtle-2.4.0.bazel │ ├── BUILD.heck-0.3.2.bazel │ ├── BUILD.proc-macro-crate-0.1.5.bazel │ ├── BUILD.adler-0.2.3.bazel │ ├── BUILD.fixedbitset-0.2.0.bazel │ ├── BUILD.futures-core-0.3.8.bazel │ └── BUILD.futures-sink-0.3.8.bazel ├── BUILD.bazel └── README.md ├── .bazelignore ├── ts ├── .gitignore ├── vendor │ └── BUILD.bazel ├── .prettierignore ├── .prettierrc ├── lib │ ├── typing.ts │ ├── bridgecommand.ts │ ├── nightmode.ts │ ├── cards.ts │ └── postrequest.ts ├── graphs │ ├── d3_missing.d.ts │ ├── NoDataOverlay.svelte │ ├── AxisTicks.svelte │ ├── graphs.html │ ├── bootstrap.ts │ ├── TableData.svelte │ ├── TodayStats.svelte │ ├── HistogramGraph.svelte │ ├── tooltip.ts │ └── EaseGraph.svelte ├── format.sh ├── README.md ├── BUILD.bazel ├── update.sh ├── sass │ ├── core.scss │ └── BUILD.bazel ├── congrats │ ├── congrats.html │ └── bootstrap.ts ├── eslint.bzl ├── .eslintrc.js ├── prettier.bzl ├── svelte.bzl └── rollup.config.js ├── .gitattributes ├── scripts ├── runopt.bat ├── runopt ├── status.sh ├── BUILD.bazel ├── build ├── build.bat └── buildinfo.py ├── .gitignore ├── ftl ├── core │ ├── filtering.ftl │ ├── findreplace.ftl │ ├── search.ftl │ ├── deck-config.ftl │ ├── network.ftl │ ├── adding.ftl │ ├── media.ftl │ ├── empty-cards.ftl │ ├── fields.ftl │ ├── card-stats.ftl │ └── actions.ftl ├── README.md ├── format_check.py ├── qt │ ├── profiles.ftl │ ├── preferences.ftl │ ├── about.ftl │ └── qt-accel.ftl └── extract-strings.py ├── run.bat ├── bazel.bat ├── platforms ├── README.md └── BUILD.bazel ├── late_deps.bzl ├── WORKSPACE ├── README.md ├── .buildkite ├── mac │ └── entrypoint └── linux │ ├── entrypoint │ └── check_contributors ├── run ├── Cargo.toml ├── BUILD.bazel └── .bazelrc /qt/aqt/py.typed: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.bazelversion: -------------------------------------------------------------------------------- 1 | 3.7.0 2 | -------------------------------------------------------------------------------- /pip/pyqt5/BUILD.bazel: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /pylib/anki/py.typed: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /pylib/tests/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /pylib/tools/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /qt/tests/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /rslib/templates/.empty: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /cargo/remote/BUILD.bazel: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.bazelignore: -------------------------------------------------------------------------------- 1 | ts/node_modules 2 | -------------------------------------------------------------------------------- /ts/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto eol=lf 2 | -------------------------------------------------------------------------------- /pylib/tests/support/fake.png: -------------------------------------------------------------------------------- 1 | abc 2 | -------------------------------------------------------------------------------- /pylib/tests/support/text-update.txt: -------------------------------------------------------------------------------- 1 | 1 x 2 | -------------------------------------------------------------------------------- /qt/README.md: -------------------------------------------------------------------------------- 1 | Python's Qt GUI is in aqt/ 2 | -------------------------------------------------------------------------------- /pylib/rsbridge/.gitignore: -------------------------------------------------------------------------------- 1 | target 2 | Cargo.lock 3 | -------------------------------------------------------------------------------- /qt/aqt/data/web/.prettierrc: -------------------------------------------------------------------------------- 1 | ../../../../ts/.prettierrc -------------------------------------------------------------------------------- /rslib/.gitignore: -------------------------------------------------------------------------------- 1 | Cargo.lock 2 | .build 3 | target 4 | -------------------------------------------------------------------------------- /qt/aqt/hooks_gen.py: -------------------------------------------------------------------------------- 1 | ../../bazel-bin/qt/aqt/hooks_gen.py -------------------------------------------------------------------------------- /ts/vendor/BUILD.bazel: -------------------------------------------------------------------------------- 1 | exports_files(glob(["*.js"])) 2 | -------------------------------------------------------------------------------- /pylib/anki/hooks_gen.py: -------------------------------------------------------------------------------- 1 | ../../bazel-bin/pylib/anki/hooks_gen.py -------------------------------------------------------------------------------- /pylib/anki/backend_pb2.pyi: -------------------------------------------------------------------------------- 1 | ../../bazel-bin/pylib/anki/backend_pb2.pyi -------------------------------------------------------------------------------- /pylib/anki/fluent_pb2.pyi: -------------------------------------------------------------------------------- 1 | ../../bazel-bin/pylib/anki/fluent_pb2.pyi -------------------------------------------------------------------------------- /qt/aqt/wheel_description.txt: -------------------------------------------------------------------------------- 1 | Please see https://apps.ankiweb.net 2 | -------------------------------------------------------------------------------- /scripts/runopt.bat: -------------------------------------------------------------------------------- 1 | set BUILDARGS=-c opt 2 | call .\run.bat %* 3 | -------------------------------------------------------------------------------- /pylib/anki/rsbackend_gen.py: -------------------------------------------------------------------------------- 1 | ../../bazel-bin/pylib/anki/rsbackend_gen.py -------------------------------------------------------------------------------- /pylib/anki/wheel_description.txt: -------------------------------------------------------------------------------- 1 | Please see https://apps.ankiweb.net 2 | -------------------------------------------------------------------------------- /pylib/tests/support/text-tags.txt: -------------------------------------------------------------------------------- 1 | foo bar baz,qux 2 | foo2 bar2 baz2 3 | -------------------------------------------------------------------------------- /ts/.prettierignore: -------------------------------------------------------------------------------- 1 | src/backend/proto.d.ts 2 | licenses.json 3 | vendor 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | __pycache__ 2 | .DS_Store 3 | /bazel-* 4 | anki.prof 5 | user.bazelrc 6 | -------------------------------------------------------------------------------- /qt/linux/anki.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binhetech/anki/master/qt/linux/anki.png -------------------------------------------------------------------------------- /rslib/src/backend_proto.rs: -------------------------------------------------------------------------------- 1 | include!(concat!(env!("OUT_DIR"), "/backend_proto.rs")); 2 | -------------------------------------------------------------------------------- /rslib/src/fluent_proto.rs: -------------------------------------------------------------------------------- 1 | include!(concat!(env!("OUT_DIR"), "/fluent_proto.rs")); 2 | -------------------------------------------------------------------------------- /rslib/src/storage/config/get.sql: -------------------------------------------------------------------------------- 1 | select 2 | val 3 | from config 4 | where 5 | key = ? -------------------------------------------------------------------------------- /ftl/core/filtering.ftl: -------------------------------------------------------------------------------- 1 | # True if a card is due/ready for review 2 | filtering-is-due = Due 3 | -------------------------------------------------------------------------------- /rslib/src/storage/notetype/get_notetype_names.sql: -------------------------------------------------------------------------------- 1 | select 2 | id, 3 | name 4 | from notetypes -------------------------------------------------------------------------------- /rslib/src/storage/tag/add.sql: -------------------------------------------------------------------------------- 1 | insert 2 | or ignore into tags (tag, usn) 3 | values 4 | (?, ?) -------------------------------------------------------------------------------- /run.bat: -------------------------------------------------------------------------------- 1 | set PYTHONWARNINGS=default 2 | call .\bazel.bat run %BUILDARGS% //qt:runanki -k -- %* 3 | -------------------------------------------------------------------------------- /scripts/runopt: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | BUILDARGS="-c opt" $(dirname $0)/../run 6 | -------------------------------------------------------------------------------- /pylib/tests/support/mnemo.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binhetech/anki/master/pylib/tests/support/mnemo.db -------------------------------------------------------------------------------- /qt/aqt/forms/icons/anki.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binhetech/anki/master/qt/aqt/forms/icons/anki.png -------------------------------------------------------------------------------- /rslib/src/storage/note/is_orphaned.sql: -------------------------------------------------------------------------------- 1 | select 2 | count(id) = 0 3 | from cards 4 | where 5 | nid = ?; -------------------------------------------------------------------------------- /bazel.bat: -------------------------------------------------------------------------------- 1 | @set PATH=c:\msys64\usr\bin;c:\python;%PATH% 2 | \bazel\bazel --output_user_root=\bazel\anki %* 3 | -------------------------------------------------------------------------------- /pylib/tests/support/media.apkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binhetech/anki/master/pylib/tests/support/media.apkg -------------------------------------------------------------------------------- /qt/aqt/data/web/imgs/more.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binhetech/anki/master/qt/aqt/data/web/imgs/more.png -------------------------------------------------------------------------------- /qt/aqt/data/web/js/pycmd.d.ts: -------------------------------------------------------------------------------- 1 | declare function pycmd(cmd: string, result_callback?: (arg: any) => void): any; 2 | -------------------------------------------------------------------------------- /rslib/src/storage/graves/add.sql: -------------------------------------------------------------------------------- 1 | insert 2 | or ignore into graves (usn, oid, type) 3 | values 4 | (?, ?, ?) -------------------------------------------------------------------------------- /scripts/status.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "STABLE_BUILDHASH $(git rev-parse --short=8 HEAD || echo nogit)" 4 | -------------------------------------------------------------------------------- /pylib/tests/support/anki12.anki: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binhetech/anki/master/pylib/tests/support/anki12.anki -------------------------------------------------------------------------------- /pylib/tests/support/update1.apkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binhetech/anki/master/pylib/tests/support/update1.apkg -------------------------------------------------------------------------------- /pylib/tests/support/update2.apkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binhetech/anki/master/pylib/tests/support/update2.apkg -------------------------------------------------------------------------------- /qt/aqt/data/web/imgs/text_sub.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binhetech/anki/master/qt/aqt/data/web/imgs/text_sub.png -------------------------------------------------------------------------------- /pylib/tests/support/anki12-due.anki: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binhetech/anki/master/pylib/tests/support/anki12-due.anki -------------------------------------------------------------------------------- /qt/aqt/data/web/imgs/paperclip.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binhetech/anki/master/qt/aqt/data/web/imgs/paperclip.png -------------------------------------------------------------------------------- /qt/aqt/data/web/imgs/text_bold.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binhetech/anki/master/qt/aqt/data/web/imgs/text_bold.png -------------------------------------------------------------------------------- /qt/aqt/data/web/imgs/text_clear.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binhetech/anki/master/qt/aqt/data/web/imgs/text_clear.png -------------------------------------------------------------------------------- /qt/aqt/data/web/imgs/text_cloze.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binhetech/anki/master/qt/aqt/data/web/imgs/text_cloze.png -------------------------------------------------------------------------------- /qt/aqt/data/web/imgs/text_super.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binhetech/anki/master/qt/aqt/data/web/imgs/text_super.png -------------------------------------------------------------------------------- /qt/aqt/data/web/imgs/text_under.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binhetech/anki/master/qt/aqt/data/web/imgs/text_under.png -------------------------------------------------------------------------------- /qt/aqt/forms/icons/media-record.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binhetech/anki/master/qt/aqt/forms/icons/media-record.png -------------------------------------------------------------------------------- /rslib/.cargo/config: -------------------------------------------------------------------------------- 1 | [profile.release] 2 | #opt-level = 3 3 | lto = false 4 | incremental = true 5 | codegen-units = 256 6 | -------------------------------------------------------------------------------- /rslib/src/search/mod.rs: -------------------------------------------------------------------------------- 1 | mod cards; 2 | mod notes; 3 | mod parser; 4 | mod sqlwriter; 5 | 6 | pub use cards::SortMode; 7 | -------------------------------------------------------------------------------- /rslib/src/storage/notetype/update_fields.sql: -------------------------------------------------------------------------------- 1 | insert into fields (ntid, ord, name, config) 2 | values 3 | (?, ?, ?, ?); -------------------------------------------------------------------------------- /ftl/README.md: -------------------------------------------------------------------------------- 1 | Files related to Anki's translations. 2 | 3 | Please see https://translating.ankiweb.net/#/anki/developers 4 | -------------------------------------------------------------------------------- /pylib/tests/support/anki12-broken.anki: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binhetech/anki/master/pylib/tests/support/anki12-broken.anki -------------------------------------------------------------------------------- /pylib/tests/support/anki2-alpha.anki2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binhetech/anki/master/pylib/tests/support/anki2-alpha.anki2 -------------------------------------------------------------------------------- /pylib/tests/support/diffmodels1.anki: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binhetech/anki/master/pylib/tests/support/diffmodels1.anki -------------------------------------------------------------------------------- /pylib/tests/support/diffmodels2-1.apkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binhetech/anki/master/pylib/tests/support/diffmodels2-1.apkg -------------------------------------------------------------------------------- /pylib/tests/support/diffmodels2-2.apkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binhetech/anki/master/pylib/tests/support/diffmodels2-2.apkg -------------------------------------------------------------------------------- /pylib/tests/support/diffmodels2.anki: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binhetech/anki/master/pylib/tests/support/diffmodels2.anki -------------------------------------------------------------------------------- /pylib/tests/support/invalid-ords.anki: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binhetech/anki/master/pylib/tests/support/invalid-ords.anki -------------------------------------------------------------------------------- /pylib/tests/support/suspended12.anki: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binhetech/anki/master/pylib/tests/support/suspended12.anki -------------------------------------------------------------------------------- /qt/aqt/data/web/imgs/media-record.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binhetech/anki/master/qt/aqt/data/web/imgs/media-record.png -------------------------------------------------------------------------------- /qt/aqt/data/web/imgs/text_italic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binhetech/anki/master/qt/aqt/data/web/imgs/text_italic.png -------------------------------------------------------------------------------- /rslib/src/storage/config/add.sql: -------------------------------------------------------------------------------- 1 | insert 2 | or replace into config (key, usn, mtime_secs, val) 3 | values 4 | (?, ?, ?, ?) -------------------------------------------------------------------------------- /rslib/tests/support/mediacheck.anki2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binhetech/anki/master/rslib/tests/support/mediacheck.anki2 -------------------------------------------------------------------------------- /ts/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "trailingComma": "es5", 3 | "printWidth": 88, 4 | "tabWidth": 4, 5 | "semi": true 6 | } 7 | -------------------------------------------------------------------------------- /ts/lib/typing.ts: -------------------------------------------------------------------------------- 1 | export function assertUnreachable(x: never): never { 2 | throw new Error(`unreachable: ${x}`); 3 | } 4 | -------------------------------------------------------------------------------- /qt/aqt/data/web/imgs/anki-logo-thin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binhetech/anki/master/qt/aqt/data/web/imgs/anki-logo-thin.png -------------------------------------------------------------------------------- /rslib/src/storage/deck/get_deck.sql: -------------------------------------------------------------------------------- 1 | select 2 | id, 3 | name, 4 | mtime_secs, 5 | usn, 6 | common, 7 | kind 8 | from decks -------------------------------------------------------------------------------- /rslib/src/storage/deckconf/get.sql: -------------------------------------------------------------------------------- 1 | select 2 | id, 3 | name, 4 | mtime_secs, 5 | usn, 6 | config 7 | from deck_config 8 | -------------------------------------------------------------------------------- /rslib/src/storage/note/get.sql: -------------------------------------------------------------------------------- 1 | select 2 | id, 3 | guid, 4 | mid, 5 | mod, 6 | usn, 7 | tags, 8 | flds 9 | from notes -------------------------------------------------------------------------------- /rslib/src/storage/notetype/get_notetype.sql: -------------------------------------------------------------------------------- 1 | select 2 | id, 3 | name, 4 | mtime_secs, 5 | usn, 6 | config 7 | from notetypes 8 | -------------------------------------------------------------------------------- /rslib/src/storage/notetype/update_notetype_config.sql: -------------------------------------------------------------------------------- 1 | insert 2 | or replace into notetype_config (ntid, config) 3 | values 4 | (?, ?) -------------------------------------------------------------------------------- /pylib/tests/support/diffmodeltemplates-1.apkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binhetech/anki/master/pylib/tests/support/diffmodeltemplates-1.apkg -------------------------------------------------------------------------------- /pylib/tests/support/diffmodeltemplates-2.apkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binhetech/anki/master/pylib/tests/support/diffmodeltemplates-2.apkg -------------------------------------------------------------------------------- /rslib/src/storage/card/at_or_above_position.sql: -------------------------------------------------------------------------------- 1 | insert into search_cids 2 | select id 3 | from cards 4 | where due >= ? 5 | and type = ? -------------------------------------------------------------------------------- /rslib/src/storage/card/search_cids_setup_ordered.sql: -------------------------------------------------------------------------------- 1 | drop table if exists search_cids; 2 | create temporary table search_cids (cid integer not null); -------------------------------------------------------------------------------- /rslib/src/storage/notetype/get_fields.sql: -------------------------------------------------------------------------------- 1 | select 2 | ord, 3 | name, 4 | config 5 | from fields 6 | where 7 | ntid = ? 8 | order by 9 | ord -------------------------------------------------------------------------------- /rslib/src/storage/notetype/update_templates.sql: -------------------------------------------------------------------------------- 1 | insert into templates (ntid, ord, name, mtime_secs, usn, config) 2 | values 3 | (?, ?, ?, ?, ?, ?) -------------------------------------------------------------------------------- /rslib/src/storage/card/search_cids_setup.sql: -------------------------------------------------------------------------------- 1 | drop table if exists search_cids; 2 | create temporary table search_cids (cid integer primary key not null); -------------------------------------------------------------------------------- /rslib/src/storage/deck/update_deck.sql: -------------------------------------------------------------------------------- 1 | insert 2 | or replace into decks (id, name, mtime_secs, usn, common, kind) 3 | values 4 | (?, ?, ?, ?, ?, ?) -------------------------------------------------------------------------------- /rslib/src/storage/notetype/add_or_update.sql: -------------------------------------------------------------------------------- 1 | insert 2 | or replace into notetypes (id, name, mtime_secs, usn, config) 3 | values 4 | (?, ?, ?, ?, ?); -------------------------------------------------------------------------------- /rslib/README.md: -------------------------------------------------------------------------------- 1 | Anki's Rust code. 2 | 3 | backend.proto stores the interfaces used to communicate backend messages between Rust, Python and TypeScript. 4 | -------------------------------------------------------------------------------- /rslib/src/storage/deck/cards_for_deck.sql: -------------------------------------------------------------------------------- 1 | select 2 | id 3 | from cards 4 | where 5 | did = ?1 6 | or ( 7 | odid != 0 8 | and odid = ?1 9 | ) -------------------------------------------------------------------------------- /rslib/src/storage/deckconf/add_or_update.sql: -------------------------------------------------------------------------------- 1 | insert 2 | or replace into deck_config (id, name, mtime_secs, usn, config) 3 | values 4 | (?, ?, ?, ?, ?); -------------------------------------------------------------------------------- /rslib/src/storage/deckconf/update.sql: -------------------------------------------------------------------------------- 1 | update deck_config 2 | set 3 | name = ?, 4 | mtime_secs = ?, 5 | usn = ?, 6 | config = ? 7 | where 8 | id = ?; -------------------------------------------------------------------------------- /rslib/src/storage/notetype/update_notetype_core.sql: -------------------------------------------------------------------------------- 1 | insert 2 | or replace into notetypes (id, name, mtime_secs, usn, config) 3 | values 4 | (?, ?, ?, ?, ?) -------------------------------------------------------------------------------- /rslib/src/storage/revlog/studied_today.sql: -------------------------------------------------------------------------------- 1 | select count(), 2 | coalesce(sum(time) / 1000.0, 0.0) 3 | from revlog 4 | where id > ? 5 | and type != ? -------------------------------------------------------------------------------- /platforms/README.md: -------------------------------------------------------------------------------- 1 | Platform constraints, used for things like controlling wheel filenames 2 | on a per-platform basis, and selecting the correct protobuf binary. 3 | -------------------------------------------------------------------------------- /pylib/README.md: -------------------------------------------------------------------------------- 1 | Anki's Python library code is in anki/. 2 | 3 | The Rust/Python extension module is in rsbridge/; it references the library defined in ../rslib. 4 | -------------------------------------------------------------------------------- /rslib/src/storage/deck/missing-decks.sql: -------------------------------------------------------------------------------- 1 | select 2 | distinct did 3 | from cards 4 | where 5 | did not in ( 6 | select 7 | id 8 | from decks 9 | ); -------------------------------------------------------------------------------- /qt/tools/runanki.system.in: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import sys 4 | 5 | sys.path.append("@PREFIX@/share/anki") 6 | 7 | import aqt 8 | 9 | aqt.run() 10 | -------------------------------------------------------------------------------- /rslib/src/storage/revlog/get.sql: -------------------------------------------------------------------------------- 1 | select 2 | id, 3 | cid, 4 | usn, 5 | ease, 6 | ivl, 7 | lastIvl, 8 | factor, 9 | time, 10 | type 11 | from revlog -------------------------------------------------------------------------------- /ts/graphs/d3_missing.d.ts: -------------------------------------------------------------------------------- 1 | import "d3-array"; 2 | declare module "d3-array" { 3 | export function cumsum(arg0: any[], arg1?: (any) => number): Float64Array; 4 | } 5 | -------------------------------------------------------------------------------- /qt/aqt/data/BUILD.bazel: -------------------------------------------------------------------------------- 1 | filegroup( 2 | name = "data", 3 | srcs = [ 4 | "//qt/aqt/data/web", 5 | ], 6 | visibility = ["//qt:__subpackages__"], 7 | ) 8 | -------------------------------------------------------------------------------- /rslib/src/notetype/styling.css: -------------------------------------------------------------------------------- 1 | .card { 2 | font-family: arial; 3 | font-size: 20px; 4 | text-align: center; 5 | color: black; 6 | background-color: white; 7 | } 8 | -------------------------------------------------------------------------------- /rslib/build/write_fluent_proto.rs: -------------------------------------------------------------------------------- 1 | include!("mergeftl.rs"); 2 | 3 | fn main() { 4 | let args: Vec<_> = std::env::args().collect(); 5 | write_fluent_proto(&args[1]); 6 | } 7 | -------------------------------------------------------------------------------- /rslib/src/storage/deck/update_active.sql: -------------------------------------------------------------------------------- 1 | insert into active_decks 2 | select id 3 | from decks 4 | where name = ? 5 | or ( 6 | name >= ? 7 | and name < ? 8 | ) -------------------------------------------------------------------------------- /pylib/anki/types.py: -------------------------------------------------------------------------------- 1 | from typing import NoReturn 2 | 3 | 4 | def assert_exhaustive(arg: NoReturn) -> NoReturn: 5 | raise Exception(f"unexpected arg received: {type(arg)} {arg}") 6 | -------------------------------------------------------------------------------- /qt/aqt/data/web/js/vendor/mathjax/BUILD.bazel: -------------------------------------------------------------------------------- 1 | load("//ts:mathjax.bzl", "copy_mathjax") 2 | 3 | copy_mathjax( 4 | name = "mathjax", 5 | visibility = ["//visibility:public"], 6 | ) 7 | -------------------------------------------------------------------------------- /rslib/src/storage/card/fix_ivl.sql: -------------------------------------------------------------------------------- 1 | update cards 2 | set 3 | ivl = min(max(round(ivl), 0), 2147483647), 4 | mod = ?1, 5 | usn = ?2 6 | where 7 | ivl != min(max(round(ivl), 0), 2147483647) -------------------------------------------------------------------------------- /rslib/src/storage/notetype/get_templates.sql: -------------------------------------------------------------------------------- 1 | select 2 | ord, 3 | name, 4 | mtime_secs, 5 | usn, 6 | config 7 | from templates 8 | where 9 | ntid = ? 10 | order by 11 | ord -------------------------------------------------------------------------------- /rslib/src/storage/notetype/highest_card_ord.sql: -------------------------------------------------------------------------------- 1 | select coalesce(max(ord), 0) 2 | from cards 3 | where nid in ( 4 | select id 5 | from notes 6 | where mid = ? 7 | ) -------------------------------------------------------------------------------- /pylib/.gitignore: -------------------------------------------------------------------------------- 1 | *.mo 2 | *.pyc 3 | *\# 4 | *~ 5 | .*.swp 6 | .build 7 | .coverage 8 | .DS_Store 9 | .mypy_cache 10 | .pytype 11 | __pycache__ 12 | anki.egg-info 13 | build 14 | dist 15 | -------------------------------------------------------------------------------- /qt/aqt/data/web/js/vendor/BUILD.bazel: -------------------------------------------------------------------------------- 1 | filegroup( 2 | name = "vendor", 3 | srcs = glob(["*.js"]) + ["//qt/aqt/data/web/js/vendor/mathjax"], 4 | visibility = ["//qt:__subpackages__"], 5 | ) 6 | -------------------------------------------------------------------------------- /ftl/core/findreplace.ftl: -------------------------------------------------------------------------------- 1 | findreplace-notes-updated = 2 | { $total -> 3 | [one] { $changed } of { $total } note updated 4 | *[other] { $changed } of { $total } notes updated 5 | } 6 | -------------------------------------------------------------------------------- /qt/aqt/data/web/imgs/BUILD.bazel: -------------------------------------------------------------------------------- 1 | filegroup( 2 | name = "imgs", 3 | srcs = glob([ 4 | "**/*.png", 5 | "**/*.svg", 6 | ]), 7 | visibility = ["//qt:__subpackages__"], 8 | ) 9 | -------------------------------------------------------------------------------- /rslib/src/storage/notetype/field_names_for_notes.sql: -------------------------------------------------------------------------------- 1 | select 2 | distinct name 3 | from fields 4 | where 5 | ntid in ( 6 | select 7 | mid 8 | from notes 9 | where 10 | id in -------------------------------------------------------------------------------- /rslib/src/storage/note/update.sql: -------------------------------------------------------------------------------- 1 | update notes 2 | set 3 | guid = ?, 4 | mid = ?, 5 | mod = ?, 6 | usn = ?, 7 | tags = ?, 8 | flds = ?, 9 | sfld = ?, 10 | csum = ? 11 | where 12 | id = ? -------------------------------------------------------------------------------- /ts/format.sh: -------------------------------------------------------------------------------- 1 | # this is a hack to invoke prettier directly from Bazel 2 | ts=${BUILD_WORKSPACE_DIRECTORY}/ts 3 | (cd $ts && ./node_modules/.bin/prettier --config .prettierrc --write . $ts/../qt/aqt/data/web/js) 4 | -------------------------------------------------------------------------------- /pylib/tests/support/text-2fields.txt: -------------------------------------------------------------------------------- 1 | # this is a test file 2 | 食べる to eat 3 | 飲む to drink 4 | テスト test 5 | to eat 食べる 6 | 飲む to drink 7 | 多すぎる too many fields 8 | not, enough, fields 9 | 遊ぶ 10 | to play 11 | -------------------------------------------------------------------------------- /rslib/src/storage/notetype/delete_cards_for_template.sql: -------------------------------------------------------------------------------- 1 | delete from cards 2 | where 3 | nid in ( 4 | select 5 | id 6 | from notes 7 | where 8 | mid = ? 9 | ) 10 | and ord = ?; -------------------------------------------------------------------------------- /qt/aqt/data/web/js/overview.ts: -------------------------------------------------------------------------------- 1 | /* Copyright: Ankitects Pty Ltd and contributors 2 | * License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html */ 3 | 4 | $(function () { 5 | $("#study").focus(); 6 | }); 7 | -------------------------------------------------------------------------------- /rslib/src/notetype/header.tex: -------------------------------------------------------------------------------- 1 | \documentclass[12pt]{article} 2 | \special{papersize=3in,5in} 3 | \usepackage[utf8]{inputenc} 4 | \usepackage{amssymb,amsmath} 5 | \pagestyle{empty} 6 | \setlength{\parindent}{0in} 7 | \begin{document} 8 | -------------------------------------------------------------------------------- /ftl/core/search.ftl: -------------------------------------------------------------------------------- 1 | search-invalid = Invalid search - please check for typing mistakes. 2 | 3 | ## Column labels in browse screen 4 | 5 | search-note-modified = Note Modified 6 | search-card-modified = Card Modified 7 | 8 | ## 9 | 10 | -------------------------------------------------------------------------------- /rslib/src/stats/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright: Ankitects Pty Ltd and contributors 2 | // License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html 3 | 4 | mod card; 5 | mod graphs; 6 | mod today; 7 | 8 | pub use today::studied_today; 9 | -------------------------------------------------------------------------------- /qt/linux/README.md: -------------------------------------------------------------------------------- 1 | These files are distributed with the packaged Linux version, and may be useful 2 | to Linux packagers. If you're building Anki yourself, please ignore these files, 3 | and follow the instructions in docs/development.md instead. 4 | -------------------------------------------------------------------------------- /qt/tools/profile.py: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | 4 | import snakeviz 5 | from snakeviz.cli import main 6 | 7 | profile = os.path.join(os.environ["BUILD_WORKSPACE_DIRECTORY"], "anki.prof") 8 | sys.argv.append(profile) 9 | sys.exit(main()) 10 | -------------------------------------------------------------------------------- /rslib/src/storage/card/fix_low_ease.sql: -------------------------------------------------------------------------------- 1 | update cards 2 | set factor = 2500, 3 | usn = ?, 4 | mod = ? 5 | where factor != 0 6 | and factor <= 2000 7 | and ( 8 | did in DECK_IDS 9 | or odid in DECK_IDS 10 | ) -------------------------------------------------------------------------------- /rslib/src/storage/notetype/get_use_counts.sql: -------------------------------------------------------------------------------- 1 | select 2 | nt.id, 3 | nt.name, 4 | ( 5 | select 6 | count(*) 7 | from notes n 8 | where 9 | nt.id = n.mid 10 | ) 11 | from notetypes nt 12 | order by 13 | nt.name -------------------------------------------------------------------------------- /ts/README.md: -------------------------------------------------------------------------------- 1 | Anki's TypeScript and Sass dependencies. Some TS/JS code is also 2 | stored separately in ../qt/aqt/data/web/. 3 | 4 | To add a new dev dependency, use something like: 5 | 6 | bazel run @nodejs//:yarn add @rollup/plugin-alias -- -D 7 | -------------------------------------------------------------------------------- /rslib/src/storage/deck/alloc_id.sql: -------------------------------------------------------------------------------- 1 | select 2 | case 3 | when ?1 in ( 4 | select 5 | id 6 | from decks 7 | ) then ( 8 | select 9 | max(id) + 1 10 | from decks 11 | ) 12 | else ?1 13 | end; -------------------------------------------------------------------------------- /qt/.isort.cfg: -------------------------------------------------------------------------------- 1 | [settings] 2 | skip=aqt/forms,hooks_gen.py 3 | multi_line_output=3 4 | include_trailing_comma=True 5 | force_grid_wrap=0 6 | use_parentheses=True 7 | line_length=88 8 | ensure_newline_before_comments=true 9 | known_first_party=anki,aqt 10 | -------------------------------------------------------------------------------- /scripts/BUILD.bazel: -------------------------------------------------------------------------------- 1 | load("@py_deps//:requirements.bzl", "requirement") 2 | 3 | py_binary( 4 | name = "buildinfo", 5 | srcs = ["buildinfo.py"], 6 | data = ["//:defs.bzl"], 7 | stamp = 1, 8 | visibility = ["//visibility:public"], 9 | ) 10 | -------------------------------------------------------------------------------- /rslib/src/search/deck_order.sql: -------------------------------------------------------------------------------- 1 | drop table if exists sort_order; 2 | create temporary table sort_order ( 3 | pos integer primary key, 4 | did integer not null unique 5 | ); 6 | insert into sort_order (did) 7 | select 8 | id 9 | from decks 10 | order by 11 | name; -------------------------------------------------------------------------------- /scripts/build: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | test -e WORKSPACE || ( 6 | echo "Run from project root" 7 | exit 1 8 | ) 9 | 10 | rm -rf bazel-dist 11 | bazel build -c opt --@io_bazel_rules_rust//worker:use_worker=False dist 12 | tar xvf bazel-bin/dist.tar 13 | -------------------------------------------------------------------------------- /rslib/src/search/notetype_order.sql: -------------------------------------------------------------------------------- 1 | drop table if exists sort_order; 2 | create temporary table sort_order ( 3 | pos integer primary key, 4 | ntid integer not null unique 5 | ); 6 | insert into sort_order (ntid) 7 | select 8 | id 9 | from notetypes 10 | order by 11 | name; -------------------------------------------------------------------------------- /pylib/anki/storage.py: -------------------------------------------------------------------------------- 1 | # Copyright: Ankitects Pty Ltd and contributors 2 | # License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html 3 | 4 | # Legacy code expects to find Collection in this module. 5 | 6 | from anki.collection import Collection 7 | 8 | _Collection = Collection 9 | -------------------------------------------------------------------------------- /qt/aqt/data/web/BUILD.bazel: -------------------------------------------------------------------------------- 1 | filegroup( 2 | name = "web", 3 | srcs = [ 4 | "//qt/aqt/data/web/css", 5 | "//qt/aqt/data/web/imgs", 6 | "//qt/aqt/data/web/js", 7 | "//qt/aqt/data/web/pages", 8 | ], 9 | visibility = ["//qt:__subpackages__"], 10 | ) 11 | -------------------------------------------------------------------------------- /qt/aqt/data/web/css/toolbar-bottom.scss: -------------------------------------------------------------------------------- 1 | /* Copyright: Ankitects Pty Ltd and contributors 2 | * License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html */ 3 | 4 | #header { 5 | border-bottom: 0; 6 | margin-bottom: 6px; 7 | margin-top: 0; 8 | padding: 9px; 9 | } 10 | -------------------------------------------------------------------------------- /ftl/format_check.py: -------------------------------------------------------------------------------- 1 | import os 2 | import format 3 | import sys 4 | import glob 5 | 6 | template_root = os.path.dirname(sys.argv[1]) 7 | template_files = glob.glob(os.path.join(template_root, "*", "*.ftl"), recursive=True) 8 | 9 | if not format.check_files(template_files, fix=False): 10 | sys.exit(1) 11 | -------------------------------------------------------------------------------- /late_deps.bzl: -------------------------------------------------------------------------------- 1 | """Repo setup that can't happen until after defs.bzl:setup_deps() is run.""" 2 | 3 | load("@py_deps//:requirements.bzl", "pip_install") 4 | load("@npm//@bazel/labs:package.bzl", "npm_bazel_labs_dependencies") 5 | 6 | def setup_late_deps(): 7 | pip_install() 8 | npm_bazel_labs_dependencies() 9 | -------------------------------------------------------------------------------- /rslib/src/storage/card/get_card.sql: -------------------------------------------------------------------------------- 1 | select 2 | id, 3 | nid, 4 | did, 5 | ord, 6 | cast(mod as integer), 7 | usn, 8 | type, 9 | queue, 10 | due, 11 | cast(ivl as integer), 12 | factor, 13 | reps, 14 | lapses, 15 | left, 16 | odue, 17 | odid, 18 | flags, 19 | data 20 | from cards -------------------------------------------------------------------------------- /pylib/anki/sync.py: -------------------------------------------------------------------------------- 1 | # Copyright: Ankitects Pty Ltd and contributors 2 | # License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html 3 | 4 | from .httpclient import HttpClient 5 | 6 | AnkiRequestsClient = HttpClient 7 | 8 | 9 | class Syncer: 10 | def sync(self) -> str: 11 | pass 12 | -------------------------------------------------------------------------------- /rslib/src/storage/upgrades/schema11_downgrade.sql: -------------------------------------------------------------------------------- 1 | drop table config; 2 | drop table deck_config; 3 | drop table tags; 4 | drop table fields; 5 | drop table templates; 6 | drop table notetypes; 7 | drop table decks; 8 | drop index idx_cards_odid; 9 | drop index idx_notes_mid; 10 | update col 11 | set 12 | ver = 11; -------------------------------------------------------------------------------- /ts/BUILD.bazel: -------------------------------------------------------------------------------- 1 | load("//ts:prettier.bzl", "prettier") 2 | 3 | prettier() 4 | 5 | # Exported files 6 | ################# 7 | 8 | exports_files([ 9 | "tsconfig.json", 10 | "d3_missing.d.ts", 11 | ".prettierrc", 12 | "rollup.config.js", 13 | ".eslintrc.js", 14 | "licenses.json", 15 | ]) 16 | -------------------------------------------------------------------------------- /ftl/qt/profiles.ftl: -------------------------------------------------------------------------------- 1 | profiles-folder-readme = 2 | This folder stores all of your Anki data in a single location, 3 | to make backups easy. To tell Anki to use a different location, 4 | please see: 5 | 6 | { $link } 7 | # will appear as 'Downgrade & Quit' 8 | profiles-downgrade-and-quit = Downgrade && Quit 9 | -------------------------------------------------------------------------------- /ts/update.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Update JS dependencies and dump runtime licenses to licenses.json 3 | 4 | set -e 5 | 6 | bazel run @nodejs//:yarn upgrade 7 | ./node_modules/.bin/license-checker-rseidelsohn --production --json \ 8 | --excludePackages anki --relativeLicensePath \ 9 | --relativeModulePath > licenses.json 10 | -------------------------------------------------------------------------------- /ftl/core/deck-config.ftl: -------------------------------------------------------------------------------- 1 | # Used in the deck configuration screen to show how many decks are used 2 | # by a particular configuration group, eg "Group1 (used by 3 decks)" 3 | deck-config-used-by-decks = 4 | used by { $decks -> 5 | [one] { $decks } deck 6 | *[other] { $decks } decks 7 | } 8 | deck-config-default-name = Default 9 | -------------------------------------------------------------------------------- /qt/runanki.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import os 4 | import sys 5 | try: 6 | import bazelfixes 7 | 8 | bazelfixes.fix_pywin32_in_bazel() 9 | bazelfixes.fix_extraneous_path_in_bazel() 10 | except ImportError: 11 | pass 12 | 13 | import aqt 14 | 15 | if not os.environ.get("ANKI_IMPORT_ONLY"): 16 | aqt.run() 17 | -------------------------------------------------------------------------------- /rslib/src/search/template_order.sql: -------------------------------------------------------------------------------- 1 | drop table if exists sort_order; 2 | create temporary table sort_order ( 3 | pos integer primary key, 4 | ntid integer not null, 5 | ord integer not null, 6 | unique(ntid, ord) 7 | ); 8 | insert into sort_order (ntid, ord) 9 | select 10 | ntid, 11 | ord 12 | from templates 13 | order by 14 | name -------------------------------------------------------------------------------- /ftl/core/network.ftl: -------------------------------------------------------------------------------- 1 | network-offline = Please check your internet connection. 2 | network-timeout = Connection timed out. Please try again. If you see frequent timeouts, please try a different network connection. 3 | network-proxy-auth = Your proxy requires authentication. 4 | network-other = A network error occurred. 5 | network-details = Error details: { $details } 6 | -------------------------------------------------------------------------------- /pip/update.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import os 3 | import click 4 | from piptools.scripts import compile 5 | 6 | 7 | @click.group() 8 | def cli(): 9 | pass 10 | 11 | 12 | cli.add_command(compile.cli, "compile") 13 | 14 | print("Updating deps...") 15 | os.chdir("pip") 16 | sys.argv[1:] = ["compile", "--allow-unsafe", "--upgrade", "--no-header"] 17 | 18 | cli() -------------------------------------------------------------------------------- /qt/aqt/data/web/js/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es6", 4 | "module": "commonjs", 5 | "lib": ["es6", "dom"], 6 | "strict": true, 7 | "noImplicitAny": false, 8 | "strictNullChecks": false, 9 | "noImplicitThis": false, 10 | "esModuleInterop": true 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /qt/aqt/forms/icons.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | icons/anki.png 4 | icons/tag.svg 5 | icons/deck.svg 6 | icons/notetype.svg 7 | icons/heart.svg 8 | icons/collection.svg 9 | icons/media-record.png 10 | 11 | 12 | -------------------------------------------------------------------------------- /rslib/src/storage/card/update_card.sql: -------------------------------------------------------------------------------- 1 | update cards 2 | set 3 | nid = ?, 4 | did = ?, 5 | ord = ?, 6 | mod = ?, 7 | usn = ?, 8 | type = ?, 9 | queue = ?, 10 | due = ?, 11 | ivl = ?, 12 | factor = ?, 13 | reps = ?, 14 | lapses = ?, 15 | left = ?, 16 | odue = ?, 17 | odid = ?, 18 | flags = ?, 19 | data = ? 20 | where 21 | id = ? -------------------------------------------------------------------------------- /pylib/.isort.cfg: -------------------------------------------------------------------------------- 1 | [settings] 2 | skip=aqt/forms,backend_pb2.py,backend_pb2.pyi,fluent_pb2.py,fluent_pb2.pyi,rsbackend_gen.py,hooks_gen.py,genbackend.py 3 | profile=black 4 | multi_line_output=3 5 | include_trailing_comma=True 6 | force_grid_wrap=0 7 | use_parentheses=True 8 | line_length=88 9 | ensure_newline_before_comments=true 10 | known_first_party=tests,anki 11 | -------------------------------------------------------------------------------- /ts/lib/bridgecommand.ts: -------------------------------------------------------------------------------- 1 | // Copyright: Ankitects Pty Ltd and contributors 2 | // License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html 3 | 4 | /// HTML tag pointing to a bridge command. 5 | export function bridgeLink(command: string, label: string): string { 6 | return `${label}`; 7 | } 8 | -------------------------------------------------------------------------------- /WORKSPACE: -------------------------------------------------------------------------------- 1 | workspace( 2 | name = "net_ankiweb_anki", 3 | managed_directories = {"@npm": [ 4 | "ts/node_modules", 5 | ]}, 6 | ) 7 | 8 | load(":repos.bzl", "register_repos") 9 | 10 | register_repos() 11 | 12 | load(":defs.bzl", "setup_deps") 13 | 14 | setup_deps() 15 | 16 | load(":late_deps.bzl", "setup_late_deps") 17 | 18 | setup_late_deps() 19 | -------------------------------------------------------------------------------- /cargo/BUILD.bazel: -------------------------------------------------------------------------------- 1 | """ 2 | @generated 3 | cargo-raze generated Bazel file. 4 | 5 | DO NOT EDIT! Replaced on runs of cargo-raze 6 | """ 7 | 8 | package(default_visibility = ["//visibility:public"]) 9 | 10 | licenses([ 11 | "notice", # See individual crates for specific licenses 12 | ]) 13 | 14 | # No targets defined 15 | 16 | exports_files(["licenses.json"]) 17 | -------------------------------------------------------------------------------- /pylib/anki/_rsbridge.pyi: -------------------------------------------------------------------------------- 1 | from typing import Any 2 | 3 | def buildhash(*args, **kwargs) -> Any: ... 4 | def open_backend(*args, **kwargs) -> Any: ... 5 | 6 | class Backend: 7 | @classmethod 8 | def __init__(self, *args, **kwargs) -> None: ... 9 | def command(self, *args, **kwargs) -> Any: ... 10 | def db_command(self, *args, **kwargs) -> Any: ... 11 | -------------------------------------------------------------------------------- /qt/aqt/forms/build_rcc.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import os 3 | from PyQt5.pyrcc_main import processResourceFile 4 | 5 | icons_qrc = sys.argv[1] 6 | py_file = os.path.abspath(sys.argv[2]) 7 | 8 | # make paths relative for pyrcc 9 | os.chdir(os.path.dirname(icons_qrc)) 10 | icons_qrc = os.path.basename(icons_qrc) 11 | 12 | processResourceFile([icons_qrc], py_file, False) 13 | -------------------------------------------------------------------------------- /qt/linux/anki.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Name=Anki 3 | Comment=An intelligent spaced-repetition memory training program 4 | GenericName=Flashcards 5 | Exec=anki %f 6 | TryExec=anki 7 | Icon=anki 8 | Categories=Education;Languages;KDE;Qt; 9 | Terminal=false 10 | Type=Application 11 | Version=1.0 12 | MimeType=application/x-apkg;application/x-anki;application/x-ankiaddon; 13 | -------------------------------------------------------------------------------- /rslib/src/media/schema.sql: -------------------------------------------------------------------------------- 1 | create table media ( 2 | fname text not null primary key, 3 | csum text, -- null indicates deleted file 4 | mtime int not null, -- zero if deleted 5 | dirty int not null 6 | ) without rowid; 7 | 8 | create index idx_media_dirty on media (dirty) where dirty=1; 9 | 10 | create table meta (dirMod int, lastUsn int); insert into meta values (0, 0); 11 | -------------------------------------------------------------------------------- /rslib/src/storage/note/add_or_update.sql: -------------------------------------------------------------------------------- 1 | insert 2 | or replace into notes ( 3 | id, 4 | guid, 5 | mid, 6 | mod, 7 | usn, 8 | tags, 9 | flds, 10 | sfld, 11 | csum, 12 | flags, 13 | data 14 | ) 15 | values 16 | ( 17 | ?, 18 | ?, 19 | ?, 20 | ?, 21 | ?, 22 | ?, 23 | ?, 24 | ?, 25 | ?, 26 | 0, 27 | "" 28 | ) -------------------------------------------------------------------------------- /rslib/src/storage/revlog/fix_props.sql: -------------------------------------------------------------------------------- 1 | update revlog 2 | set ivl = min(max(round(ivl), -2147483648), 2147483647), 3 | lastIvl = min(max(round(lastIvl), -2147483648), 2147483647), 4 | time = min(max(round(time), 0), 2147483647) 5 | where ivl != min(max(round(ivl), -2147483648), 2147483647) 6 | or lastIvl != min(max(round(lastIvl), -2147483648), 2147483647) 7 | or time != min(max(round(time), 0), 2147483647) -------------------------------------------------------------------------------- /scripts/build.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | if not exist WORKSPACE ( 4 | echo Run from project root 5 | exit /b 1 6 | ) 7 | 8 | rd /s /q bazel-dist 9 | 10 | set BUILDARGS=-k -c opt dist --color=yes --@io_bazel_rules_rust//worker:use_worker=False 11 | call .\bazel build %BUILDARGS% 12 | :: repeat on failure 13 | IF %ERRORLEVEL% NEQ 0 call .\bazel build %BUILDARGS% 14 | 15 | tar xvf bazel-bin\dist.tar 16 | -------------------------------------------------------------------------------- /qt/aqt/gui_hooks.py: -------------------------------------------------------------------------------- 1 | # Copyright: Ankitects Pty Ltd and contributors 2 | # License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html 3 | 4 | """ 5 | See pylib/anki/hooks.py 6 | """ 7 | 8 | from __future__ import annotations 9 | 10 | from typing import Any, Callable, List, Optional, Tuple, Union 11 | 12 | # You can find the definitions in ../tools/genhooks_gui.py 13 | from aqt.hooks_gen import * 14 | -------------------------------------------------------------------------------- /qt/tests/run_pytest.py: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | 4 | import pytest 5 | 6 | try: 7 | import bazelfixes 8 | 9 | bazelfixes.fix_pywin32_in_bazel(force=True) 10 | except ImportError: 11 | pass 12 | 13 | if __name__ == "__main__": 14 | print(os.path.dirname(__file__)) 15 | folder = os.path.join(os.path.dirname(__file__), "..", "tests") 16 | sys.exit(pytest.main(["--verbose", "-s", folder])) 17 | -------------------------------------------------------------------------------- /rslib/src/storage/card/fix_due_new.sql: -------------------------------------------------------------------------------- 1 | update cards 2 | set 3 | due = ( 4 | case 5 | when type = 0 6 | and queue != 4 then 1000000 + due % 1000000 7 | else due 8 | end 9 | ), 10 | mod = ?1, 11 | usn = ?2 12 | where 13 | due != ( 14 | case 15 | when type = 0 16 | and queue != 4 then 1000000 + due % 1000000 17 | else due 18 | end 19 | ) 20 | and due >= 1000000; -------------------------------------------------------------------------------- /pylib/tests/test_template.py: -------------------------------------------------------------------------------- 1 | from tests.shared import getEmptyCol 2 | 3 | 4 | def test_deferred_frontside(): 5 | col = getEmptyCol() 6 | m = col.models.current() 7 | m["tmpls"][0]["qfmt"] = "{{custom:Front}}" 8 | col.models.save(m) 9 | 10 | note = col.newNote() 11 | note["Front"] = "xxtest" 12 | note["Back"] = "" 13 | col.addNote(note) 14 | 15 | assert "xxtest" in note.cards()[0].a() 16 | -------------------------------------------------------------------------------- /pylib/.pylintrc: -------------------------------------------------------------------------------- 1 | [MASTER] 2 | ignore-patterns=.*_pb2.* 3 | persistent = no 4 | 5 | [MESSAGES CONTROL] 6 | disable=C,R, 7 | fixme, 8 | unused-wildcard-import, 9 | attribute-defined-outside-init, 10 | redefined-builtin, 11 | wildcard-import, 12 | broad-except, 13 | bare-except, 14 | unused-argument, 15 | unused-variable, 16 | redefined-outer-name, 17 | global-statement, 18 | protected-access, 19 | arguments-differ, 20 | -------------------------------------------------------------------------------- /rslib/src/storage/card/fix_due_other.sql: -------------------------------------------------------------------------------- 1 | update cards 2 | set 3 | due = ( 4 | case 5 | when queue = 2 6 | and due > 100000 then ?1 7 | else min(max(round(due), -2147483648), 2147483647) 8 | end 9 | ), 10 | mod = ?2, 11 | usn = ?3 12 | where 13 | due != ( 14 | case 15 | when queue = 2 16 | and due > 100000 then ?1 17 | else min(max(round(due), -2147483648), 2147483647) 18 | end 19 | ); -------------------------------------------------------------------------------- /rslib/src/storage/deckconf/add.sql: -------------------------------------------------------------------------------- 1 | insert into deck_config (id, name, mtime_secs, usn, config) 2 | values 3 | ( 4 | ( 5 | case 6 | when ?1 in ( 7 | select 8 | id 9 | from deck_config 10 | ) then ( 11 | select 12 | max(id) + 1 13 | from deck_config 14 | ) 15 | else ?1 16 | end 17 | ), 18 | ?, 19 | ?, 20 | ?, 21 | ? 22 | ); -------------------------------------------------------------------------------- /pylib/rsbridge/build.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | // this build script simply exists so we can extend the link path 3 | // inside Bazel based on an env var, as we need to provide a custom 4 | // path to Python on Windows. 5 | if let Ok(path) = std::env::var("PYTHON_SYS_EXECUTABLE") { 6 | let path = std::path::Path::new(&path).with_file_name("libs"); 7 | println!("cargo:rustc-link-search={}", path.to_str().unwrap()); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /rslib/src/storage/notetype/add_notetype.sql: -------------------------------------------------------------------------------- 1 | insert into notetypes (id, name, mtime_secs, usn, config) 2 | values 3 | ( 4 | ( 5 | case 6 | when ?1 in ( 7 | select 8 | id 9 | from notetypes 10 | ) then ( 11 | select 12 | max(id) + 1 13 | from notetypes 14 | ) 15 | else ?1 16 | end 17 | ), 18 | ?, 19 | ?, 20 | ?, 21 | ? 22 | ); -------------------------------------------------------------------------------- /qt/aqt/data/web/pages/defs.bzl: -------------------------------------------------------------------------------- 1 | load("@bazel_skylib//rules:copy_file.bzl", "copy_file") 2 | 3 | def copy_page(name, package, srcs): 4 | outs = [] 5 | for src in srcs: 6 | copy_file( 7 | name = src + "_copy", 8 | src = package + ":" + src, 9 | out = src, 10 | ) 11 | 12 | native.filegroup( 13 | name = name, 14 | srcs = srcs, 15 | visibility = ["//qt:__subpackages__"], 16 | ) 17 | -------------------------------------------------------------------------------- /ts/sass/core.scss: -------------------------------------------------------------------------------- 1 | /* Copyright: Ankitects Pty Ltd and contributors 2 | * License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html */ 3 | 4 | @use 'vars'; 5 | 6 | * { 7 | box-sizing: border-box; 8 | } 9 | 10 | body { 11 | font-family: Helvetica, Arial; 12 | color: var(--text-fg); 13 | background: var(--window-bg); 14 | margin: 1em; 15 | } 16 | 17 | a { 18 | color: var(--link); 19 | text-decoration: none; 20 | } 21 | -------------------------------------------------------------------------------- /qt/linux/uninstall.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | if [ "$PREFIX" = "" ]; then 6 | PREFIX=/usr/local 7 | fi 8 | 9 | xdg-mime uninstall ${PREFIX}/share/anki/anki.xml || true 10 | 11 | rm -rf ${PREFIX}/share/anki 12 | rm -rf ${PREFIX}/bin/anki 13 | rm -rf ${PREFIX}/share/pixmaps/anki.xpm 14 | rm -rf ${PREFIX}/share/pixmaps/anki.png 15 | rm -rf ${PREFIX}/share/applications/anki.desktop 16 | rm -rf ${PREFIX}/share/man/man1/anki.1 17 | 18 | echo "Uninstall complete." 19 | -------------------------------------------------------------------------------- /pip/BUILD.bazel: -------------------------------------------------------------------------------- 1 | load("@rules_python//python:defs.bzl", "py_binary") 2 | load("@py_deps//:requirements.bzl", "requirement") 3 | 4 | py_binary( 5 | name = "update", 6 | srcs = ["update.py"], 7 | data = [ 8 | "requirements.in", 9 | "requirements.txt", 10 | ], 11 | tags = ["manual"], 12 | deps = [ 13 | requirement("pip-tools"), 14 | ], 15 | ) 16 | 17 | exports_files([ 18 | "requirements.txt", 19 | "licenses.json", 20 | ]) 21 | -------------------------------------------------------------------------------- /pylib/tests/run_pylint.py: -------------------------------------------------------------------------------- 1 | import os 2 | import subprocess 3 | import sys 4 | 5 | if __name__ == "__main__": 6 | (module, ini) = sys.argv[1:] 7 | ini = os.path.abspath(ini) 8 | 9 | folder = os.path.join(os.path.dirname(__file__), "..") 10 | os.chdir(folder) 11 | 12 | sys.exit( 13 | subprocess.run( 14 | [sys.executable, "-m", "pylint", module, "-j", "0", "--rcfile", ini], 15 | check=False, 16 | ).returncode 17 | ) 18 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Anki 2 | 3 | [![Build status](https://badge.buildkite.com/c9edf020a4aec976f9835e54751cc5409d843adbb66d043bd3.svg)](https://buildkite.com/ankitects/anki-ci) 4 | 5 | This repo contains the source code for the computer version of Anki. 6 | 7 | If you'd like to try development builds of Anki but don't feel comfortable 8 | building the code, please see https://betas.ankiweb.net/#/ 9 | 10 | For more information on building, please see [Development](./docs/development.md). 11 | -------------------------------------------------------------------------------- /qt/tests/test_i18n.py: -------------------------------------------------------------------------------- 1 | import anki.lang 2 | from anki.rsbackend import TR 3 | 4 | 5 | def test_no_collection_i18n(): 6 | anki.lang.set_lang("zz", "") 7 | tr2 = anki.lang.current_i18n.translate 8 | no_uni = anki.lang.without_unicode_isolation 9 | assert no_uni(tr2(TR.STATISTICS_REVIEWS, reviews=2)) == "2 reviews" 10 | 11 | anki.lang.set_lang("ja", "") 12 | tr2 = anki.lang.current_i18n.translate 13 | assert no_uni(tr2(TR.STATISTICS_REVIEWS, reviews=2)) == "2 枚の復習カード" 14 | -------------------------------------------------------------------------------- /ts/graphs/NoDataOverlay.svelte: -------------------------------------------------------------------------------- 1 | 8 | 9 | 10 | 11 | {noData} 12 | 13 | -------------------------------------------------------------------------------- /ts/lib/nightmode.ts: -------------------------------------------------------------------------------- 1 | // Copyright: Ankitects Pty Ltd and contributors 2 | // License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html 3 | 4 | /// Add night-mode class to body if hash location is #night, and return 5 | /// true if added. 6 | export function checkNightMode(): boolean { 7 | const nightMode = window.location.hash == "#night"; 8 | if (nightMode) { 9 | document.documentElement.className = "night-mode"; 10 | } 11 | return nightMode; 12 | } 13 | -------------------------------------------------------------------------------- /pylib/rsbridge/cargo/BUILD.bazel: -------------------------------------------------------------------------------- 1 | """ 2 | @generated 3 | cargo-raze generated Bazel file. 4 | 5 | DO NOT EDIT! Replaced on runs of cargo-raze 6 | """ 7 | 8 | package(default_visibility = ["//visibility:public"]) 9 | 10 | licenses([ 11 | "notice", # See individual crates for specific licenses 12 | ]) 13 | 14 | # Aliased targets 15 | alias( 16 | name = "pyo3", 17 | actual = "@raze__pyo3__0_13_0//:pyo3", 18 | tags = [ 19 | "cargo-raze", 20 | "manual", 21 | ], 22 | ) 23 | -------------------------------------------------------------------------------- /rslib/src/storage/notetype/existing_cards.sql: -------------------------------------------------------------------------------- 1 | select 2 | id, 3 | nid, 4 | ord, 5 | -- original deck 6 | ( 7 | case 8 | odid 9 | when 0 then did 10 | else odid 11 | end 12 | ), 13 | -- new position if card is empty 14 | ( 15 | case 16 | type 17 | when 0 then ( 18 | case 19 | odue 20 | when 0 then max(0, due) 21 | else max(odue, 0) 22 | end 23 | ) 24 | else null 25 | end 26 | ) 27 | from cards c -------------------------------------------------------------------------------- /ts/graphs/AxisTicks.svelte: -------------------------------------------------------------------------------- 1 | 5 | 6 | 9 | 10 | 13 | -------------------------------------------------------------------------------- /ftl/core/adding.ftl: -------------------------------------------------------------------------------- 1 | adding-add-shortcut-ctrlandenter = Add (shortcut: ctrl+enter) 2 | adding-added = Added 3 | adding-close-and-lose-current-input = Close and lose current input? 4 | adding-edit = Edit "{ $val }" 5 | adding-history = History 6 | adding-note-deleted = (Note deleted) 7 | adding-shortcut = Shortcut: { $val } 8 | adding-the-first-field-is-empty = The first field is empty. 9 | adding-you-have-a-cloze-deletion-note = You have a cloze deletion note type but have not made any cloze deletions. Proceed? 10 | -------------------------------------------------------------------------------- /pylib/anki/statsbg.py: -------------------------------------------------------------------------------- 1 | # from subtlepatterns.com; CC BY-SA 3.0. 2 | # by Daniel Beaton 3 | # https://www.toptal.com/designers/subtlepatterns/fancy-deboss/ 4 | bg = """\ 5 | iVBORw0KGgoAAAANSUhEUgAAABIAAAANCAMAAACTkM4rAAAAM1BMVEXy8vLz8/P5+fn19fXt7e329vb4+Pj09PTv7+/u7u739/fw8PD7+/vx8fHr6+v6+vrs7Oz2LjW2AAAAkUlEQVR42g3KyXHAQAwDQYAQj12ItvOP1qqZZwMMPVnd06XToQvz4L2HDQ2iRgkvA7yPPB+JD+OUPnfzZ0JNZh6kkQus5NUmR7g4Jpxv5XN6nYWNmtlq9o3zuK6w3XRsE1pQIEGPIsdtTP3m2cYwlPv6MbL8/QASsKppZefyDmJPbxvxa/NrX1TJ1yp20fhj9D+SiAWWLU8myQAAAABJRU5ErkJggg== 6 | """ 7 | -------------------------------------------------------------------------------- /pylib/tests/run_pytest.py: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | 4 | import pytest 5 | 6 | os.environ["SHIFT_CLOCK_HACK"] = "1" 7 | 8 | if __name__ == "__main__": 9 | folder = os.path.join(os.path.dirname(__file__), "..", "tests") 10 | args = ["--verbose", "-s", folder] 11 | # allow specifying an individual test, eg 12 | # bazel test //pylib:pytest --test_env=PYTEST=test_bury 13 | if pytest_extra := os.environ.get("PYTEST", ""): 14 | args.extend(["-k", pytest_extra]) 15 | sys.exit(pytest.main(args)) 16 | -------------------------------------------------------------------------------- /ts/graphs/graphs.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 16 | 17 | -------------------------------------------------------------------------------- /.buildkite/mac/entrypoint: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | echo "--- Building" 6 | BAZEL="bazel --output_user_root=~/bazel --output_base=~/bazel/anki" 7 | BUILDARGS="--config=ci --experimental_convenience_symlinks=ignore" 8 | 9 | # move existing node_modules into tree 10 | test -e ~/node_modules && mv ~/node_modules ts/ 11 | 12 | $BAZEL build $BUILDARGS ... 13 | 14 | echo "+++ Running tests" 15 | $BAZEL test $BUILDARGS ... 16 | 17 | echo "--- Cleanup" 18 | # if tests succeed, back up node_modules folder 19 | mv ts/node_modules ~/ 20 | -------------------------------------------------------------------------------- /qt/linux/README.dist: -------------------------------------------------------------------------------- 1 | To run, change to this folder in a terminal and run the following command: 2 | 3 | ./bin/Anki 4 | 5 | - To install system wide, run 'sudo ./install.sh' 6 | - To remove in the future, run 'sudo ./uninstall.sh' from the same folder. 7 | 8 | To play and record audio, mpv and lame must be installed. If mpv is not 9 | installed or too old, Anki will try to fall back on using mplayer. 10 | 11 | If Anki fails to start, please run it from a terminal to see what errors it 12 | outputs, and then post on our support site. 13 | -------------------------------------------------------------------------------- /ts/congrats/congrats.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 16 | 17 | -------------------------------------------------------------------------------- /ts/graphs/bootstrap.ts: -------------------------------------------------------------------------------- 1 | // Copyright: Ankitects Pty Ltd and contributors 2 | // License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html 3 | 4 | import { setupI18n } from "anki/i18n"; 5 | import GraphsPage from "./GraphsPage.svelte"; 6 | import { checkNightMode } from "anki/nightmode"; 7 | 8 | export function graphs(target: HTMLDivElement): void { 9 | setupI18n().then((i18n) => { 10 | new GraphsPage({ 11 | target, 12 | props: { i18n, nightMode: checkNightMode() }, 13 | }); 14 | }); 15 | } 16 | -------------------------------------------------------------------------------- /rslib/src/storage/revlog/add.sql: -------------------------------------------------------------------------------- 1 | insert 2 | or ignore into revlog ( 3 | id, 4 | cid, 5 | usn, 6 | ease, 7 | ivl, 8 | lastIvl, 9 | factor, 10 | time, 11 | type 12 | ) 13 | values ( 14 | ( 15 | case 16 | when ?1 in ( 17 | select id 18 | from revlog 19 | ) then ( 20 | select max(id) + 1 21 | from revlog 22 | ) 23 | else ?1 24 | end 25 | ), 26 | ?, 27 | ?, 28 | ?, 29 | ?, 30 | ?, 31 | ?, 32 | ?, 33 | ? 34 | ) -------------------------------------------------------------------------------- /rslib/src/prelude.rs: -------------------------------------------------------------------------------- 1 | // Copyright: Ankitects Pty Ltd and contributors 2 | // License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html 3 | 4 | pub use crate::{ 5 | card::{Card, CardID}, 6 | collection::Collection, 7 | deckconf::DeckConfID, 8 | decks::DeckID, 9 | err::{AnkiError, Result}, 10 | i18n::{tr_args, tr_strs, TR}, 11 | notes::{Note, NoteID}, 12 | notetype::NoteTypeID, 13 | revlog::RevlogID, 14 | timestamp::{TimestampMillis, TimestampSecs}, 15 | types::Usn, 16 | }; 17 | pub use slog::{debug, Logger}; 18 | -------------------------------------------------------------------------------- /rslib/src/storage/card/add_or_update.sql: -------------------------------------------------------------------------------- 1 | insert 2 | or replace into cards ( 3 | id, 4 | nid, 5 | did, 6 | ord, 7 | mod, 8 | usn, 9 | type, 10 | queue, 11 | due, 12 | ivl, 13 | factor, 14 | reps, 15 | lapses, 16 | left, 17 | odue, 18 | odid, 19 | flags, 20 | data 21 | ) 22 | values 23 | ( 24 | ?, 25 | ?, 26 | ?, 27 | ?, 28 | ?, 29 | ?, 30 | ?, 31 | ?, 32 | ?, 33 | ?, 34 | ?, 35 | ?, 36 | ?, 37 | ?, 38 | ?, 39 | ?, 40 | ?, 41 | ? 42 | ) -------------------------------------------------------------------------------- /qt/aqt/data/web/js/compile_ts.bzl: -------------------------------------------------------------------------------- 1 | def compile_ts(group, srcs): 2 | css_files = [] 3 | for ts_file in srcs: 4 | name = ts_file.replace(".ts", "") + "_ts" 5 | css_file = name + ".css" 6 | css_files.append(css_file) 7 | 8 | sass_binary( 9 | name = name, 10 | src = ts_file, 11 | sourcemap = False, 12 | deps = ["//ts/sass:core_lib"], 13 | ) 14 | 15 | native.filegroup( 16 | name = group, 17 | srcs = css_files, 18 | visibility = ["//qt:__subpackages__"], 19 | ) 20 | -------------------------------------------------------------------------------- /rslib/src/storage/card/fix_odue.sql: -------------------------------------------------------------------------------- 1 | update cards 2 | set 3 | odue = ( 4 | case 5 | when odue > 0 6 | and ( 7 | type = 1 8 | or queue = 2 9 | ) 10 | and not odid then 0 11 | else min(max(round(odue), -2147483648), 2147483647) 12 | end 13 | ), 14 | mod = ?1, 15 | usn = ?2 16 | where 17 | odue != ( 18 | case 19 | when odue > 0 20 | and ( 21 | type = 1 22 | or queue = 2 23 | ) 24 | and not odid then 0 25 | else min(max(round(odue), -2147483648), 2147483647) 26 | end 27 | ); -------------------------------------------------------------------------------- /ts/graphs/TableData.svelte: -------------------------------------------------------------------------------- 1 | 8 | 9 |
10 | 11 | {#each tableData as { label, value }} 12 | 13 | 14 | 15 | 16 | {/each} 17 |
{label}:{value}
18 |
19 | -------------------------------------------------------------------------------- /pylib/rsbridge/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "rsbridge" 3 | version = "0.0.0" 4 | edition = "2018" 5 | authors = ["Ankitects Pty Ltd and contributors "] 6 | license = "AGPL-3.0-or-later" 7 | description = "Anki's Rust library code Python bindings" 8 | 9 | [dependencies] 10 | anki = { path = "../../rslib" } 11 | 12 | # /cargo/update.py needs to be run if updating the version below 13 | [dependencies.pyo3] 14 | version = "0.13" 15 | features = ["extension-module", "abi3"] 16 | 17 | [lib] 18 | name = "rsbridge" 19 | crate-type = ["cdylib"] 20 | path = "lib.rs" 21 | -------------------------------------------------------------------------------- /rslib/src/storage/upgrades/schema14_upgrade.sql: -------------------------------------------------------------------------------- 1 | create table deck_config ( 2 | id integer primary key not null, 3 | name text not null collate unicase, 4 | mtime_secs integer not null, 5 | usn integer not null, 6 | config blob not null 7 | ); 8 | create table config ( 9 | key text not null primary key, 10 | usn integer not null, 11 | mtime_secs integer not null, 12 | val blob not null 13 | ) without rowid; 14 | create table tags ( 15 | tag text not null primary key collate unicase, 16 | usn integer not null 17 | ) without rowid; 18 | update col 19 | set 20 | ver = 14; -------------------------------------------------------------------------------- /qt/aqt/data/web/css/_card_counts.scss: -------------------------------------------------------------------------------- 1 | .review-count { 2 | color: var(--review-count); 3 | } 4 | 5 | .new-count { 6 | color: var(--new-count); 7 | } 8 | 9 | .learn-count { 10 | color: var(--learn-count); 11 | } 12 | 13 | .zero-count { 14 | color: var(--zero-count); 15 | } 16 | 17 | .nightMode { 18 | .review-count { 19 | color: var(--review-count); 20 | } 21 | 22 | .new-count { 23 | color: var(--new-count); 24 | } 25 | 26 | .learn-count { 27 | color: var(--learn-count); 28 | } 29 | 30 | .zero-count { 31 | color: var(--zero-count); 32 | } 33 | } 34 | 35 | -------------------------------------------------------------------------------- /ts/eslint.bzl: -------------------------------------------------------------------------------- 1 | load("@npm//eslint:index.bzl", _eslint_test = "eslint_test") 2 | 3 | def eslint_test(name = "eslint", srcs = []): 4 | _eslint_test( 5 | name = name, 6 | args = [ 7 | "--max-warnings=0", 8 | "--ext", 9 | ".ts", 10 | "-c", 11 | "$(location //ts:.eslintrc.js)", 12 | ] + [native.package_name() + "/" + f for f in srcs], 13 | data = [ 14 | "//ts:.eslintrc.js", 15 | "@npm//@typescript-eslint/parser", 16 | "@npm//@typescript-eslint/eslint-plugin", 17 | ] + srcs, 18 | ) 19 | -------------------------------------------------------------------------------- /ts/sass/BUILD.bazel: -------------------------------------------------------------------------------- 1 | load("@io_bazel_rules_sass//:defs.bzl", "sass_binary", "sass_library") 2 | 3 | sass_binary( 4 | name = "core_css", 5 | src = "core.scss", 6 | visibility = ["//visibility:public"], 7 | deps = [ 8 | ":core_lib", 9 | ], 10 | ) 11 | 12 | sass_library( 13 | name = "core_lib", 14 | srcs = [ 15 | "_vars.scss", 16 | "core.scss", 17 | ], 18 | visibility = ["//visibility:public"], 19 | ) 20 | 21 | # qt package extracts colours from source file 22 | exports_files( 23 | ["_vars.scss"], 24 | visibility = ["//qt:__subpackages__"], 25 | ) 26 | -------------------------------------------------------------------------------- /platforms/BUILD.bazel: -------------------------------------------------------------------------------- 1 | package(default_visibility = ["//visibility:public"]) 2 | 3 | config_setting( 4 | name = "windows_x86_64", 5 | constraint_values = [ 6 | "@platforms//os:windows", 7 | "@platforms//cpu:x86_64", 8 | ], 9 | ) 10 | 11 | config_setting( 12 | name = "macos_x86_64", 13 | constraint_values = [ 14 | "@platforms//os:macos", 15 | "@platforms//cpu:x86_64", 16 | ], 17 | ) 18 | 19 | config_setting( 20 | name = "linux_x86_64", 21 | constraint_values = [ 22 | "@platforms//os:linux", 23 | "@platforms//cpu:x86_64", 24 | ], 25 | ) 26 | -------------------------------------------------------------------------------- /qt/linux/anki.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Anki 2.1 collection package 6 | 7 | 8 | 9 | 10 | Anki 2.0 deck package 11 | 12 | 13 | 14 | 15 | Anki 2.1 add-on package 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /ts/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | extends: [ 3 | "eslint:recommended", 4 | "plugin:@typescript-eslint/eslint-recommended", 5 | "plugin:@typescript-eslint/recommended", 6 | ], 7 | parser: "@typescript-eslint/parser", 8 | plugins: ["@typescript-eslint"], 9 | rules: { 10 | "prefer-const": "warn", 11 | "@typescript-eslint/ban-ts-ignore": "warn", 12 | "@typescript-eslint/no-unused-vars": [ 13 | "warn", 14 | { argsIgnorePattern: "^_", varsIgnorePattern: "^_" }, 15 | ], 16 | }, 17 | env: { browser: true }, 18 | }; 19 | -------------------------------------------------------------------------------- /qt/aqt/data/web/css/BUILD.bazel: -------------------------------------------------------------------------------- 1 | load("@bazel_skylib//rules:copy_file.bzl", "copy_file") 2 | load("compile_sass.bzl", "compile_sass") 3 | 4 | compile_sass( 5 | srcs = glob( 6 | ["*.scss"], 7 | exclude = ["_*.scss"], 8 | ), 9 | group = "css_local", 10 | visibility = ["//visibility:private"], 11 | ) 12 | 13 | copy_file( 14 | name = "core_css", 15 | src = "//ts/sass:core.css", 16 | out = "core.css", 17 | ) 18 | 19 | filegroup( 20 | name = "css", 21 | srcs = [ 22 | "core.css", 23 | "css_local", 24 | ], 25 | visibility = ["//qt:__subpackages__"], 26 | ) 27 | -------------------------------------------------------------------------------- /qt/aqt/data/web/pages/BUILD.bazel: -------------------------------------------------------------------------------- 1 | load("defs.bzl", "copy_page") 2 | 3 | copy_page( 4 | name = "graphs_page", 5 | srcs = [ 6 | "graphs.css", 7 | "graphs.html", 8 | "graphs.js", 9 | ], 10 | package = "//ts/graphs", 11 | ) 12 | 13 | copy_page( 14 | name = "congrats_page", 15 | srcs = [ 16 | "congrats.html", 17 | "congrats.js", 18 | ], 19 | package = "//ts/congrats", 20 | ) 21 | 22 | filegroup( 23 | name = "pages", 24 | srcs = [ 25 | "congrats_page", 26 | "graphs_page", 27 | ], 28 | visibility = ["//qt:__subpackages__"], 29 | ) 30 | -------------------------------------------------------------------------------- /rslib/src/storage/note/add.sql: -------------------------------------------------------------------------------- 1 | insert into notes ( 2 | id, 3 | guid, 4 | mid, 5 | mod, 6 | usn, 7 | tags, 8 | flds, 9 | sfld, 10 | csum, 11 | flags, 12 | data 13 | ) 14 | values 15 | ( 16 | ( 17 | case 18 | when ?1 in ( 19 | select 20 | id 21 | from notes 22 | ) then ( 23 | select 24 | max(id) + 1 25 | from notes 26 | ) 27 | else ?1 28 | end 29 | ), 30 | ?, 31 | ?, 32 | ?, 33 | ?, 34 | ?, 35 | ?, 36 | ?, 37 | ?, 38 | 0, 39 | "" 40 | ) -------------------------------------------------------------------------------- /qt/tests/run_pylint.py: -------------------------------------------------------------------------------- 1 | import os 2 | import subprocess 3 | import sys 4 | 5 | import PyQt5.QtCore 6 | 7 | if __name__ == "__main__": 8 | (module, ini) = sys.argv[1:] 9 | ini = os.path.abspath(ini) 10 | 11 | sys.exit( 12 | subprocess.run( 13 | [ 14 | sys.executable, 15 | "-m", 16 | "pylint", 17 | "qt/aqt/qt.py", 18 | "--rcfile", 19 | ini, 20 | "--extension-pkg-whitelist=PyQt5", 21 | "-v", 22 | ], 23 | check=False, 24 | ).returncode 25 | ) 26 | -------------------------------------------------------------------------------- /ts/lib/cards.ts: -------------------------------------------------------------------------------- 1 | // Copyright: Ankitects Pty Ltd and contributors 2 | // License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html 3 | 4 | export enum CardQueue { 5 | /// due is the order cards are shown in 6 | New = 0, 7 | /// due is a unix timestamp 8 | Learn = 1, 9 | /// due is days since creation date 10 | Review = 2, 11 | DayLearn = 3, 12 | /// due is a unix timestamp. 13 | /// preview cards only placed here when failed. 14 | PreviewRepeat = 4, 15 | /// cards are not due in these states 16 | Suspended = -1, 17 | UserBuried = -2, 18 | SchedBuried = -3, 19 | } 20 | -------------------------------------------------------------------------------- /ftl/core/media.ftl: -------------------------------------------------------------------------------- 1 | media-error-executing = Error executing { $val }. 2 | media-error-running = Error running { $val } 3 | media-for-security-reasons-is-not = For security reasons, '{ $val }' is not allowed on cards. You can still use it by placing the command in a different package, and importing that package in the LaTeX header instead. 4 | media-generated-file = Generated file: { $val } 5 | media-have-you-installed-latex-and-dvipngdvisvgm = Have you installed latex and dvipng/dvisvgm? 6 | media-recordingtime = Recording...
Time: { $secs } 7 | media-sound-and-video-on-cards-will = Sound and video on cards will not function until mpv or mplayer is installed. 8 | -------------------------------------------------------------------------------- /ts/congrats/bootstrap.ts: -------------------------------------------------------------------------------- 1 | // Copyright: Ankitects Pty Ltd and contributors 2 | // License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html 3 | 4 | import { setupI18n } from "anki/i18n"; 5 | import CongratsPage from "./CongratsPage.svelte"; 6 | import { getCongratsInfo } from "./lib"; 7 | import { checkNightMode } from "anki/nightmode"; 8 | 9 | export async function congrats(target: HTMLDivElement): Promise { 10 | checkNightMode(); 11 | const i18n = await setupI18n(); 12 | const info = await getCongratsInfo(); 13 | new CongratsPage({ 14 | target, 15 | props: { info, i18n }, 16 | }); 17 | } 18 | -------------------------------------------------------------------------------- /pylib/anki/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: UTF-8 -*- 2 | # Copyright: Ankitects Pty Ltd and contributors 3 | # License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html 4 | 5 | import sys 6 | 7 | from anki.buildinfo import version 8 | from anki.collection import Collection 9 | 10 | if sys.version_info[0] < 3 or sys.version_info[1] < 7: 11 | raise Exception("Anki requires Python 3.7+") 12 | 13 | # ensure unicode filenames are supported 14 | try: 15 | "テスト".encode(sys.getfilesystemencoding()) 16 | except UnicodeEncodeError as exc: 17 | raise Exception("Anki requires a UTF-8 locale.") from exc 18 | 19 | __all__ = ["Collection"] 20 | -------------------------------------------------------------------------------- /rslib/build/main.rs: -------------------------------------------------------------------------------- 1 | pub mod mergeftl; 2 | pub mod protobuf; 3 | 4 | fn main() { 5 | mergeftl::write_ftl_files_and_fluent_rs(); 6 | protobuf::write_backend_proto_rs(); 7 | 8 | // when building with cargo (eg for rust analyzer), generate a dummy BUILDINFO 9 | if std::env::var("BAZEL").is_err() { 10 | let buildinfo_out = 11 | std::path::Path::new(&std::env::var("OUT_DIR").unwrap()).join("buildinfo.txt"); 12 | std::fs::write(&buildinfo_out, "").unwrap(); 13 | println!( 14 | "cargo:rustc-env=BUILDINFO={}", 15 | buildinfo_out.to_str().expect("buildinfo") 16 | ); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /qt/aqt/data/web/css/overview.scss: -------------------------------------------------------------------------------- 1 | /* Copyright: Ankitects Pty Ltd and contributors 2 | * License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html */ 3 | 4 | @use 'card_counts'; 5 | 6 | .smallLink { 7 | font-size: 10px; 8 | } 9 | 10 | h3 { 11 | margin-bottom: 0; 12 | } 13 | 14 | .descfont { 15 | padding: 1em; 16 | color: var(--slightly-grey-text); 17 | } 18 | 19 | .description { 20 | white-space: pre-wrap; 21 | } 22 | 23 | #fulldesc { 24 | display: none; 25 | } 26 | 27 | .descmid { 28 | width: 70%; 29 | margin: 0 auto 0; 30 | text-align: left; 31 | } 32 | 33 | .dyn { 34 | text-align: center; 35 | } 36 | -------------------------------------------------------------------------------- /ts/lib/postrequest.ts: -------------------------------------------------------------------------------- 1 | // Copyright: Ankitects Pty Ltd and contributors 2 | // License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html 3 | 4 | export async function postRequest(path: string, body: string): Promise { 5 | const resp = await fetch(path, { 6 | method: "POST", 7 | body, 8 | }); 9 | if (!resp.ok) { 10 | throw Error(`unexpected reply: ${resp.statusText}`); 11 | } 12 | // get returned bytes 13 | const respBlob = await resp.blob(); 14 | const respBuf = await new Response(respBlob).arrayBuffer(); 15 | const bytes = new Uint8Array(respBuf); 16 | return bytes; 17 | } 18 | -------------------------------------------------------------------------------- /ftl/core/empty-cards.ftl: -------------------------------------------------------------------------------- 1 | empty-cards-for-note-type = Empty cards for { $notetype }: 2 | empty-cards-count-line = { $empty_count } of { $existing_count } cards empty ({ $template_names }). 3 | empty-cards-window-title = Empty Cards 4 | empty-cards-preserve-notes-checkbox = Keep notes with no valid cards 5 | empty-cards-delete-button = Delete 6 | empty-cards-not-found = No empty cards. 7 | empty-cards-deleted-count = 8 | Deleted { $cards -> 9 | [one] { $cards } card. 10 | *[other] { $cards } cards. 11 | } 12 | empty-cards-delete-empty-cards = Delete Empty Cards 13 | empty-cards-delete-empty-notes = Delete Empty Notes 14 | empty-cards-deleting = Deleting... 15 | -------------------------------------------------------------------------------- /qt/aqt/data/web/css/compile_sass.bzl: -------------------------------------------------------------------------------- 1 | load("@io_bazel_rules_sass//:defs.bzl", "sass_binary") 2 | 3 | def compile_sass(group, srcs, visibility): 4 | css_files = [] 5 | for scss_file in srcs: 6 | base = scss_file.replace(".scss", "") 7 | name = base + "_sass" 8 | css_file = base + ".css" 9 | css_files.append(css_file) 10 | 11 | sass_binary( 12 | name = name, 13 | src = scss_file, 14 | sourcemap = False, 15 | deps = ["//ts/sass:core_lib"], 16 | ) 17 | 18 | native.filegroup( 19 | name = group, 20 | srcs = css_files, 21 | visibility = visibility, 22 | ) 23 | -------------------------------------------------------------------------------- /qt/aqt/data/web/js/toolbar.ts: -------------------------------------------------------------------------------- 1 | enum SyncState { 2 | NoChanges = 0, 3 | Normal, 4 | Full, 5 | } 6 | 7 | function updateSyncColor(state: SyncState) { 8 | const elem = document.getElementById("sync"); 9 | switch (state) { 10 | case SyncState.NoChanges: 11 | elem.classList.remove("full-sync", "normal-sync"); 12 | break; 13 | case SyncState.Normal: 14 | elem.classList.add("normal-sync"); 15 | elem.classList.remove("full-sync"); 16 | break; 17 | case SyncState.Full: 18 | elem.classList.add("full-sync"); 19 | elem.classList.remove("normal-sync"); 20 | break; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /qt/.pylintrc: -------------------------------------------------------------------------------- 1 | [MASTER] 2 | persistent = no 3 | extension-pkg-whitelist=PyQt5,ankirspy 4 | ignore = aqt/forms 5 | init-hook='from PyQt5.QtWebChannel import QWebChannel; print("successful import!"); import sys; print(sys.path)' 6 | 7 | [TYPECHECK] 8 | ignored-modules=win32file,pywintypes,socket,win32pipe 9 | 10 | [REPORTS] 11 | output-format=colorized 12 | 13 | [MESSAGES CONTROL] 14 | disable=C,R, 15 | fixme, 16 | unused-wildcard-import, 17 | attribute-defined-outside-init, 18 | redefined-builtin, 19 | wildcard-import, 20 | broad-except, 21 | bare-except, 22 | unused-argument, 23 | unused-variable, 24 | redefined-outer-name, 25 | global-statement, 26 | protected-access, 27 | arguments-differ, 28 | -------------------------------------------------------------------------------- /qt/aqt/data/web/js/webview.ts: -------------------------------------------------------------------------------- 1 | /* Copyright: Ankitects Pty Ltd and contributors 2 | * License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html */ 3 | 4 | // prevent backspace key from going back a page 5 | document.addEventListener("keydown", function (evt: KeyboardEvent) { 6 | if (evt.keyCode !== 8) { 7 | return; 8 | } 9 | let isText = 0; 10 | const node = evt.target as Element; 11 | const nn = node.nodeName; 12 | if (nn === "INPUT" || nn === "TEXTAREA") { 13 | isText = 1; 14 | } else if (nn === "DIV" && (node as HTMLDivElement).contentEditable) { 15 | isText = 1; 16 | } 17 | if (!isText) { 18 | evt.preventDefault(); 19 | } 20 | }); 21 | -------------------------------------------------------------------------------- /ts/prettier.bzl: -------------------------------------------------------------------------------- 1 | load( 2 | "@npm//prettier:index.bzl", 3 | _prettier_test = "prettier_test", 4 | ) 5 | 6 | def prettier_test(name = "format_check", srcs = [], **kwargs): 7 | _prettier_test( 8 | name = name, 9 | args = [ 10 | "--config", 11 | "$(location //ts:.prettierrc)", 12 | "--check", 13 | ] + [native.package_name() + "/" + f for f in srcs], 14 | data = [ 15 | "//ts:.prettierrc", 16 | "@npm//prettier-plugin-svelte", 17 | ] + srcs, 18 | **kwargs 19 | ) 20 | 21 | def prettier(name = "format", **kwargs): 22 | native.sh_binary( 23 | name = name, 24 | srcs = ["format.sh"], 25 | ) 26 | -------------------------------------------------------------------------------- /run: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | run_linux() { 6 | bazel run $BUILDARGS //qt:runanki -- $* 7 | } 8 | 9 | run_mac() { 10 | # QtWebEngineProcess is unable to locate icudtl.dat from a symlinked tree, 11 | # so we need to copy the files into a working folder before running on a Mac. 12 | workspace=$(dirname $0) 13 | bazel build $BUILDARGS //qt:runanki && \ 14 | rsync -aiL --exclude=anki/external --exclude=__pycache__ --delete --force-delete \ 15 | $workspace/bazel-bin/qt/runanki* $workspace/bazel-copy/ && \ 16 | $workspace/bazel-copy/runanki $* 17 | } 18 | 19 | export PYTHONWARNINGS=default 20 | if [[ "$OSTYPE" == "darwin"* ]]; then 21 | run_mac $* 22 | else 23 | run_linux $* 24 | fi 25 | -------------------------------------------------------------------------------- /qt/aqt/data/web/js/mathjax.js: -------------------------------------------------------------------------------- 1 | window.MathJax = { 2 | tex: { 3 | displayMath: [["\\[", "\\]"]], 4 | processRefs: false, 5 | processEnvironments: false, 6 | packages: { 7 | "[+]": ["noerrors", "mhchem"], 8 | }, 9 | }, 10 | startup: { 11 | typeset: false, 12 | pageReady: () => { 13 | return MathJax.startup.defaultPageReady(); 14 | }, 15 | }, 16 | options: { 17 | renderActions: { 18 | addMenu: [], 19 | checkLoading: [], 20 | }, 21 | ignoreHtmlClass: "tex2jax_ignore", 22 | processHtmlClass: "tex2jax_process", 23 | }, 24 | loader: { 25 | load: ["[tex]/noerrors", "[tex]/mhchem"], 26 | }, 27 | }; 28 | -------------------------------------------------------------------------------- /cargo/README.md: -------------------------------------------------------------------------------- 1 | This folder integrates Rust crates.io fetching into Bazel. 2 | 3 | To update dependencies, ensure a local Rust environment is available 4 | (eg install rustup), then run: 5 | 6 | ``` 7 | cargo install cargo-raze --version 0.8.0 8 | ``` 9 | 10 | After updating dependencies in ../rslib/Cargo.toml, change to this 11 | folder and run python update.py to update the external Bazel repositories 12 | to point to the updated deps. 13 | 14 | A couple of crates need extra work to build with Bazel, and are listed 15 | in ../Cargo.toml. For example: 16 | 17 | ```toml 18 | [package.metadata.raze.crates.pyo3.'*'] 19 | compile_data_attr = "glob([\"**\"])" 20 | ``` 21 | 22 | With minor version updates, you should not normally need to modify 23 | the entries in that file. 24 | -------------------------------------------------------------------------------- /pylib/anki/errors.py: -------------------------------------------------------------------------------- 1 | # Copyright: Ankitects Pty Ltd and contributors 2 | # License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html 3 | 4 | from typing import Any 5 | 6 | 7 | class AnkiError(Exception): 8 | def __init__(self, type, **data) -> None: 9 | super().__init__() 10 | self.type = type 11 | self.data = data 12 | 13 | def __str__(self) -> Any: 14 | m = self.type 15 | if self.data: 16 | m += ": %s" % repr(self.data) 17 | return m 18 | 19 | 20 | class DeckRenameError(Exception): 21 | def __init__(self, description: str) -> None: 22 | super().__init__() 23 | self.description = description 24 | 25 | def __str__(self): 26 | return "Couldn't rename deck: " + self.description 27 | -------------------------------------------------------------------------------- /pylib/tests/run_mypy.py: -------------------------------------------------------------------------------- 1 | import os 2 | import subprocess 3 | import sys 4 | 5 | if __name__ == "__main__": 6 | (module, ini) = sys.argv[1:] 7 | ini = os.path.abspath(ini) 8 | 9 | folder = os.path.join(os.path.dirname(__file__), "..") 10 | os.chdir(folder) 11 | 12 | args = [sys.executable, "-m", "mypy", module, "--config-file", ini] 13 | 14 | if sys.platform.startswith("win32"): 15 | # bazel passes in \\?\c:\... path; mypy can't handle it, so we 16 | # strip off prefix 17 | for entry in sys.path: 18 | if "__mypy_" in entry: 19 | typeshed = entry[4:] + "\\mypy\\typeshed" 20 | args.append("--custom-typeshed-dir") 21 | args.append(typeshed) 22 | 23 | sys.exit(subprocess.run(args, check=False).returncode) 24 | -------------------------------------------------------------------------------- /pip/licenses.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Install runtime requirements into a venv and extract their licenses. 4 | # As Windows currently uses extra deps, running this on Windows should 5 | # capture all packages. 6 | # Run with 'bash licenses.sh' to update 'license.json' 7 | 8 | set -e 9 | 10 | # setup venv 11 | python -m venv venv 12 | 13 | # build wheels 14 | ../bazel.bat --output_base=/c/bazel/anki/base build //pylib/anki:wheel //qt/aqt:wheel 15 | 16 | # install wheels, bound to constrained versions 17 | venv/scripts/pip install -c requirements.txt ../bazel-bin/pylib/anki/*.whl ../bazel-bin/qt/aqt/*.whl pip-licenses 18 | 19 | # dump licenses - ptable is a pip-licenses dep 20 | venv/scripts/pip-licenses --format=json --ignore-packages anki aqt pip-license PTable > licenses.json 21 | 22 | # clean up 23 | rm -rf venv 24 | -------------------------------------------------------------------------------- /rslib/src/storage/card/add_card.sql: -------------------------------------------------------------------------------- 1 | insert into cards ( 2 | id, 3 | nid, 4 | did, 5 | ord, 6 | mod, 7 | usn, 8 | type, 9 | queue, 10 | due, 11 | ivl, 12 | factor, 13 | reps, 14 | lapses, 15 | left, 16 | odue, 17 | odid, 18 | flags, 19 | data 20 | ) 21 | values 22 | ( 23 | ( 24 | case 25 | when ?1 in ( 26 | select 27 | id 28 | from cards 29 | ) then ( 30 | select 31 | max(id) + 1 32 | from cards 33 | ) 34 | else ?1 35 | end 36 | ), 37 | ?, 38 | ?, 39 | ?, 40 | ?, 41 | ?, 42 | ?, 43 | ?, 44 | ?, 45 | ?, 46 | ?, 47 | ?, 48 | ?, 49 | ?, 50 | ?, 51 | ?, 52 | ?, 53 | ? 54 | ) -------------------------------------------------------------------------------- /.buildkite/linux/entrypoint: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | # check author has added themselves to CONTRIBUTORS 6 | echo "--- Checking CONTRIBUTORS" 7 | .buildkite/linux/check_contributors 8 | 9 | echo "--- Building" 10 | BAZEL="bazel --output_user_root=/state/bazel --output_base=/state/bazel/anki" 11 | BUILDARGS="--config=ci --experimental_convenience_symlinks=ignore --disk_cache=/state/bazel/disk --repository_cache=/state/bazel/repo" 12 | 13 | # move existing node_modules into tree 14 | test -e /state/node_modules && mv /state/node_modules ts/ 15 | 16 | $BAZEL build $BUILDARGS ... 17 | 18 | echo "+++ Running tests" 19 | $BAZEL test $BUILDARGS ... 20 | 21 | echo "--- Building wheels" 22 | $BAZEL build dist 23 | 24 | echo "--- Cleanup" 25 | # if tests succeed, back up node_modules folder 26 | mv ts/node_modules /state/ 27 | -------------------------------------------------------------------------------- /rslib/src/decks/counts.rs: -------------------------------------------------------------------------------- 1 | // Copyright: Ankitects Pty Ltd and contributors 2 | // License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html 3 | 4 | use crate::{collection::Collection, decks::DeckID, err::Result}; 5 | use std::collections::HashMap; 6 | 7 | #[derive(Debug)] 8 | pub(crate) struct DueCounts { 9 | pub new: u32, 10 | pub review: u32, 11 | pub learning: u32, 12 | } 13 | 14 | impl Collection { 15 | /// Get due counts for decks at the given timestamp. 16 | pub(crate) fn due_counts( 17 | &mut self, 18 | days_elapsed: u32, 19 | learn_cutoff: u32, 20 | limit_to: Option<&str>, 21 | ) -> Result> { 22 | self.storage 23 | .due_counts(self.sched_ver(), days_elapsed, learn_cutoff, limit_to) 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /ts/graphs/TodayStats.svelte: -------------------------------------------------------------------------------- 1 | 15 | 16 | {#if todayData} 17 |
18 |

{todayData.title}

19 | 20 |
21 | {#each todayData.lines as line} 22 |
{line}
23 | {/each} 24 |
25 |
26 | {/if} 27 | -------------------------------------------------------------------------------- /ts/svelte.bzl: -------------------------------------------------------------------------------- 1 | load("@build_bazel_rules_svelte//:defs.bzl", "svelte") 2 | load("@npm//svelte-check:index.bzl", _svelte_check = "svelte_check_test") 3 | 4 | def compile_svelte(name, srcs): 5 | for src in srcs: 6 | svelte( 7 | name = src.replace(".svelte", ""), 8 | entry_point = src, 9 | ) 10 | 11 | native.filegroup( 12 | name = name, 13 | srcs = srcs, 14 | ) 15 | 16 | def svelte_check(name = "svelte_check", srcs = []): 17 | _svelte_check( 18 | name = name, 19 | args = [ 20 | "--workspace", 21 | native.package_name(), 22 | ], 23 | data = [ 24 | "//ts:tsconfig.json", 25 | "//ts/lib", 26 | "//ts/lib:backend_proto", 27 | ] + srcs, 28 | link_workspace_root = True, 29 | ) 30 | -------------------------------------------------------------------------------- /ftl/qt/preferences.ftl: -------------------------------------------------------------------------------- 1 | # shown instead of the 'night mode' option when night mode is forced on because 2 | # macOS is in dark mode 3 | preferences-dark-mode-active = macOS is in dark mode 4 | preferences-dark-mode-disable = 5 | To show Anki in light mode while macOS is in dark mode, please 6 | see the Night Mode section of the manual. 7 | 8 | ## Video drivers/hardware acceleration. Please avoid translating 'OpenGL' and 'ANGLE'. 9 | 10 | preferences-video-driver = Video driver: { $driver } 11 | preferences-video-driver-opengl-mac = OpenGL (recommended on Macs) 12 | preferences-video-driver-software-mac = Software (not recommended) 13 | preferences-video-driver-opengl-other = OpenGL (faster, may cause issues) 14 | preferences-video-driver-software-other = Software (slower) 15 | preferences-video-driver-angle = ANGLE (may work better than OpenGL) 16 | -------------------------------------------------------------------------------- /ts/rollup.config.js: -------------------------------------------------------------------------------- 1 | import resolve from "@rollup/plugin-node-resolve"; 2 | import commonjs from "@rollup/plugin-commonjs"; 3 | import { terser } from "rollup-plugin-terser"; 4 | 5 | import process from "process"; 6 | const production = process.env["COMPILATION_MODE"] === "opt"; 7 | 8 | export default { 9 | external: ["protobufjs/light"], 10 | output: { 11 | globals: { 12 | "protobufjs/light": "protobuf", 13 | }, 14 | name: "anki", 15 | }, 16 | plugins: [ 17 | resolve({ 18 | browser: true, 19 | dedupe: ["svelte", "protobufjs"], 20 | }), 21 | commonjs(), 22 | production && terser(), 23 | ], 24 | onwarn: function (warning, warn) { 25 | if (warning.code === "CIRCULAR_DEPENDENCY") return; 26 | throw warning; 27 | }, 28 | }; 29 | -------------------------------------------------------------------------------- /pip/requirements.in: -------------------------------------------------------------------------------- 1 | beautifulsoup4 2 | black 3 | decorator 4 | distro 5 | flask 6 | flask-cors 7 | isort 8 | jsonschema 9 | markdown 10 | mock 11 | mypy 12 | mypy-protobuf 13 | orjson 14 | pip-tools 15 | protobuf 16 | pylint 17 | pytest 18 | requests[socks] 19 | send2trash 20 | snakeviz 21 | stringcase 22 | waitress>=2.0.0b1 23 | fluent-syntax 24 | 25 | # windows only 26 | psutil; sys.platform == "win32" 27 | pywin32; sys.platform == "win32" 28 | # pinned due to https://github.com/microsoft/xlang/issues/717 29 | winrt==1.0.20239.1; sys.platform == "win32" and platform_release == "10" and python_version == "3.8" 30 | winrt; sys.platform == "win32" and platform_release == "10" and python_version >= "3.9" 31 | 32 | # transitive windows dependencies 33 | atomicwrites; sys.platform == "win32" # via pytest 34 | colorama; sys.platform == "win32" # via pylint, pytest 35 | -------------------------------------------------------------------------------- /rslib/src/storage/card/congrats.sql: -------------------------------------------------------------------------------- 1 | select coalesce( 2 | sum( 3 | queue in (:review_queue, :day_learn_queue) 4 | and due <= :today 5 | ), 6 | 0 7 | ) as review_count, 8 | coalesce(sum(queue = :new_queue), 0) as new_count, 9 | coalesce(sum(queue = :sched_buried_queue), 0) as sched_buried, 10 | coalesce(sum(queue = :user_buried_queue), 0) as user_buried, 11 | coalesce(sum(queue = :learn_queue), 0) as learn_count, 12 | max( 13 | 0, 14 | coalesce( 15 | min( 16 | case 17 | when queue = :learn_queue then due 18 | else null 19 | end 20 | ), 21 | 0 22 | ) 23 | ) as first_learn_due 24 | from cards 25 | where did in ( 26 | select id 27 | from active_decks 28 | ) -------------------------------------------------------------------------------- /qt/aqt/forms/compile.bzl: -------------------------------------------------------------------------------- 1 | def compile(name, ui_file, py_file): 2 | native.genrule( 3 | name = name, 4 | srcs = [ui_file], 5 | outs = [py_file], 6 | cmd = "$(location build_ui) $(location {ui_file}) $(location {py_file})".format( 7 | ui_file = ui_file, 8 | py_file = py_file, 9 | ), 10 | tools = [ 11 | "build_ui", 12 | ], 13 | message = "Building UI", 14 | ) 15 | 16 | def compile_all(group, srcs, visibility): 17 | py_files = [] 18 | for ui_file in srcs: 19 | name = ui_file.replace(".ui", "") 20 | py_file = name + ".py" 21 | py_files.append(py_file) 22 | compile(name, ui_file, py_file) 23 | 24 | native.filegroup( 25 | name = group, 26 | srcs = py_files + ["__init__.py"], 27 | visibility = visibility, 28 | ) 29 | -------------------------------------------------------------------------------- /rslib/src/search/notes.rs: -------------------------------------------------------------------------------- 1 | // Copyright: Ankitects Pty Ltd and contributors 2 | // License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html 3 | 4 | use super::{parser::Node, sqlwriter::SqlWriter}; 5 | use crate::collection::Collection; 6 | use crate::err::Result; 7 | use crate::notes::NoteID; 8 | use crate::search::parser::parse; 9 | 10 | impl Collection { 11 | pub fn search_notes(&mut self, search: &str) -> Result> { 12 | let top_node = Node::Group(parse(search)?); 13 | let writer = SqlWriter::new(self); 14 | let (sql, args) = writer.build_notes_query(&top_node)?; 15 | 16 | let mut stmt = self.storage.db.prepare(&sql)?; 17 | let ids: Vec<_> = stmt 18 | .query_map(&args, |row| row.get(0))? 19 | .collect::>()?; 20 | 21 | Ok(ids) 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /pylib/mypy.ini: -------------------------------------------------------------------------------- 1 | [mypy] 2 | python_version = 3.8 3 | pretty = false 4 | no_strict_optional = true 5 | show_error_codes = true 6 | check_untyped_defs = true 7 | disallow_untyped_decorators = True 8 | warn_redundant_casts = True 9 | warn_unused_configs = True 10 | strict_equality = true 11 | 12 | [mypy-win32file] 13 | ignore_missing_imports = True 14 | [mypy-win32pipe] 15 | ignore_missing_imports = True 16 | [mypy-pywintypes] 17 | ignore_missing_imports = True 18 | [mypy-winerror] 19 | ignore_missing_imports = True 20 | [mypy-distro] 21 | ignore_missing_imports = True 22 | [mypy-win32api] 23 | ignore_missing_imports = True 24 | [mypy-xml.dom] 25 | ignore_missing_imports = True 26 | [mypy-psutil] 27 | ignore_missing_imports = True 28 | [mypy-bs4] 29 | ignore_missing_imports = True 30 | [mypy-anki._rsbridge] 31 | ignore_missing_imports = True 32 | [mypy-stringcase] 33 | ignore_missing_imports = True 34 | -------------------------------------------------------------------------------- /.buildkite/linux/check_contributors: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -eu -o pipefail ${SHELLFLAGS} 4 | 5 | antispam=", at the domain " 6 | 7 | headAuthor=$(git log -1 --pretty=format:'%ae') 8 | authorAt=$(echo "$headAuthor" | sed "s/@/$antispam/") 9 | if git log --pretty=format:'%ae' CONTRIBUTORS | grep -i "$headAuthor" > /dev/null; then 10 | echo "Author found in CONTRIBUTORS" 11 | else 12 | echo "All contributors:" 13 | git log --pretty=format:' - %ae' CONTRIBUTORS |sort |uniq |sort -f | sed "s/@/$antispam/" 14 | 15 | echo "Author $authorAt NOT found in list" 16 | echo 17 | cat <Visit website 10 | about-written-by-damien-elmes-with-patches = Written by Damien Elmes, with patches, translation, testing and design from:

{ $cont } 11 | -------------------------------------------------------------------------------- /qt/aqt/forms/BUILD.bazel: -------------------------------------------------------------------------------- 1 | load("@rules_python//python:defs.bzl", "py_binary") 2 | load("compile.bzl", "compile_all") 3 | 4 | py_binary( 5 | name = "build_ui", 6 | srcs = ["build_ui.py"], 7 | legacy_create_init = False, 8 | deps = ["@pyqt5//:pkg"], 9 | ) 10 | 11 | compile_all( 12 | srcs = glob(["*.ui"]), 13 | group = "forms", 14 | visibility = [ 15 | "//qt/aqt:__pkg__", 16 | "//qt/po:__pkg__", 17 | ], 18 | ) 19 | 20 | py_binary( 21 | name = "build_rcc", 22 | srcs = ["build_rcc.py"], 23 | legacy_create_init = False, 24 | deps = ["@pyqt5//:pkg"], 25 | ) 26 | 27 | genrule( 28 | name = "icons", 29 | srcs = ["icons.qrc"] + glob(["icons/*"]), 30 | outs = ["icons_rc.py"], 31 | cmd = "$(location build_rcc) $(location icons.qrc) $(location icons_rc.py)", 32 | tools = ["build_rcc"], 33 | visibility = ["//qt/aqt:__pkg__"], 34 | ) 35 | -------------------------------------------------------------------------------- /scripts/buildinfo.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import re 4 | import sys 5 | 6 | defs_file = sys.argv[1] 7 | stamp_file = sys.argv[2] 8 | release_mode = sys.argv[3] == "release" 9 | 10 | version_re = re.compile('anki_version = "(.*)"') 11 | 12 | def output(text: str) -> None: 13 | "Add text with a '\n' to stdout; avoiding a '\r' on Windows" 14 | sys.stdout.buffer.write(text.encode("utf8") + b"\n") 15 | 16 | # extract version number from defs.bzl 17 | for line in open(defs_file).readlines(): 18 | if ver := version_re.match(line): 19 | output(f"STABLE_VERSION {ver.group(1)}") 20 | 21 | for line in open(stamp_file).readlines(): 22 | if line.startswith("STABLE_BUILDHASH"): 23 | if release_mode: 24 | output(line.strip()) 25 | else: 26 | # if not in release mode, map buildhash to a consistent value 27 | output("STABLE_BUILDHASH dev") 28 | -------------------------------------------------------------------------------- /qt/tools/extract_sass_colors.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: UTF-8 -*- 3 | 4 | import json 5 | import re 6 | import sys 7 | 8 | input_scss = sys.argv[1] 9 | output_py = sys.argv[2] 10 | 11 | colors = {} 12 | 13 | for line in open(input_scss): 14 | line = line.strip() 15 | if not line: 16 | continue 17 | m = re.match(r"--(.+): (.+);$", line) 18 | if not m: 19 | if ( 20 | line != "}" 21 | and not ":root" in line 22 | and "Copyright" not in line 23 | and "License" not in line 24 | ): 25 | print("failed to match", line) 26 | continue 27 | 28 | var = m.group(1) 29 | val = m.group(2) 30 | 31 | colors.setdefault(var, []).append(val) 32 | 33 | with open(output_py, "w") as buf: 34 | buf.write("# this file is auto-generated from _vars.scss\n") 35 | buf.write("colors = " + json.dumps(colors)) 36 | -------------------------------------------------------------------------------- /pylib/tests/test_stats.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: UTF-8 -*- 3 | 4 | import os 5 | import tempfile 6 | 7 | from tests.shared import getEmptyCol 8 | 9 | 10 | def test_stats(): 11 | col = getEmptyCol() 12 | note = col.newNote() 13 | note["Front"] = "foo" 14 | col.addNote(note) 15 | c = note.cards()[0] 16 | # card stats 17 | assert col.cardStats(c) 18 | col.reset() 19 | c = col.sched.getCard() 20 | col.sched.answerCard(c, 3) 21 | col.sched.answerCard(c, 2) 22 | assert col.cardStats(c) 23 | 24 | 25 | def test_graphs_empty(): 26 | col = getEmptyCol() 27 | assert col.stats().report() 28 | 29 | 30 | def test_graphs(): 31 | dir = tempfile.gettempdir() 32 | col = getEmptyCol() 33 | g = col.stats() 34 | rep = g.report() 35 | with open(os.path.join(dir, "test.html"), "w", encoding="UTF-8") as note: 36 | note.write(rep) 37 | return 38 | -------------------------------------------------------------------------------- /rslib/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright: Ankitects Pty Ltd and contributors 2 | // License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html 3 | 4 | #![deny(unused_must_use)] 5 | 6 | pub mod backend; 7 | mod backend_proto; 8 | pub mod card; 9 | pub mod cloze; 10 | pub mod collection; 11 | pub mod config; 12 | pub mod dbcheck; 13 | pub mod deckconf; 14 | pub mod decks; 15 | pub mod err; 16 | pub mod filtered; 17 | pub mod findreplace; 18 | mod fluent_proto; 19 | pub mod i18n; 20 | pub mod latex; 21 | pub mod log; 22 | pub mod media; 23 | pub mod notes; 24 | pub mod notetype; 25 | mod preferences; 26 | pub mod prelude; 27 | pub mod revlog; 28 | pub mod sched; 29 | pub mod search; 30 | pub mod serde; 31 | mod stats; 32 | pub mod storage; 33 | mod sync; 34 | pub mod tags; 35 | pub mod template; 36 | pub mod template_filters; 37 | pub mod text; 38 | pub mod timestamp; 39 | pub mod types; 40 | pub mod undo; 41 | pub mod version; 42 | -------------------------------------------------------------------------------- /ts/graphs/HistogramGraph.svelte: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /ftl/core/card-stats.ftl: -------------------------------------------------------------------------------- 1 | card-stats-added = Added 2 | card-stats-first-review = First Review 3 | card-stats-latest-review = Latest Review 4 | card-stats-interval = Interval 5 | card-stats-ease = Ease 6 | card-stats-review-count = Reviews 7 | card-stats-lapse-count = Lapses 8 | card-stats-average-time = Average Time 9 | card-stats-total-time = Total Time 10 | card-stats-new-card-position = Position 11 | card-stats-card-template = Card Type 12 | card-stats-note-type = Note Type 13 | card-stats-deck-name = Deck 14 | card-stats-note-id = Note ID 15 | card-stats-card-id = Card ID 16 | card-stats-review-log-rating = Rating 17 | card-stats-review-log-type = Type 18 | card-stats-review-log-date = Date 19 | card-stats-review-log-time-taken = Time 20 | card-stats-review-log-type-learn = Learn 21 | card-stats-review-log-type-review = Review 22 | card-stats-review-log-type-relearn = Relearn 23 | card-stats-review-log-type-filtered = Filtered 24 | card-stats-review-log-type-manual = Manual 25 | -------------------------------------------------------------------------------- /pip/README.md: -------------------------------------------------------------------------------- 1 | To achieve reproducible builds we use pip-tools to lock packages to a particular version. 2 | Sadly this is complicated by the fact that Python can only tell us which transitive dependencies 3 | are required by actually installing packages, and if you run pip-tools on a Mac or Linux machine, 4 | it will miss packages that are required on Windows and vice versa. 5 | 6 | So we're stuck manually merging dependencies for now. To update deps: 7 | 8 | - run 'bazel run update' to update requirements.txt for the current 9 | platform 10 | - consult the git diff, and manually merge the changes, undoing the removal 11 | of items pinned on other platforms 12 | - repeat the process on the other platform 13 | - run the tests to ensure nothing has broken on either platform 14 | - commit the changes to requirements.txt 15 | 16 | At the time of writing, Macs and Linux machines have identical output - it is only 17 | Windows that differs. But we should not assume that will always be the case. 18 | -------------------------------------------------------------------------------- /qt/aqt/data/web/js/deckbrowser.ts: -------------------------------------------------------------------------------- 1 | /* Copyright: Ankitects Pty Ltd and contributors 2 | * License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html */ 3 | 4 | $(init); 5 | 6 | function init() { 7 | $("tr.deck").draggable({ 8 | scroll: false, 9 | 10 | // can't use "helper: 'clone'" because of a bug in jQuery 1.5 11 | helper: function (event) { 12 | return $(this).clone(false); 13 | }, 14 | delay: 200, 15 | opacity: 0.7, 16 | }); 17 | $("tr.deck").droppable({ 18 | drop: handleDropEvent, 19 | hoverClass: "drag-hover", 20 | }); 21 | $("tr.top-level-drag-row").droppable({ 22 | drop: handleDropEvent, 23 | hoverClass: "drag-hover", 24 | }); 25 | } 26 | 27 | function handleDropEvent(event, ui) { 28 | const draggedDeckId = ui.draggable.attr("id"); 29 | const ontoDeckId = $(this).attr("id") || ""; 30 | 31 | pycmd("drag:" + draggedDeckId + "," + ontoDeckId); 32 | } 33 | -------------------------------------------------------------------------------- /pylib/tools/diff-sched.py: -------------------------------------------------------------------------------- 1 | # a quick script to compare methods in the two schedulers 2 | 3 | import inspect 4 | import sys 5 | from difflib import SequenceMatcher, unified_diff 6 | 7 | from anki.sched import Scheduler as S1 8 | from anki.schedv2 import Scheduler as S2 9 | 10 | s1map = {} 11 | for k, v in S1.__dict__.items(): 12 | if not callable(v): 13 | continue 14 | s1map[k] = v 15 | 16 | s2map = {} 17 | for k, v in S2.__dict__.items(): 18 | if not callable(v): 19 | continue 20 | s2map[k] = v 21 | 22 | for k, v in s1map.items(): 23 | if k not in s2map: 24 | continue 25 | 26 | s1b = inspect.getsource(v) 27 | s2b = inspect.getsource(s2map[k]) 28 | ratio = SequenceMatcher(None, s1b, s2b).ratio() 29 | 30 | if ratio >= 0.90: 31 | print("*" * 80) 32 | print(k, "%d%%" % (ratio * 100)) 33 | sys.stdout.writelines( 34 | "\n".join(unified_diff(s1b.splitlines(), s2b.splitlines(), lineterm="")) 35 | ) 36 | print() 37 | -------------------------------------------------------------------------------- /ftl/core/actions.ftl: -------------------------------------------------------------------------------- 1 | actions-add = Add 2 | actions-blue-flag = Blue Flag 3 | actions-cancel = Cancel 4 | actions-choose = Choose 5 | actions-close = Close 6 | actions-copy = Copy 7 | actions-custom-study = Custom Study 8 | actions-decks = Decks 9 | actions-delete = Delete 10 | actions-export = Export 11 | actions-filter = Filter 12 | actions-green-flag = Green Flag 13 | actions-help = Help 14 | actions-import = Import 15 | actions-manage = Manage... 16 | actions-name = Name: 17 | actions-new = New 18 | actions-new-name = New name: 19 | actions-options = Options 20 | actions-options-for = Options for { $val } 21 | actions-orange-flag = Orange Flag 22 | actions-preview = Preview 23 | actions-rebuild = Rebuild 24 | actions-red-flag = Red Flag 25 | actions-rename = Rename 26 | actions-rename-deck = Rename Deck 27 | actions-replay-audio = Replay Audio 28 | actions-reposition = Reposition 29 | actions-save = Save 30 | actions-search = Search 31 | actions-shortcut-key = Shortcut key: { $val } 32 | actions-suspend-card = Suspend Card 33 | -------------------------------------------------------------------------------- /qt/linux/install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | if [ "$PREFIX" = "" ]; then 6 | PREFIX=/usr/local 7 | fi 8 | 9 | rm -rf ${PREFIX}/share/anki 10 | mkdir -p ${PREFIX}/share/anki 11 | cp -av * ${PREFIX}/share/anki/ 12 | mkdir -p ${PREFIX}/bin 13 | ln -sf ${PREFIX}/share/anki/bin/Anki ${PREFIX}/bin/anki 14 | # fix a previous packaging issue where we created this as a file 15 | (test -f ${PREFIX}/share/applications && rm ${PREFIX}/share/applications)||true 16 | mkdir -p ${PREFIX}/share/pixmaps 17 | mkdir -p ${PREFIX}/share/applications 18 | mkdir -p ${PREFIX}/share/man/man1 19 | cd ${PREFIX}/share/anki && (\ 20 | mv anki.xpm anki.png ${PREFIX}/share/pixmaps/;\ 21 | mv anki.desktop ${PREFIX}/share/applications/;\ 22 | mv anki.1 ${PREFIX}/share/man/man1/) 23 | 24 | xdg-mime install anki.xml --novendor 25 | xdg-mime default anki.desktop application/x-colpkg 26 | xdg-mime default anki.desktop application/x-apkg 27 | xdg-mime default anki.desktop application/x-ankiaddon 28 | 29 | echo "Install complete. Type 'anki' to run." 30 | -------------------------------------------------------------------------------- /pylib/tools/protoc_wrapper.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env 2 | # 3 | # Wrapper for protoc that strips the dirname from the output files, 4 | # and generates mypy typechecking info. 5 | 6 | import os 7 | import shutil 8 | import subprocess 9 | import sys 10 | 11 | (protoc, mypy_protobuf, proto, outdir) = sys.argv[1:] 12 | 13 | # copy to current dir 14 | basename = os.path.basename(proto) 15 | shutil.copyfile(proto, basename) 16 | 17 | # output filenames 18 | without_ext = os.path.splitext(basename)[0] 19 | pb2_py = without_ext + "_pb2.py" 20 | pb2_pyi = without_ext + "_pb2.pyi" 21 | 22 | # invoke protoc 23 | subprocess.run( 24 | [ 25 | protoc, 26 | "--plugin=protoc-gen-mypy=" + mypy_protobuf, 27 | "--python_out=.", 28 | "--mypy_out=.", 29 | basename, 30 | ], 31 | # mypy prints to stderr on success :-( 32 | stderr=subprocess.DEVNULL, 33 | check=True, 34 | ) 35 | 36 | # move files into output 37 | shutil.move(pb2_py, outdir + "/" + pb2_py) 38 | shutil.move(pb2_pyi, outdir + "/" + pb2_pyi) 39 | -------------------------------------------------------------------------------- /qt/aqt/data/web/css/webview.scss: -------------------------------------------------------------------------------- 1 | /* Copyright: Ankitects Pty Ltd and contributors 2 | * License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html */ 3 | 4 | @use 'ts/sass/core'; 5 | @use 'buttons'; 6 | 7 | // core.scss sets border-box, but we need to 8 | // keep the old behaviour for now to avoid breaking 9 | // add-ons/card templates 10 | * { 11 | box-sizing: content-box; 12 | } 13 | 14 | body { 15 | margin: 2em; 16 | overscroll-behavior: none; 17 | } 18 | 19 | h1 { 20 | margin-bottom: 0.2em; 21 | } 22 | 23 | body.nightMode { 24 | &::-webkit-scrollbar { 25 | background: var(--window-bg); 26 | 27 | &:horizontal { 28 | height: 12px; 29 | } 30 | 31 | &:vertical { 32 | width: 12px; 33 | } 34 | } 35 | 36 | &::-webkit-scrollbar-thumb { 37 | background: buttons.$fusion-button-hover-bg; 38 | border-radius: 8px; 39 | 40 | &:horizontal { 41 | min-width: 50px; 42 | } 43 | 44 | &:vertical { 45 | min-height: 50px; 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /rslib/src/storage/deck/due_counts.sql: -------------------------------------------------------------------------------- 1 | select did, 2 | sum(queue = :new_queue), 3 | sum( 4 | queue = :review_queue 5 | and due <= :day_cutoff 6 | ), 7 | -- learning 8 | sum( 9 | ( 10 | case 11 | :sched_ver 12 | when 2 then ( 13 | -- v2 scheduler 14 | ( 15 | queue = :learn_queue 16 | and due < :learn_cutoff 17 | ) 18 | or ( 19 | queue = :daylearn_queue 20 | and due <= :day_cutoff 21 | ) 22 | or ( 23 | queue = :preview_queue 24 | and due <= :learn_cutoff 25 | ) 26 | ) 27 | else ( 28 | -- v1 scheduler 29 | case 30 | when queue = :learn_queue 31 | and due < :learn_cutoff then left / 1000 32 | when queue = :daylearn_queue 33 | and due <= :day_cutoff then 1 34 | else 0 35 | end 36 | ) 37 | end 38 | ) 39 | ) 40 | from cards 41 | where queue >= 0 -------------------------------------------------------------------------------- /pylib/anki/buildinfo.py: -------------------------------------------------------------------------------- 1 | # Copyright: Ankitects Pty Ltd and contributors 2 | # License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html 3 | 4 | import os 5 | import sys 6 | from typing import Dict 7 | 8 | 9 | def _build_info_path() -> str: 10 | path = os.path.join(os.path.dirname(__file__), "buildinfo.txt") 11 | # running in place? 12 | if os.path.exists(path): 13 | return path 14 | # packaged build? 15 | path = os.path.join(sys.prefix, "buildinfo.txt") 16 | if os.path.exists(path): 17 | return path 18 | 19 | raise Exception("missing buildinfo.txt") 20 | 21 | def _get_build_info() -> Dict[str, str]: 22 | info = {} 23 | with open(_build_info_path()) as file: 24 | for line in file.readlines(): 25 | elems = line.split() 26 | if len(elems) == 2: 27 | k, v = elems 28 | info[k] = v 29 | 30 | return info 31 | 32 | _buildinfo = _get_build_info() 33 | buildhash=_buildinfo["STABLE_BUILDHASH"] 34 | version=_buildinfo["STABLE_VERSION"] 35 | -------------------------------------------------------------------------------- /qt/aqt/schema_change_tracker.py: -------------------------------------------------------------------------------- 1 | # Copyright: Ankitects Pty Ltd and contributors 2 | # License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html 3 | 4 | from __future__ import annotations 5 | 6 | import enum 7 | 8 | from aqt import AnkiQt 9 | 10 | 11 | class Change(enum.Enum): 12 | NO_CHANGE = 0 13 | BASIC_CHANGE = 1 14 | SCHEMA_CHANGE = 2 15 | 16 | 17 | class ChangeTracker: 18 | _changed = Change.NO_CHANGE 19 | 20 | def __init__(self, mw: AnkiQt): 21 | self.mw = mw 22 | 23 | def mark_basic(self): 24 | if self._changed == Change.NO_CHANGE: 25 | self._changed = Change.BASIC_CHANGE 26 | 27 | def mark_schema(self) -> bool: 28 | "If false, processing should be aborted." 29 | if self._changed != Change.SCHEMA_CHANGE: 30 | if not self.mw.confirm_schema_modification(): 31 | return False 32 | self._changed = Change.SCHEMA_CHANGE 33 | return True 34 | 35 | def changed(self) -> bool: 36 | return self._changed != Change.NO_CHANGE 37 | -------------------------------------------------------------------------------- /qt/aqt/data/web/imgs/refresh.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /qt/aqt/forms/icons/heart.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /pylib/anki/importing/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright: Ankitects Pty Ltd and contributors 2 | # License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html 3 | 4 | from anki.importing.anki2 import Anki2Importer 5 | from anki.importing.apkg import AnkiPackageImporter 6 | from anki.importing.csvfile import TextImporter 7 | from anki.importing.mnemo import MnemosyneImporter 8 | from anki.importing.pauker import PaukerImporter 9 | from anki.importing.supermemo_xml import SupermemoXmlImporter # type: ignore 10 | from anki.lang import tr_legacyglobal 11 | from anki.rsbackend import TR 12 | 13 | Importers = ( 14 | (tr_legacyglobal(TR.IMPORTING_TEXT_SEPARATED_BY_TABS_OR_SEMICOLONS), TextImporter), 15 | ( 16 | tr_legacyglobal(TR.IMPORTING_PACKAGED_ANKI_DECKCOLLECTION_APKG_COLPKG_ZIP), 17 | AnkiPackageImporter, 18 | ), 19 | (tr_legacyglobal(TR.IMPORTING_MNEMOSYNE_20_DECK_DB), MnemosyneImporter), 20 | (tr_legacyglobal(TR.IMPORTING_SUPERMEMO_XML_EXPORT_XML), SupermemoXmlImporter), 21 | (tr_legacyglobal(TR.IMPORTING_PAUKER_18_LESSON_PAUGZ), PaukerImporter), 22 | ) 23 | -------------------------------------------------------------------------------- /qt/aqt/data/web/js/BUILD.bazel: -------------------------------------------------------------------------------- 1 | load("@npm//@bazel/typescript:index.bzl", "ts_library") 2 | load("//ts:prettier.bzl", "prettier_test") 3 | 4 | ts_library( 5 | name = "pycmd", 6 | srcs = ["pycmd.d.ts"], 7 | ) 8 | 9 | ts_library( 10 | name = "aqt", 11 | srcs = glob( 12 | ["*.ts"], 13 | exclude = ["*.d.ts"], 14 | ), 15 | tsconfig = "tsconfig.json", 16 | deps = [ 17 | "pycmd", 18 | "@npm//@types/jquery", 19 | "@npm//@types/jqueryui", 20 | ], 21 | ) 22 | 23 | filegroup( 24 | name = "aqt_es5", 25 | srcs = ["aqt"], 26 | output_group = "es5_sources", 27 | ) 28 | 29 | filegroup( 30 | name = "js", 31 | srcs = [ 32 | "aqt_es5", 33 | "mathjax.js", 34 | "//qt/aqt/data/web/js/vendor", 35 | ], 36 | visibility = ["//qt:__subpackages__"], 37 | ) 38 | 39 | prettier_test( 40 | name = "format_check", 41 | srcs = glob(["*.ts", "*.js"]), 42 | ) 43 | 44 | # source files need fixing first 45 | # eslint_test( 46 | # name = "eslint", 47 | # srcs = glob(["*.ts"]), 48 | # ) 49 | 50 | exports_files(["mathjax.js"]) 51 | -------------------------------------------------------------------------------- /qt/tests/run_mypy.py: -------------------------------------------------------------------------------- 1 | import os 2 | import subprocess 3 | import sys 4 | 5 | if __name__ == "__main__": 6 | (module, ini, pyqt_init) = sys.argv[1:] 7 | ini = os.path.abspath(ini) 8 | pyqt_init = os.path.abspath(pyqt_init) 9 | pyqt_folder = os.path.dirname(pyqt_init) 10 | 11 | folder = os.path.join(os.path.dirname(__file__), "..") 12 | os.chdir(folder) 13 | 14 | if sys.platform.startswith("win32"): 15 | mypy_path = ".;..\\pylib;" + pyqt_folder 16 | else: 17 | mypy_path = ".:../pylib:" + pyqt_folder 18 | 19 | os.environ["MYPYPATH"] = mypy_path 20 | 21 | args = [sys.executable, "-m", "mypy", module, "--config-file", ini] 22 | 23 | if sys.platform.startswith("win32"): 24 | # bazel passes in \\?\c:\... path; mypy can't handle it, so we 25 | # strip off prefix 26 | for entry in sys.path: 27 | if "__mypy_" in entry: 28 | typeshed = entry[4:] + "\\mypy\\typeshed" 29 | args.append("--custom-typeshed-dir") 30 | args.append(typeshed) 31 | 32 | sys.exit(subprocess.run(args, check=False).returncode) 33 | -------------------------------------------------------------------------------- /qt/aqt/forms/icons/tag.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "anki_workspace" 3 | version = "0.0.0" 4 | authors = ["Ankitects Pty Ltd and contributors"] 5 | license = "AGPL-3.0-or-later" 6 | 7 | [workspace] 8 | members = ["rslib", "pylib/rsbridge"] 9 | 10 | [lib] 11 | name = "dummy" 12 | path = "src/lib.rs" 13 | 14 | [package.metadata.raze] 15 | workspace_path = "//cargo" 16 | package_aliases_dir = "cargo" 17 | rust_rules_workspace_name = "io_bazel_rules_rust" 18 | 19 | # pull requests that add other targets (eg Arm Linux, FreeBSD) welcome - you'll 20 | # need to update platforms/, BUILD.request.bazel and pylib/anki/BUILD.bazel as 21 | # well. 22 | targets = [ 23 | "x86_64-apple-darwin", 24 | "x86_64-apple-ios", 25 | "x86_64-pc-windows-msvc", 26 | "x86_64-unknown-linux-gnu", 27 | "aarch64-apple-ios", 28 | ] 29 | genmode = "Remote" 30 | default_gen_buildrs = true 31 | 32 | [package.metadata.raze.crates.pyo3.'*'] 33 | compile_data_attr = "glob([\"**/*.md\"])" 34 | 35 | [package.metadata.raze.crates.ring.'*'] 36 | compile_data_attr = "glob([\"src/**/*.der\"])" 37 | 38 | [package.metadata.raze.crates.webpki.'*'] 39 | compile_data_attr = "glob([\"src/**/*.der\"])" 40 | -------------------------------------------------------------------------------- /rslib/src/version.rs: -------------------------------------------------------------------------------- 1 | // Copyright: Ankitects Pty Ltd and contributors 2 | // License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html 3 | 4 | use lazy_static::lazy_static; 5 | use std::env; 6 | 7 | fn buildinfo(key: &str) -> &'static str { 8 | let buildinfo = include_str!(env!("BUILDINFO")); 9 | for line in buildinfo.split('\n') { 10 | let mut it = line.split(' '); 11 | if it.next().unwrap() == key { 12 | return it.next().unwrap(); 13 | } 14 | } 15 | unreachable!("{} not found", key); 16 | } 17 | 18 | pub fn version() -> &'static str { 19 | buildinfo("STABLE_VERSION") 20 | } 21 | 22 | pub fn buildhash() -> &'static str { 23 | buildinfo("STABLE_BUILDHASH") 24 | } 25 | 26 | pub(crate) fn sync_client_version() -> &'static str { 27 | lazy_static! { 28 | static ref VER: String = format!( 29 | "anki,{version} ({buildhash}),{platform}", 30 | version = version(), 31 | buildhash = buildhash(), 32 | platform = env::var("PLATFORM").unwrap_or_else(|_| env::consts::OS.to_string()) 33 | ); 34 | } 35 | &VER 36 | } 37 | -------------------------------------------------------------------------------- /rslib/src/stats/card_stats.html: -------------------------------------------------------------------------------- 1 | 2 | {% for row in stats %} 3 | 4 | 7 | 8 | 9 | {% endfor %} 10 |
5 | {{ row.0 }} 6 | {{ row.1 }}
11 | 12 | {% if !revlog.is_empty() %} 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | {% for entry in revlog %} 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | {% endfor %} 33 |
{{ revlog_titles.time }}{{ revlog_titles.kind }}{{ revlog_titles.rating }}{{ revlog_titles.interval }}{{ revlog_titles.ease }}{{ revlog_titles.taken_secs }}
{{ entry.time|safe }}{{ entry.kind }}{{ entry.rating }}{{ entry.interval }}{{ entry.ease }}{{ entry.taken_secs }}
34 | {% endif %} 35 | -------------------------------------------------------------------------------- /ts/graphs/tooltip.ts: -------------------------------------------------------------------------------- 1 | // Copyright: Ankitects Pty Ltd and contributors 2 | // License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html 3 | 4 | import throttle from "lodash.throttle"; 5 | 6 | let tooltipDiv: HTMLDivElement | null = null; 7 | 8 | function showTooltipInner(msg: string, x: number, y: number): void { 9 | if (!tooltipDiv) { 10 | tooltipDiv = document.createElement("div"); 11 | tooltipDiv.className = "graph-tooltip"; 12 | document.body.appendChild(tooltipDiv); 13 | } 14 | tooltipDiv.innerHTML = msg; 15 | 16 | // move tooltip away from edge as user approaches right side 17 | const shiftLeftAmount = Math.round( 18 | tooltipDiv.clientWidth * 1.2 * (x / document.body.clientWidth) 19 | ); 20 | 21 | tooltipDiv.style.left = `${x + 40 - shiftLeftAmount}px`; 22 | tooltipDiv.style.top = `${y + 40}px`; 23 | tooltipDiv.style.opacity = "1"; 24 | } 25 | 26 | export const showTooltip = throttle(showTooltipInner, 16); 27 | 28 | export function hideTooltip(): void { 29 | showTooltip.cancel(); 30 | if (tooltipDiv) { 31 | tooltipDiv.style.opacity = "0"; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /qt/aqt/forms/__init__.py: -------------------------------------------------------------------------------- 1 | from . import about 2 | from . import addcards 3 | from . import addfield 4 | from . import addmodel 5 | from . import addonconf 6 | from . import addons 7 | from . import browser 8 | from . import browserdisp 9 | from . import browseropts 10 | from . import changemap 11 | from . import changemodel 12 | from . import clayout_top 13 | from . import customstudy 14 | from . import dconf 15 | from . import debug 16 | from . import dyndconf 17 | from . import editaddon 18 | from . import editcurrent 19 | from . import edithtml 20 | from . import emptycards 21 | from . import exporting 22 | from . import fields 23 | from . import finddupes 24 | from . import findreplace 25 | from . import getaddons 26 | from . import importing 27 | from . import main 28 | from . import modelopts 29 | from . import models 30 | from . import preferences 31 | from . import preview 32 | from . import profiles 33 | from . import progress 34 | from . import reposition 35 | from . import reschedule 36 | from . import setgroup 37 | from . import setlang 38 | from . import stats 39 | from . import studydeck 40 | from . import synclog 41 | from . import taglimit 42 | from . import template -------------------------------------------------------------------------------- /BUILD.bazel: -------------------------------------------------------------------------------- 1 | load("@bazel_tools//tools/build_defs/pkg:pkg.bzl", "pkg_tar") 2 | 3 | config_setting( 4 | name = "release", 5 | values = { 6 | "compilation_mode": "opt", 7 | }, 8 | ) 9 | 10 | genrule( 11 | name = "buildinfo", 12 | srcs = ["//:defs.bzl"], 13 | outs = ["buildinfo.txt"], 14 | cmd = select({ 15 | "release": "$(location //scripts:buildinfo) $(location //:defs.bzl) bazel-out/stable-status.txt release > $@", 16 | "//conditions:default": "$(location //scripts:buildinfo) $(location //:defs.bzl) bazel-out/stable-status.txt devel > $@", 17 | }), 18 | stamp = 1, 19 | tools = [ 20 | "//scripts:buildinfo", 21 | ], 22 | visibility = ["//visibility:public"], 23 | ) 24 | 25 | alias( 26 | name = "tsconfig.json", 27 | actual = "//ts:tsconfig.json", 28 | visibility = ["//visibility:public"], 29 | ) 30 | 31 | pkg_tar( 32 | name = "dist", 33 | srcs = [ 34 | "//pylib/anki:wheel", 35 | "//qt/aqt:wheel", 36 | ], 37 | mode = "0644", 38 | package_dir = "bazel-dist", 39 | tags = ["manual"], 40 | ) 41 | 42 | # for version info 43 | exports_files(["defs.bzl"]) 44 | -------------------------------------------------------------------------------- /qt/aqt/data/web/js/vendor/browsersel.js: -------------------------------------------------------------------------------- 1 | /* CSS Browser Selector v0.4.0 (Nov 02, 2010) Rafael Lima (http://rafael.adm.br). CC BY 2.5. */function css_browser_selector(u){var ua=u.toLowerCase(),is=function(t){return ua.indexOf(t)>-1},g='gecko',w='webkit',s='safari',o='opera',m='mobile',h=document.documentElement,b=[(!(/opera|webtv/i.test(ua))&&/msie\s(\d)/.test(ua))?('ie ie'+RegExp.$1):is('firefox/2')?g+' ff2':is('firefox/3.5')?g+' ff3 ff3_5':is('firefox/3.6')?g+' ff3 ff3_6':is('firefox/3')?g+' ff3':is('gecko/')?g:is('opera')?o+(/version\/(\d+)/.test(ua)?' '+o+RegExp.$1:(/opera(\s|\/)(\d+)/.test(ua)?' '+o+RegExp.$2:'')):is('konqueror')?'konqueror':is('blackberry')?m+' blackberry':is('android')?m+' android':is('chrome')?w+' chrome':is('iron')?w+' iron':is('applewebkit/')?w+' '+s+(/version\/(\d+)/.test(ua)?' '+s+RegExp.$1:''):is('mozilla/')?g:'',is('j2me')?m+' j2me':is('iphone')?m+' iphone':is('ipod')?m+' ipod':is('ipad')?m+' ipad':is('mac')?'mac':is('darwin')?'mac':is('webtv')?'webtv':is('win')?'win'+(is('windows nt 6.0')?' vista':''):is('freebsd')?'freebsd':(is('x11')||is('linux'))?'linux':'','js']; c = b.join(' '); h.className += ' '+c; return c;}; css_browser_selector(navigator.userAgent); 2 | -------------------------------------------------------------------------------- /.bazelrc: -------------------------------------------------------------------------------- 1 | common --enable_platform_specific_config 2 | common --experimental_repository_cache_hardlinks 3 | 4 | # specify python path for pyo3 compile 5 | build:windows --action_env="PYTHON_SYS_EXECUTABLE=c:\\python\\python.exe" 6 | #build:linux --action_env="PYTHON_SYS_EXECUTABLE=/usr/local/bin/python3.8" 7 | 8 | # runfiles are off by default on Windows, and we need them 9 | build --enable_runfiles 10 | 11 | # skip the slow zip step on Windows, as we have symlinks 12 | build:windows --build_python_zip=false 13 | 14 | # record version/build hash 15 | build --workspace_status_command='bash ./scripts/status.sh' 16 | 17 | # run clippy when compiling rust in test mode 18 | test --aspects=@io_bazel_rules_rust//rust:rust.bzl%rust_clippy_aspect --output_groups=+clippy_checks 19 | 20 | # print output when test fails 21 | test --test_output=errors 22 | 23 | # don't add empty __init__.py files 24 | build --incompatible_default_to_explicit_init_py 25 | 26 | # faster for .ui file generation, but may sacrifice correctness 27 | #--genrule_strategy=standalone 28 | 29 | build:ci --show_timestamps --isatty=0 --color=yes --show_progress_rate_limit=5 30 | 31 | try-import %workspace%/user.bazelrc 32 | -------------------------------------------------------------------------------- /ftl/extract-strings.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: UTF-8 -*- 3 | 4 | """ 5 | Tool to extract core strings and keys from .ftl files. 6 | """ 7 | 8 | import os 9 | import json 10 | import glob 11 | from fluent.syntax import parse 12 | from fluent.syntax.serializer import serialize_element 13 | from fluent.syntax.ast import Junk 14 | 15 | root = os.environ["BUILD_WORKSPACE_DIRECTORY"] 16 | ftl_files = glob.glob(os.path.join(root, "ftl", "core", "*.ftl"), recursive=True) 17 | keys_by_value = {} 18 | 19 | for path in ftl_files: 20 | obj = parse(open(path).read(), with_spans=False) 21 | for ent in obj.body: 22 | if isinstance(ent, Junk): 23 | raise Exception(f"file had junk! {path} {ent}") 24 | if getattr(ent, "id", None): 25 | key = ent.id.name 26 | val = "".join(serialize_element(elem) for elem in ent.value.elements) 27 | if val in keys_by_value: 28 | print("duplicate found:", keys_by_value[val], key) 29 | keys_by_value.setdefault(val, []).append(key) 30 | 31 | json.dump(keys_by_value, open(os.path.join(root, "keys_by_value.json"), "w")) 32 | print("keys:", len(keys_by_value)) 33 | -------------------------------------------------------------------------------- /ts/graphs/EaseGraph.svelte: -------------------------------------------------------------------------------- 1 | 23 | 24 |

25 |

{title}

26 | 27 |
{subtitle}
28 | 29 | 30 | 31 | 32 |
33 | -------------------------------------------------------------------------------- /qt/aqt/pinnedmodules.py: -------------------------------------------------------------------------------- 1 | # Copyright: Ankitects Pty Ltd and contributors 2 | # License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html 3 | 4 | # pylint: disable=import-error,unused-import 5 | 6 | """ 7 | # this file is imported as part of the bundling process to ensure certain 8 | # modules are included in the distribution 9 | 10 | isort:skip_file 11 | """ 12 | 13 | # included implicitly in the past, and relied upon by some add-ons 14 | import cgi 15 | import decimal 16 | import gettext 17 | 18 | # useful for add-ons 19 | import logging 20 | import logging.config 21 | import logging.handlers 22 | 23 | # required by requests library 24 | import queue 25 | import typing 26 | import uuid 27 | 28 | # other modules we require that may not be automatically included 29 | import PyQt5.QtSvg 30 | import PyQt5.QtMultimedia 31 | import socks 32 | import pyaudio 33 | 34 | # legacy compat 35 | import anki.storage 36 | import anki.sync 37 | 38 | # platform-specifics 39 | from anki.utils import isLin, isMac, isWin 40 | 41 | if isWin: 42 | # external module access 43 | import pythoncom 44 | import pywintypes 45 | import win32com 46 | 47 | if isLin: 48 | # file locking 49 | import fcntl 50 | -------------------------------------------------------------------------------- /ftl/qt/qt-accel.ftl: -------------------------------------------------------------------------------- 1 | qt-accel-about = &About... 2 | qt-accel-browse-and-install = &Browse and Install... 3 | qt-accel-cards = &Cards 4 | qt-accel-check-database = &Check Database 5 | qt-accel-check-media = Check &Media... 6 | qt-accel-edit = &Edit 7 | qt-accel-exit = E&xit 8 | qt-accel-export = &Export... 9 | qt-accel-export-notes = &Export Notes... 10 | qt-accel-file = &File 11 | qt-accel-filter = Fil&ter 12 | qt-accel-find = &Find 13 | qt-accel-find-and-replace = Find and Re&place... 14 | qt-accel-find-duplicates = Find &Duplicates... 15 | qt-accel-go = &Go 16 | qt-accel-guide = &Guide... 17 | qt-accel-help = &Help 18 | qt-accel-import = &Import... 19 | qt-accel-info = &Info... 20 | qt-accel-invert-selection = &Invert Selection 21 | qt-accel-next-card = &Next Card 22 | qt-accel-note = N&ote 23 | qt-accel-notes = &Notes 24 | qt-accel-open-addons-folder = &Open Add-ons Folder... 25 | qt-accel-preferences = &Preferences... 26 | qt-accel-previous-card = &Previous Card 27 | qt-accel-reschedule = &Reschedule... 28 | qt-accel-select-all = Select &All 29 | qt-accel-select-notes = Select &Notes 30 | qt-accel-support-anki = &Support Anki... 31 | qt-accel-switch-profile = &Switch Profile 32 | qt-accel-tools = &Tools 33 | qt-accel-undo = &Undo 34 | -------------------------------------------------------------------------------- /pylib/anki/sound.py: -------------------------------------------------------------------------------- 1 | # Copyright: Ankitects Pty Ltd and contributors 2 | # License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html 3 | 4 | """ 5 | Sound/TTS references extracted from card text. 6 | 7 | These can be accessed via eg card.question_av_tags() 8 | """ 9 | 10 | from __future__ import annotations 11 | 12 | import re 13 | from dataclasses import dataclass 14 | from typing import List, Union 15 | 16 | 17 | @dataclass 18 | class TTSTag: 19 | """Records information about a text to speech tag. 20 | 21 | See tts.py for more information. 22 | """ 23 | 24 | field_text: str 25 | lang: str 26 | voices: List[str] 27 | speed: float 28 | # each arg should be in the form 'foo=bar' 29 | other_args: List[str] 30 | 31 | 32 | @dataclass 33 | class SoundOrVideoTag: 34 | """Contains the filename inside a [sound:...] tag. 35 | 36 | Video files also use [sound:...]. 37 | """ 38 | 39 | filename: str 40 | 41 | 42 | # note this does not include image tags, which are handled with HTML. 43 | AVTag = Union[SoundOrVideoTag, TTSTag] 44 | 45 | AV_REF_RE = re.compile(r"\[anki:(play:(.):(\d+))\]") 46 | 47 | 48 | def strip_av_refs(text: str) -> str: 49 | return AV_REF_RE.sub("", text) 50 | -------------------------------------------------------------------------------- /cargo/remote/BUILD.tap-1.0.0.bazel: -------------------------------------------------------------------------------- 1 | """ 2 | @generated 3 | cargo-raze crate build file. 4 | 5 | DO NOT EDIT! Replaced on runs of cargo-raze 6 | """ 7 | 8 | # buildifier: disable=load 9 | load( 10 | "@io_bazel_rules_rust//rust:rust.bzl", 11 | "rust_binary", 12 | "rust_library", 13 | "rust_test", 14 | ) 15 | 16 | # buildifier: disable=load 17 | load("@bazel_skylib//lib:selects.bzl", "selects") 18 | 19 | package(default_visibility = [ 20 | # Public for visibility by "@raze__crate__version//" targets. 21 | # 22 | # Prefer access through "//cargo", which limits external 23 | # visibility to explicit Cargo.toml dependencies. 24 | "//visibility:public", 25 | ]) 26 | 27 | licenses([ 28 | "notice", # MIT from expression "MIT" 29 | ]) 30 | 31 | # Generated Targets 32 | 33 | rust_library( 34 | name = "tap", 35 | srcs = glob(["**/*.rs"]), 36 | crate_features = [ 37 | ], 38 | crate_root = "src/lib.rs", 39 | crate_type = "lib", 40 | data = [], 41 | edition = "2015", 42 | rustc_flags = [ 43 | "--cap-lints=allow", 44 | ], 45 | tags = [ 46 | "cargo-raze", 47 | "manual", 48 | ], 49 | version = "1.0.0", 50 | # buildifier: leave-alone 51 | deps = [ 52 | ], 53 | ) 54 | -------------------------------------------------------------------------------- /qt/bazelfixes.py: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | 4 | def fix_pywin32_in_bazel(force=False): 5 | if sys.platform != "win32": 6 | return 7 | if not force and "BAZEL_SH" not in os.environ: 8 | return 9 | 10 | # get path to pywin32 package 11 | path = None 12 | for path in sys.path: 13 | if "pywin32" in path: 14 | break 15 | 16 | # trigger pywin32 bootstrap 17 | import site 18 | site.addsitedir(path) 19 | 20 | # sys.path has been extended; use final 21 | # path to locate dll folder and add it to path 22 | path = sys.path[-1] 23 | path = path.replace("Pythonwin", "pywin32_system32") 24 | os.environ["PATH"] += ";" + path 25 | 26 | # import pythoncom module 27 | import importlib 28 | import importlib.machinery 29 | 30 | name = "pythoncom" 31 | filename = os.path.join(path, "pythoncom38.dll") 32 | loader = importlib.machinery.ExtensionFileLoader(name, filename) 33 | spec = importlib.machinery.ModuleSpec(name=name, loader=loader, origin=filename) 34 | _mod = importlib._bootstrap._load(spec) 35 | 36 | 37 | def fix_extraneous_path_in_bazel(): 38 | # source folder conflicts with bazel-out source 39 | if sys.path[0].endswith("qt"): 40 | del sys.path[0] 41 | -------------------------------------------------------------------------------- /cargo/remote/BUILD.funty-1.1.0.bazel: -------------------------------------------------------------------------------- 1 | """ 2 | @generated 3 | cargo-raze crate build file. 4 | 5 | DO NOT EDIT! Replaced on runs of cargo-raze 6 | """ 7 | 8 | # buildifier: disable=load 9 | load( 10 | "@io_bazel_rules_rust//rust:rust.bzl", 11 | "rust_binary", 12 | "rust_library", 13 | "rust_test", 14 | ) 15 | 16 | # buildifier: disable=load 17 | load("@bazel_skylib//lib:selects.bzl", "selects") 18 | 19 | package(default_visibility = [ 20 | # Public for visibility by "@raze__crate__version//" targets. 21 | # 22 | # Prefer access through "//cargo", which limits external 23 | # visibility to explicit Cargo.toml dependencies. 24 | "//visibility:public", 25 | ]) 26 | 27 | licenses([ 28 | "notice", # MIT from expression "MIT" 29 | ]) 30 | 31 | # Generated Targets 32 | 33 | rust_library( 34 | name = "funty", 35 | srcs = glob(["**/*.rs"]), 36 | crate_features = [ 37 | ], 38 | crate_root = "src/lib.rs", 39 | crate_type = "lib", 40 | data = [], 41 | edition = "2018", 42 | rustc_flags = [ 43 | "--cap-lints=allow", 44 | ], 45 | tags = [ 46 | "cargo-raze", 47 | "manual", 48 | ], 49 | version = "1.1.0", 50 | # buildifier: leave-alone 51 | deps = [ 52 | ], 53 | ) 54 | -------------------------------------------------------------------------------- /cargo/remote/BUILD.winapi-0.2.8.bazel: -------------------------------------------------------------------------------- 1 | """ 2 | @generated 3 | cargo-raze crate build file. 4 | 5 | DO NOT EDIT! Replaced on runs of cargo-raze 6 | """ 7 | 8 | # buildifier: disable=load 9 | load( 10 | "@io_bazel_rules_rust//rust:rust.bzl", 11 | "rust_binary", 12 | "rust_library", 13 | "rust_test", 14 | ) 15 | 16 | # buildifier: disable=load 17 | load("@bazel_skylib//lib:selects.bzl", "selects") 18 | 19 | package(default_visibility = [ 20 | # Public for visibility by "@raze__crate__version//" targets. 21 | # 22 | # Prefer access through "//cargo", which limits external 23 | # visibility to explicit Cargo.toml dependencies. 24 | "//visibility:public", 25 | ]) 26 | 27 | licenses([ 28 | "notice", # MIT from expression "MIT" 29 | ]) 30 | 31 | # Generated Targets 32 | 33 | rust_library( 34 | name = "winapi", 35 | srcs = glob(["**/*.rs"]), 36 | crate_features = [ 37 | ], 38 | crate_root = "src/lib.rs", 39 | crate_type = "lib", 40 | data = [], 41 | edition = "2015", 42 | rustc_flags = [ 43 | "--cap-lints=allow", 44 | ], 45 | tags = [ 46 | "cargo-raze", 47 | "manual", 48 | ], 49 | version = "0.2.8", 50 | # buildifier: leave-alone 51 | deps = [ 52 | ], 53 | ) 54 | -------------------------------------------------------------------------------- /cargo/remote/BUILD.take_mut-0.2.2.bazel: -------------------------------------------------------------------------------- 1 | """ 2 | @generated 3 | cargo-raze crate build file. 4 | 5 | DO NOT EDIT! Replaced on runs of cargo-raze 6 | """ 7 | 8 | # buildifier: disable=load 9 | load( 10 | "@io_bazel_rules_rust//rust:rust.bzl", 11 | "rust_binary", 12 | "rust_library", 13 | "rust_test", 14 | ) 15 | 16 | # buildifier: disable=load 17 | load("@bazel_skylib//lib:selects.bzl", "selects") 18 | 19 | package(default_visibility = [ 20 | # Public for visibility by "@raze__crate__version//" targets. 21 | # 22 | # Prefer access through "//cargo", which limits external 23 | # visibility to explicit Cargo.toml dependencies. 24 | "//visibility:public", 25 | ]) 26 | 27 | licenses([ 28 | "notice", # MIT from expression "MIT" 29 | ]) 30 | 31 | # Generated Targets 32 | 33 | rust_library( 34 | name = "take_mut", 35 | srcs = glob(["**/*.rs"]), 36 | crate_features = [ 37 | ], 38 | crate_root = "src/lib.rs", 39 | crate_type = "lib", 40 | data = [], 41 | edition = "2015", 42 | rustc_flags = [ 43 | "--cap-lints=allow", 44 | ], 45 | tags = [ 46 | "cargo-raze", 47 | "manual", 48 | ], 49 | version = "0.2.2", 50 | # buildifier: leave-alone 51 | deps = [ 52 | ], 53 | ) 54 | -------------------------------------------------------------------------------- /cargo/remote/BUILD.try-lock-0.2.3.bazel: -------------------------------------------------------------------------------- 1 | """ 2 | @generated 3 | cargo-raze crate build file. 4 | 5 | DO NOT EDIT! Replaced on runs of cargo-raze 6 | """ 7 | 8 | # buildifier: disable=load 9 | load( 10 | "@io_bazel_rules_rust//rust:rust.bzl", 11 | "rust_binary", 12 | "rust_library", 13 | "rust_test", 14 | ) 15 | 16 | # buildifier: disable=load 17 | load("@bazel_skylib//lib:selects.bzl", "selects") 18 | 19 | package(default_visibility = [ 20 | # Public for visibility by "@raze__crate__version//" targets. 21 | # 22 | # Prefer access through "//cargo", which limits external 23 | # visibility to explicit Cargo.toml dependencies. 24 | "//visibility:public", 25 | ]) 26 | 27 | licenses([ 28 | "notice", # MIT from expression "MIT" 29 | ]) 30 | 31 | # Generated Targets 32 | 33 | rust_library( 34 | name = "try_lock", 35 | srcs = glob(["**/*.rs"]), 36 | crate_features = [ 37 | ], 38 | crate_root = "src/lib.rs", 39 | crate_type = "lib", 40 | data = [], 41 | edition = "2015", 42 | rustc_flags = [ 43 | "--cap-lints=allow", 44 | ], 45 | tags = [ 46 | "cargo-raze", 47 | "manual", 48 | ], 49 | version = "0.2.3", 50 | # buildifier: leave-alone 51 | deps = [ 52 | ], 53 | ) 54 | -------------------------------------------------------------------------------- /pylib/tests/test_flags.py: -------------------------------------------------------------------------------- 1 | from tests.shared import getEmptyCol 2 | 3 | 4 | def test_flags(): 5 | col = getEmptyCol() 6 | n = col.newNote() 7 | n["Front"] = "one" 8 | n["Back"] = "two" 9 | cnt = col.addNote(n) 10 | c = n.cards()[0] 11 | # make sure higher bits are preserved 12 | origBits = 0b101 << 3 13 | c.flags = origBits 14 | c.flush() 15 | # no flags to start with 16 | assert c.userFlag() == 0 17 | assert len(col.findCards("flag:0")) == 1 18 | assert len(col.findCards("flag:1")) == 0 19 | # set flag 2 20 | col.setUserFlag(2, [c.id]) 21 | c.load() 22 | assert c.userFlag() == 2 23 | assert c.flags & origBits == origBits 24 | assert len(col.findCards("flag:0")) == 0 25 | assert len(col.findCards("flag:2")) == 1 26 | assert len(col.findCards("flag:3")) == 0 27 | # change to 3 28 | col.setUserFlag(3, [c.id]) 29 | c.load() 30 | assert c.userFlag() == 3 31 | # unset 32 | col.setUserFlag(0, [c.id]) 33 | c.load() 34 | assert c.userFlag() == 0 35 | 36 | # should work with Cards method as well 37 | c.setUserFlag(2) 38 | assert c.userFlag() == 2 39 | c.setUserFlag(3) 40 | assert c.userFlag() == 3 41 | c.setUserFlag(0) 42 | assert c.userFlag() == 0 43 | -------------------------------------------------------------------------------- /qt/tools/build_ui.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # generate python files based on the designer ui files. pyuic5 and pyrcc5 4 | # should be on the path. 5 | # 6 | 7 | set -eu -o pipefail ${SHELLFLAGS} 8 | 9 | if [ ! -d "designer" ] 10 | then 11 | echo "Please run this from the project root" 12 | exit 13 | fi 14 | 15 | mkdir -p aqt/forms 16 | 17 | init=aqt/forms/__init__.py 18 | temp=aqt/forms/scratch 19 | rm -f $init $temp 20 | echo "# This file auto-generated by build_ui.sh. Don't edit." > $init 21 | echo "__all__ = [" >> $init 22 | 23 | echo "Generating forms.." 24 | for i in designer/*.ui 25 | do 26 | base=$(basename $i .ui) 27 | py="aqt/forms/${base}.py" 28 | echo " \"$base\"," >> $init 29 | echo "from . import $base" >> $temp 30 | if [ $i -nt $py ]; then 31 | echo " * "$py 32 | pyuic5 --from-imports $i -o $py.tmp 33 | (cat < $py 34 | # -*- coding: utf-8 -*- 35 | # pylint: disable=unsubscriptable-object,unused-import 36 | EOF 37 | rm $py.tmp 38 | fi 39 | done 40 | echo "]" >> $init 41 | cat $temp >> $init 42 | rm $temp 43 | 44 | echo "Building resources.." 45 | pyrcc5 designer/icons.qrc -o aqt/forms/icons_rc.py 46 | -------------------------------------------------------------------------------- /cargo/remote/BUILD.ipnet-2.3.0.bazel: -------------------------------------------------------------------------------- 1 | """ 2 | @generated 3 | cargo-raze crate build file. 4 | 5 | DO NOT EDIT! Replaced on runs of cargo-raze 6 | """ 7 | 8 | # buildifier: disable=load 9 | load( 10 | "@io_bazel_rules_rust//rust:rust.bzl", 11 | "rust_binary", 12 | "rust_library", 13 | "rust_test", 14 | ) 15 | 16 | # buildifier: disable=load 17 | load("@bazel_skylib//lib:selects.bzl", "selects") 18 | 19 | package(default_visibility = [ 20 | # Public for visibility by "@raze__crate__version//" targets. 21 | # 22 | # Prefer access through "//cargo", which limits external 23 | # visibility to explicit Cargo.toml dependencies. 24 | "//visibility:public", 25 | ]) 26 | 27 | licenses([ 28 | "notice", # MIT from expression "MIT OR Apache-2.0" 29 | ]) 30 | 31 | # Generated Targets 32 | 33 | rust_library( 34 | name = "ipnet", 35 | srcs = glob(["**/*.rs"]), 36 | crate_features = [ 37 | ], 38 | crate_root = "src/lib.rs", 39 | crate_type = "lib", 40 | data = [], 41 | edition = "2015", 42 | rustc_flags = [ 43 | "--cap-lints=allow", 44 | ], 45 | tags = [ 46 | "cargo-raze", 47 | "manual", 48 | ], 49 | version = "2.3.0", 50 | # buildifier: leave-alone 51 | deps = [ 52 | ], 53 | ) 54 | -------------------------------------------------------------------------------- /cargo/remote/BUILD.nodrop-0.1.14.bazel: -------------------------------------------------------------------------------- 1 | """ 2 | @generated 3 | cargo-raze crate build file. 4 | 5 | DO NOT EDIT! Replaced on runs of cargo-raze 6 | """ 7 | 8 | # buildifier: disable=load 9 | load( 10 | "@io_bazel_rules_rust//rust:rust.bzl", 11 | "rust_binary", 12 | "rust_library", 13 | "rust_test", 14 | ) 15 | 16 | # buildifier: disable=load 17 | load("@bazel_skylib//lib:selects.bzl", "selects") 18 | 19 | package(default_visibility = [ 20 | # Public for visibility by "@raze__crate__version//" targets. 21 | # 22 | # Prefer access through "//cargo", which limits external 23 | # visibility to explicit Cargo.toml dependencies. 24 | "//visibility:public", 25 | ]) 26 | 27 | licenses([ 28 | "notice", # MIT from expression "MIT OR Apache-2.0" 29 | ]) 30 | 31 | # Generated Targets 32 | 33 | rust_library( 34 | name = "nodrop", 35 | srcs = glob(["**/*.rs"]), 36 | crate_features = [ 37 | ], 38 | crate_root = "src/lib.rs", 39 | crate_type = "lib", 40 | data = [], 41 | edition = "2015", 42 | rustc_flags = [ 43 | "--cap-lints=allow", 44 | ], 45 | tags = [ 46 | "cargo-raze", 47 | "manual", 48 | ], 49 | version = "0.1.14", 50 | # buildifier: leave-alone 51 | deps = [ 52 | ], 53 | ) 54 | -------------------------------------------------------------------------------- /cargo/remote/BUILD.sha1-0.6.0.bazel: -------------------------------------------------------------------------------- 1 | """ 2 | @generated 3 | cargo-raze crate build file. 4 | 5 | DO NOT EDIT! Replaced on runs of cargo-raze 6 | """ 7 | 8 | # buildifier: disable=load 9 | load( 10 | "@io_bazel_rules_rust//rust:rust.bzl", 11 | "rust_binary", 12 | "rust_library", 13 | "rust_test", 14 | ) 15 | 16 | # buildifier: disable=load 17 | load("@bazel_skylib//lib:selects.bzl", "selects") 18 | 19 | package(default_visibility = [ 20 | # Public for visibility by "@raze__crate__version//" targets. 21 | # 22 | # Prefer access through "//cargo", which limits external 23 | # visibility to explicit Cargo.toml dependencies. 24 | "//visibility:public", 25 | ]) 26 | 27 | licenses([ 28 | "notice", # BSD-3-Clause from expression "BSD-3-Clause" 29 | ]) 30 | 31 | # Generated Targets 32 | 33 | rust_library( 34 | name = "sha1", 35 | srcs = glob(["**/*.rs"]), 36 | crate_features = [ 37 | ], 38 | crate_root = "src/lib.rs", 39 | crate_type = "lib", 40 | data = [], 41 | edition = "2015", 42 | rustc_flags = [ 43 | "--cap-lints=allow", 44 | ], 45 | tags = [ 46 | "cargo-raze", 47 | "manual", 48 | ], 49 | version = "0.6.0", 50 | # buildifier: leave-alone 51 | deps = [ 52 | ], 53 | ) 54 | -------------------------------------------------------------------------------- /cargo/remote/BUILD.tower-service-0.3.0.bazel: -------------------------------------------------------------------------------- 1 | """ 2 | @generated 3 | cargo-raze crate build file. 4 | 5 | DO NOT EDIT! Replaced on runs of cargo-raze 6 | """ 7 | 8 | # buildifier: disable=load 9 | load( 10 | "@io_bazel_rules_rust//rust:rust.bzl", 11 | "rust_binary", 12 | "rust_library", 13 | "rust_test", 14 | ) 15 | 16 | # buildifier: disable=load 17 | load("@bazel_skylib//lib:selects.bzl", "selects") 18 | 19 | package(default_visibility = [ 20 | # Public for visibility by "@raze__crate__version//" targets. 21 | # 22 | # Prefer access through "//cargo", which limits external 23 | # visibility to explicit Cargo.toml dependencies. 24 | "//visibility:public", 25 | ]) 26 | 27 | licenses([ 28 | "notice", # MIT from expression "MIT" 29 | ]) 30 | 31 | # Generated Targets 32 | 33 | rust_library( 34 | name = "tower_service", 35 | srcs = glob(["**/*.rs"]), 36 | crate_features = [ 37 | ], 38 | crate_root = "src/lib.rs", 39 | crate_type = "lib", 40 | data = [], 41 | edition = "2018", 42 | rustc_flags = [ 43 | "--cap-lints=allow", 44 | ], 45 | tags = [ 46 | "cargo-raze", 47 | "manual", 48 | ], 49 | version = "0.3.0", 50 | # buildifier: leave-alone 51 | deps = [ 52 | ], 53 | ) 54 | -------------------------------------------------------------------------------- /cargo/remote/BUILD.vcpkg-0.2.11.bazel: -------------------------------------------------------------------------------- 1 | """ 2 | @generated 3 | cargo-raze crate build file. 4 | 5 | DO NOT EDIT! Replaced on runs of cargo-raze 6 | """ 7 | 8 | # buildifier: disable=load 9 | load( 10 | "@io_bazel_rules_rust//rust:rust.bzl", 11 | "rust_binary", 12 | "rust_library", 13 | "rust_test", 14 | ) 15 | 16 | # buildifier: disable=load 17 | load("@bazel_skylib//lib:selects.bzl", "selects") 18 | 19 | package(default_visibility = [ 20 | # Public for visibility by "@raze__crate__version//" targets. 21 | # 22 | # Prefer access through "//cargo", which limits external 23 | # visibility to explicit Cargo.toml dependencies. 24 | "//visibility:public", 25 | ]) 26 | 27 | licenses([ 28 | "notice", # MIT from expression "MIT OR Apache-2.0" 29 | ]) 30 | 31 | # Generated Targets 32 | 33 | rust_library( 34 | name = "vcpkg", 35 | srcs = glob(["**/*.rs"]), 36 | crate_features = [ 37 | ], 38 | crate_root = "src/lib.rs", 39 | crate_type = "lib", 40 | data = [], 41 | edition = "2015", 42 | rustc_flags = [ 43 | "--cap-lints=allow", 44 | ], 45 | tags = [ 46 | "cargo-raze", 47 | "manual", 48 | ], 49 | version = "0.2.11", 50 | # buildifier: leave-alone 51 | deps = [ 52 | ], 53 | ) 54 | -------------------------------------------------------------------------------- /cargo/remote/BUILD.wyz-0.2.0.bazel: -------------------------------------------------------------------------------- 1 | """ 2 | @generated 3 | cargo-raze crate build file. 4 | 5 | DO NOT EDIT! Replaced on runs of cargo-raze 6 | """ 7 | 8 | # buildifier: disable=load 9 | load( 10 | "@io_bazel_rules_rust//rust:rust.bzl", 11 | "rust_binary", 12 | "rust_library", 13 | "rust_test", 14 | ) 15 | 16 | # buildifier: disable=load 17 | load("@bazel_skylib//lib:selects.bzl", "selects") 18 | 19 | package(default_visibility = [ 20 | # Public for visibility by "@raze__crate__version//" targets. 21 | # 22 | # Prefer access through "//cargo", which limits external 23 | # visibility to explicit Cargo.toml dependencies. 24 | "//visibility:public", 25 | ]) 26 | 27 | licenses([ 28 | "notice", # MIT from expression "MIT" 29 | ]) 30 | 31 | # Generated Targets 32 | 33 | rust_library( 34 | name = "wyz", 35 | srcs = glob(["**/*.rs"]), 36 | crate_features = [ 37 | "alloc", 38 | ], 39 | crate_root = "src/lib.rs", 40 | crate_type = "lib", 41 | data = [], 42 | edition = "2018", 43 | rustc_flags = [ 44 | "--cap-lints=allow", 45 | ], 46 | tags = [ 47 | "cargo-raze", 48 | "manual", 49 | ], 50 | version = "0.2.0", 51 | # buildifier: leave-alone 52 | deps = [ 53 | ], 54 | ) 55 | -------------------------------------------------------------------------------- /pylib/anki/importing/base.py: -------------------------------------------------------------------------------- 1 | # Copyright: Ankitects Pty Ltd and contributors 2 | # License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html 3 | 4 | from typing import Any, List, Optional 5 | 6 | from anki.collection import Collection 7 | from anki.utils import maxID 8 | 9 | # Base importer 10 | ########################################################################## 11 | 12 | 13 | class Importer: 14 | 15 | needMapper = False 16 | needDelimiter = False 17 | dst: Optional[Collection] 18 | 19 | def __init__(self, col: Collection, file: str) -> None: 20 | self.file = file 21 | self.log: List[str] = [] 22 | self.col = col.weakref() 23 | self.total = 0 24 | self.dst = None 25 | 26 | def run(self) -> None: 27 | pass 28 | 29 | # Timestamps 30 | ###################################################################### 31 | # It's too inefficient to check for existing ids on every object, 32 | # and a previous import may have created timestamps in the future, so we 33 | # need to make sure our starting point is safe. 34 | 35 | def _prepareTS(self) -> None: 36 | self._ts = maxID(self.dst.db) 37 | 38 | def ts(self) -> Any: 39 | self._ts += 1 40 | return self._ts 41 | -------------------------------------------------------------------------------- /cargo/remote/BUILD.httpdate-0.3.2.bazel: -------------------------------------------------------------------------------- 1 | """ 2 | @generated 3 | cargo-raze crate build file. 4 | 5 | DO NOT EDIT! Replaced on runs of cargo-raze 6 | """ 7 | 8 | # buildifier: disable=load 9 | load( 10 | "@io_bazel_rules_rust//rust:rust.bzl", 11 | "rust_binary", 12 | "rust_library", 13 | "rust_test", 14 | ) 15 | 16 | # buildifier: disable=load 17 | load("@bazel_skylib//lib:selects.bzl", "selects") 18 | 19 | package(default_visibility = [ 20 | # Public for visibility by "@raze__crate__version//" targets. 21 | # 22 | # Prefer access through "//cargo", which limits external 23 | # visibility to explicit Cargo.toml dependencies. 24 | "//visibility:public", 25 | ]) 26 | 27 | licenses([ 28 | "notice", # MIT from expression "MIT OR Apache-2.0" 29 | ]) 30 | 31 | # Generated Targets 32 | 33 | rust_library( 34 | name = "httpdate", 35 | srcs = glob(["**/*.rs"]), 36 | crate_features = [ 37 | ], 38 | crate_root = "src/lib.rs", 39 | crate_type = "lib", 40 | data = [], 41 | edition = "2015", 42 | rustc_flags = [ 43 | "--cap-lints=allow", 44 | ], 45 | tags = [ 46 | "cargo-raze", 47 | "manual", 48 | ], 49 | version = "0.3.2", 50 | # buildifier: leave-alone 51 | deps = [ 52 | ], 53 | ) 54 | -------------------------------------------------------------------------------- /cargo/remote/BUILD.multimap-0.8.2.bazel: -------------------------------------------------------------------------------- 1 | """ 2 | @generated 3 | cargo-raze crate build file. 4 | 5 | DO NOT EDIT! Replaced on runs of cargo-raze 6 | """ 7 | 8 | # buildifier: disable=load 9 | load( 10 | "@io_bazel_rules_rust//rust:rust.bzl", 11 | "rust_binary", 12 | "rust_library", 13 | "rust_test", 14 | ) 15 | 16 | # buildifier: disable=load 17 | load("@bazel_skylib//lib:selects.bzl", "selects") 18 | 19 | package(default_visibility = [ 20 | # Public for visibility by "@raze__crate__version//" targets. 21 | # 22 | # Prefer access through "//cargo", which limits external 23 | # visibility to explicit Cargo.toml dependencies. 24 | "//visibility:public", 25 | ]) 26 | 27 | licenses([ 28 | "notice", # MIT from expression "MIT OR Apache-2.0" 29 | ]) 30 | 31 | # Generated Targets 32 | 33 | rust_library( 34 | name = "multimap", 35 | srcs = glob(["**/*.rs"]), 36 | crate_features = [ 37 | ], 38 | crate_root = "src/lib.rs", 39 | crate_type = "lib", 40 | data = [], 41 | edition = "2015", 42 | rustc_flags = [ 43 | "--cap-lints=allow", 44 | ], 45 | tags = [ 46 | "cargo-raze", 47 | "manual", 48 | ], 49 | version = "0.8.2", 50 | # buildifier: leave-alone 51 | deps = [ 52 | ], 53 | ) 54 | -------------------------------------------------------------------------------- /cargo/remote/BUILD.unindent-0.1.7.bazel: -------------------------------------------------------------------------------- 1 | """ 2 | @generated 3 | cargo-raze crate build file. 4 | 5 | DO NOT EDIT! Replaced on runs of cargo-raze 6 | """ 7 | 8 | # buildifier: disable=load 9 | load( 10 | "@io_bazel_rules_rust//rust:rust.bzl", 11 | "rust_binary", 12 | "rust_library", 13 | "rust_test", 14 | ) 15 | 16 | # buildifier: disable=load 17 | load("@bazel_skylib//lib:selects.bzl", "selects") 18 | 19 | package(default_visibility = [ 20 | # Public for visibility by "@raze__crate__version//" targets. 21 | # 22 | # Prefer access through "//cargo", which limits external 23 | # visibility to explicit Cargo.toml dependencies. 24 | "//visibility:public", 25 | ]) 26 | 27 | licenses([ 28 | "notice", # MIT from expression "MIT OR Apache-2.0" 29 | ]) 30 | 31 | # Generated Targets 32 | 33 | rust_library( 34 | name = "unindent", 35 | srcs = glob(["**/*.rs"]), 36 | crate_features = [ 37 | ], 38 | crate_root = "src/lib.rs", 39 | crate_type = "lib", 40 | data = [], 41 | edition = "2018", 42 | rustc_flags = [ 43 | "--cap-lints=allow", 44 | ], 45 | tags = [ 46 | "cargo-raze", 47 | "manual", 48 | ], 49 | version = "0.1.7", 50 | # buildifier: leave-alone 51 | deps = [ 52 | ], 53 | ) 54 | -------------------------------------------------------------------------------- /pylib/rsbridge/BUILD.bazel: -------------------------------------------------------------------------------- 1 | load("@io_bazel_rules_rust//rust:rust.bzl", "rust_library", "rust_test") 2 | load("@io_bazel_rules_rust//cargo:cargo_build_script.bzl", "cargo_build_script") 3 | load("@bazel_skylib//lib:selects.bzl", "selects") 4 | load("//rslib:rustfmt.bzl", "rustfmt_fix", "rustfmt_test") 5 | 6 | cargo_build_script( 7 | name = "build_script", 8 | srcs = ["build.rs"], 9 | ) 10 | 11 | rust_library( 12 | name = "rsbridge", 13 | srcs = ["lib.rs"], 14 | crate_type = "cdylib", 15 | rustc_flags = selects.with_or({ 16 | ( 17 | "@io_bazel_rules_rust//rust/platform:x86_64-apple-darwin", 18 | ): [ 19 | "-Clink-arg=-undefined", 20 | "-Clink-arg=dynamic_lookup", 21 | "-Clink-arg=-mmacosx-version-min=10.7", 22 | ], 23 | "//conditions:default": [], 24 | }), 25 | visibility = [ 26 | "//pylib:__subpackages__", 27 | ], 28 | deps = [ 29 | ":build_script", 30 | "//pylib/rsbridge/cargo:pyo3", 31 | "//rslib:anki", 32 | ], 33 | ) 34 | 35 | rustfmt_test( 36 | name = "format_check", 37 | srcs = glob([ 38 | "*.rs", 39 | ]), 40 | ) 41 | 42 | rustfmt_fix( 43 | name = "format", 44 | srcs = glob([ 45 | "*.rs", 46 | ]), 47 | ) 48 | -------------------------------------------------------------------------------- /cargo/remote/BUILD.openssl-probe-0.1.2.bazel: -------------------------------------------------------------------------------- 1 | """ 2 | @generated 3 | cargo-raze crate build file. 4 | 5 | DO NOT EDIT! Replaced on runs of cargo-raze 6 | """ 7 | 8 | # buildifier: disable=load 9 | load( 10 | "@io_bazel_rules_rust//rust:rust.bzl", 11 | "rust_binary", 12 | "rust_library", 13 | "rust_test", 14 | ) 15 | 16 | # buildifier: disable=load 17 | load("@bazel_skylib//lib:selects.bzl", "selects") 18 | 19 | package(default_visibility = [ 20 | # Public for visibility by "@raze__crate__version//" targets. 21 | # 22 | # Prefer access through "//cargo", which limits external 23 | # visibility to explicit Cargo.toml dependencies. 24 | "//visibility:public", 25 | ]) 26 | 27 | licenses([ 28 | "notice", # MIT from expression "MIT OR Apache-2.0" 29 | ]) 30 | 31 | # Generated Targets 32 | 33 | rust_library( 34 | name = "openssl_probe", 35 | srcs = glob(["**/*.rs"]), 36 | crate_features = [ 37 | ], 38 | crate_root = "src/lib.rs", 39 | crate_type = "lib", 40 | data = [], 41 | edition = "2015", 42 | rustc_flags = [ 43 | "--cap-lints=allow", 44 | ], 45 | tags = [ 46 | "cargo-raze", 47 | "manual", 48 | ], 49 | version = "0.1.2", 50 | # buildifier: leave-alone 51 | deps = [ 52 | ], 53 | ) 54 | -------------------------------------------------------------------------------- /cargo/remote/BUILD.percent-encoding-2.1.0.bazel: -------------------------------------------------------------------------------- 1 | """ 2 | @generated 3 | cargo-raze crate build file. 4 | 5 | DO NOT EDIT! Replaced on runs of cargo-raze 6 | """ 7 | 8 | # buildifier: disable=load 9 | load( 10 | "@io_bazel_rules_rust//rust:rust.bzl", 11 | "rust_binary", 12 | "rust_library", 13 | "rust_test", 14 | ) 15 | 16 | # buildifier: disable=load 17 | load("@bazel_skylib//lib:selects.bzl", "selects") 18 | 19 | package(default_visibility = [ 20 | # Public for visibility by "@raze__crate__version//" targets. 21 | # 22 | # Prefer access through "//cargo", which limits external 23 | # visibility to explicit Cargo.toml dependencies. 24 | "//visibility:public", 25 | ]) 26 | 27 | licenses([ 28 | "notice", # MIT from expression "MIT OR Apache-2.0" 29 | ]) 30 | 31 | # Generated Targets 32 | 33 | rust_library( 34 | name = "percent_encoding", 35 | srcs = glob(["**/*.rs"]), 36 | crate_features = [ 37 | ], 38 | crate_root = "lib.rs", 39 | crate_type = "lib", 40 | data = [], 41 | edition = "2015", 42 | rustc_flags = [ 43 | "--cap-lints=allow", 44 | ], 45 | tags = [ 46 | "cargo-raze", 47 | "manual", 48 | ], 49 | version = "2.1.0", 50 | # buildifier: leave-alone 51 | deps = [ 52 | ], 53 | ) 54 | -------------------------------------------------------------------------------- /cargo/remote/BUILD.rustc-demangle-0.1.18.bazel: -------------------------------------------------------------------------------- 1 | """ 2 | @generated 3 | cargo-raze crate build file. 4 | 5 | DO NOT EDIT! Replaced on runs of cargo-raze 6 | """ 7 | 8 | # buildifier: disable=load 9 | load( 10 | "@io_bazel_rules_rust//rust:rust.bzl", 11 | "rust_binary", 12 | "rust_library", 13 | "rust_test", 14 | ) 15 | 16 | # buildifier: disable=load 17 | load("@bazel_skylib//lib:selects.bzl", "selects") 18 | 19 | package(default_visibility = [ 20 | # Public for visibility by "@raze__crate__version//" targets. 21 | # 22 | # Prefer access through "//cargo", which limits external 23 | # visibility to explicit Cargo.toml dependencies. 24 | "//visibility:public", 25 | ]) 26 | 27 | licenses([ 28 | "notice", # MIT from expression "MIT OR Apache-2.0" 29 | ]) 30 | 31 | # Generated Targets 32 | 33 | rust_library( 34 | name = "rustc_demangle", 35 | srcs = glob(["**/*.rs"]), 36 | crate_features = [ 37 | ], 38 | crate_root = "src/lib.rs", 39 | crate_type = "lib", 40 | data = [], 41 | edition = "2015", 42 | rustc_flags = [ 43 | "--cap-lints=allow", 44 | ], 45 | tags = [ 46 | "cargo-raze", 47 | "manual", 48 | ], 49 | version = "0.1.18", 50 | # buildifier: leave-alone 51 | deps = [ 52 | ], 53 | ) 54 | -------------------------------------------------------------------------------- /cargo/remote/BUILD.version_check-0.9.2.bazel: -------------------------------------------------------------------------------- 1 | """ 2 | @generated 3 | cargo-raze crate build file. 4 | 5 | DO NOT EDIT! Replaced on runs of cargo-raze 6 | """ 7 | 8 | # buildifier: disable=load 9 | load( 10 | "@io_bazel_rules_rust//rust:rust.bzl", 11 | "rust_binary", 12 | "rust_library", 13 | "rust_test", 14 | ) 15 | 16 | # buildifier: disable=load 17 | load("@bazel_skylib//lib:selects.bzl", "selects") 18 | 19 | package(default_visibility = [ 20 | # Public for visibility by "@raze__crate__version//" targets. 21 | # 22 | # Prefer access through "//cargo", which limits external 23 | # visibility to explicit Cargo.toml dependencies. 24 | "//visibility:public", 25 | ]) 26 | 27 | licenses([ 28 | "notice", # MIT from expression "MIT OR Apache-2.0" 29 | ]) 30 | 31 | # Generated Targets 32 | 33 | rust_library( 34 | name = "version_check", 35 | srcs = glob(["**/*.rs"]), 36 | crate_features = [ 37 | ], 38 | crate_root = "src/lib.rs", 39 | crate_type = "lib", 40 | data = [], 41 | edition = "2015", 42 | rustc_flags = [ 43 | "--cap-lints=allow", 44 | ], 45 | tags = [ 46 | "cargo-raze", 47 | "manual", 48 | ], 49 | version = "0.9.2", 50 | # buildifier: leave-alone 51 | deps = [ 52 | ], 53 | ) 54 | -------------------------------------------------------------------------------- /cargo/remote/BUILD.static_assertions-1.1.0.bazel: -------------------------------------------------------------------------------- 1 | """ 2 | @generated 3 | cargo-raze crate build file. 4 | 5 | DO NOT EDIT! Replaced on runs of cargo-raze 6 | """ 7 | 8 | # buildifier: disable=load 9 | load( 10 | "@io_bazel_rules_rust//rust:rust.bzl", 11 | "rust_binary", 12 | "rust_library", 13 | "rust_test", 14 | ) 15 | 16 | # buildifier: disable=load 17 | load("@bazel_skylib//lib:selects.bzl", "selects") 18 | 19 | package(default_visibility = [ 20 | # Public for visibility by "@raze__crate__version//" targets. 21 | # 22 | # Prefer access through "//cargo", which limits external 23 | # visibility to explicit Cargo.toml dependencies. 24 | "//visibility:public", 25 | ]) 26 | 27 | licenses([ 28 | "notice", # MIT from expression "MIT OR Apache-2.0" 29 | ]) 30 | 31 | # Generated Targets 32 | 33 | rust_library( 34 | name = "static_assertions", 35 | srcs = glob(["**/*.rs"]), 36 | crate_features = [ 37 | ], 38 | crate_root = "src/lib.rs", 39 | crate_type = "lib", 40 | data = [], 41 | edition = "2015", 42 | rustc_flags = [ 43 | "--cap-lints=allow", 44 | ], 45 | tags = [ 46 | "cargo-raze", 47 | "manual", 48 | ], 49 | version = "1.1.0", 50 | # buildifier: leave-alone 51 | deps = [ 52 | ], 53 | ) 54 | -------------------------------------------------------------------------------- /cargo/remote/BUILD.foreign-types-shared-0.1.1.bazel: -------------------------------------------------------------------------------- 1 | """ 2 | @generated 3 | cargo-raze crate build file. 4 | 5 | DO NOT EDIT! Replaced on runs of cargo-raze 6 | """ 7 | 8 | # buildifier: disable=load 9 | load( 10 | "@io_bazel_rules_rust//rust:rust.bzl", 11 | "rust_binary", 12 | "rust_library", 13 | "rust_test", 14 | ) 15 | 16 | # buildifier: disable=load 17 | load("@bazel_skylib//lib:selects.bzl", "selects") 18 | 19 | package(default_visibility = [ 20 | # Public for visibility by "@raze__crate__version//" targets. 21 | # 22 | # Prefer access through "//cargo", which limits external 23 | # visibility to explicit Cargo.toml dependencies. 24 | "//visibility:public", 25 | ]) 26 | 27 | licenses([ 28 | "notice", # MIT from expression "MIT OR Apache-2.0" 29 | ]) 30 | 31 | # Generated Targets 32 | 33 | rust_library( 34 | name = "foreign_types_shared", 35 | srcs = glob(["**/*.rs"]), 36 | crate_features = [ 37 | ], 38 | crate_root = "src/lib.rs", 39 | crate_type = "lib", 40 | data = [], 41 | edition = "2015", 42 | rustc_flags = [ 43 | "--cap-lints=allow", 44 | ], 45 | tags = [ 46 | "cargo-raze", 47 | "manual", 48 | ], 49 | version = "0.1.1", 50 | # buildifier: leave-alone 51 | deps = [ 52 | ], 53 | ) 54 | -------------------------------------------------------------------------------- /cargo/remote/BUILD.futures-io-0.3.8.bazel: -------------------------------------------------------------------------------- 1 | """ 2 | @generated 3 | cargo-raze crate build file. 4 | 5 | DO NOT EDIT! Replaced on runs of cargo-raze 6 | """ 7 | 8 | # buildifier: disable=load 9 | load( 10 | "@io_bazel_rules_rust//rust:rust.bzl", 11 | "rust_binary", 12 | "rust_library", 13 | "rust_test", 14 | ) 15 | 16 | # buildifier: disable=load 17 | load("@bazel_skylib//lib:selects.bzl", "selects") 18 | 19 | package(default_visibility = [ 20 | # Public for visibility by "@raze__crate__version//" targets. 21 | # 22 | # Prefer access through "//cargo", which limits external 23 | # visibility to explicit Cargo.toml dependencies. 24 | "//visibility:public", 25 | ]) 26 | 27 | licenses([ 28 | "notice", # MIT from expression "MIT OR Apache-2.0" 29 | ]) 30 | 31 | # Generated Targets 32 | 33 | rust_library( 34 | name = "futures_io", 35 | srcs = glob(["**/*.rs"]), 36 | crate_features = [ 37 | "std", 38 | ], 39 | crate_root = "src/lib.rs", 40 | crate_type = "lib", 41 | data = [], 42 | edition = "2018", 43 | rustc_flags = [ 44 | "--cap-lints=allow", 45 | ], 46 | tags = [ 47 | "cargo-raze", 48 | "manual", 49 | ], 50 | version = "0.3.8", 51 | # buildifier: leave-alone 52 | deps = [ 53 | ], 54 | ) 55 | -------------------------------------------------------------------------------- /cargo/remote/BUILD.tinyvec_macros-0.1.0.bazel: -------------------------------------------------------------------------------- 1 | """ 2 | @generated 3 | cargo-raze crate build file. 4 | 5 | DO NOT EDIT! Replaced on runs of cargo-raze 6 | """ 7 | 8 | # buildifier: disable=load 9 | load( 10 | "@io_bazel_rules_rust//rust:rust.bzl", 11 | "rust_binary", 12 | "rust_library", 13 | "rust_test", 14 | ) 15 | 16 | # buildifier: disable=load 17 | load("@bazel_skylib//lib:selects.bzl", "selects") 18 | 19 | package(default_visibility = [ 20 | # Public for visibility by "@raze__crate__version//" targets. 21 | # 22 | # Prefer access through "//cargo", which limits external 23 | # visibility to explicit Cargo.toml dependencies. 24 | "//visibility:public", 25 | ]) 26 | 27 | licenses([ 28 | "notice", # MIT from expression "MIT OR (Apache-2.0 OR Zlib)" 29 | ]) 30 | 31 | # Generated Targets 32 | 33 | rust_library( 34 | name = "tinyvec_macros", 35 | srcs = glob(["**/*.rs"]), 36 | crate_features = [ 37 | ], 38 | crate_root = "src/lib.rs", 39 | crate_type = "lib", 40 | data = [], 41 | edition = "2018", 42 | rustc_flags = [ 43 | "--cap-lints=allow", 44 | ], 45 | tags = [ 46 | "cargo-raze", 47 | "manual", 48 | ], 49 | version = "0.1.0", 50 | # buildifier: leave-alone 51 | deps = [ 52 | ], 53 | ) 54 | -------------------------------------------------------------------------------- /cargo/remote/BUILD.fallible-streaming-iterator-0.1.9.bazel: -------------------------------------------------------------------------------- 1 | """ 2 | @generated 3 | cargo-raze crate build file. 4 | 5 | DO NOT EDIT! Replaced on runs of cargo-raze 6 | """ 7 | 8 | # buildifier: disable=load 9 | load( 10 | "@io_bazel_rules_rust//rust:rust.bzl", 11 | "rust_binary", 12 | "rust_library", 13 | "rust_test", 14 | ) 15 | 16 | # buildifier: disable=load 17 | load("@bazel_skylib//lib:selects.bzl", "selects") 18 | 19 | package(default_visibility = [ 20 | # Public for visibility by "@raze__crate__version//" targets. 21 | # 22 | # Prefer access through "//cargo", which limits external 23 | # visibility to explicit Cargo.toml dependencies. 24 | "//visibility:public", 25 | ]) 26 | 27 | licenses([ 28 | "notice", # MIT from expression "MIT OR Apache-2.0" 29 | ]) 30 | 31 | # Generated Targets 32 | 33 | rust_library( 34 | name = "fallible_streaming_iterator", 35 | srcs = glob(["**/*.rs"]), 36 | crate_features = [ 37 | ], 38 | crate_root = "src/lib.rs", 39 | crate_type = "lib", 40 | data = [], 41 | edition = "2015", 42 | rustc_flags = [ 43 | "--cap-lints=allow", 44 | ], 45 | tags = [ 46 | "cargo-raze", 47 | "manual", 48 | ], 49 | version = "0.1.9", 50 | # buildifier: leave-alone 51 | deps = [ 52 | ], 53 | ) 54 | -------------------------------------------------------------------------------- /cargo/remote/BUILD.fnv-1.0.7.bazel: -------------------------------------------------------------------------------- 1 | """ 2 | @generated 3 | cargo-raze crate build file. 4 | 5 | DO NOT EDIT! Replaced on runs of cargo-raze 6 | """ 7 | 8 | # buildifier: disable=load 9 | load( 10 | "@io_bazel_rules_rust//rust:rust.bzl", 11 | "rust_binary", 12 | "rust_library", 13 | "rust_test", 14 | ) 15 | 16 | # buildifier: disable=load 17 | load("@bazel_skylib//lib:selects.bzl", "selects") 18 | 19 | package(default_visibility = [ 20 | # Public for visibility by "@raze__crate__version//" targets. 21 | # 22 | # Prefer access through "//cargo", which limits external 23 | # visibility to explicit Cargo.toml dependencies. 24 | "//visibility:public", 25 | ]) 26 | 27 | licenses([ 28 | "notice", # Apache-2.0 from expression "Apache-2.0 OR MIT" 29 | ]) 30 | 31 | # Generated Targets 32 | 33 | rust_library( 34 | name = "fnv", 35 | srcs = glob(["**/*.rs"]), 36 | crate_features = [ 37 | "default", 38 | "std", 39 | ], 40 | crate_root = "lib.rs", 41 | crate_type = "lib", 42 | data = [], 43 | edition = "2015", 44 | rustc_flags = [ 45 | "--cap-lints=allow", 46 | ], 47 | tags = [ 48 | "cargo-raze", 49 | "manual", 50 | ], 51 | version = "1.0.7", 52 | # buildifier: leave-alone 53 | deps = [ 54 | ], 55 | ) 56 | -------------------------------------------------------------------------------- /cargo/remote/BUILD.either-1.6.1.bazel: -------------------------------------------------------------------------------- 1 | """ 2 | @generated 3 | cargo-raze crate build file. 4 | 5 | DO NOT EDIT! Replaced on runs of cargo-raze 6 | """ 7 | 8 | # buildifier: disable=load 9 | load( 10 | "@io_bazel_rules_rust//rust:rust.bzl", 11 | "rust_binary", 12 | "rust_library", 13 | "rust_test", 14 | ) 15 | 16 | # buildifier: disable=load 17 | load("@bazel_skylib//lib:selects.bzl", "selects") 18 | 19 | package(default_visibility = [ 20 | # Public for visibility by "@raze__crate__version//" targets. 21 | # 22 | # Prefer access through "//cargo", which limits external 23 | # visibility to explicit Cargo.toml dependencies. 24 | "//visibility:public", 25 | ]) 26 | 27 | licenses([ 28 | "notice", # MIT from expression "MIT OR Apache-2.0" 29 | ]) 30 | 31 | # Generated Targets 32 | 33 | rust_library( 34 | name = "either", 35 | srcs = glob(["**/*.rs"]), 36 | crate_features = [ 37 | "default", 38 | "use_std", 39 | ], 40 | crate_root = "src/lib.rs", 41 | crate_type = "lib", 42 | data = [], 43 | edition = "2015", 44 | rustc_flags = [ 45 | "--cap-lints=allow", 46 | ], 47 | tags = [ 48 | "cargo-raze", 49 | "manual", 50 | ], 51 | version = "1.6.1", 52 | # buildifier: leave-alone 53 | deps = [ 54 | ], 55 | ) 56 | -------------------------------------------------------------------------------- /cargo/remote/BUILD.slab-0.4.2.bazel: -------------------------------------------------------------------------------- 1 | """ 2 | @generated 3 | cargo-raze crate build file. 4 | 5 | DO NOT EDIT! Replaced on runs of cargo-raze 6 | """ 7 | 8 | # buildifier: disable=load 9 | load( 10 | "@io_bazel_rules_rust//rust:rust.bzl", 11 | "rust_binary", 12 | "rust_library", 13 | "rust_test", 14 | ) 15 | 16 | # buildifier: disable=load 17 | load("@bazel_skylib//lib:selects.bzl", "selects") 18 | 19 | package(default_visibility = [ 20 | # Public for visibility by "@raze__crate__version//" targets. 21 | # 22 | # Prefer access through "//cargo", which limits external 23 | # visibility to explicit Cargo.toml dependencies. 24 | "//visibility:public", 25 | ]) 26 | 27 | licenses([ 28 | "notice", # MIT from expression "MIT" 29 | ]) 30 | 31 | # Generated Targets 32 | 33 | rust_library( 34 | name = "slab", 35 | srcs = glob(["**/*.rs"]), 36 | crate_features = [ 37 | ], 38 | crate_root = "src/lib.rs", 39 | crate_type = "lib", 40 | data = [], 41 | edition = "2015", 42 | rustc_flags = [ 43 | "--cap-lints=allow", 44 | ], 45 | tags = [ 46 | "cargo-raze", 47 | "manual", 48 | ], 49 | version = "0.4.2", 50 | # buildifier: leave-alone 51 | deps = [ 52 | ], 53 | ) 54 | 55 | # Unsupported target "slab" with type "test" omitted 56 | -------------------------------------------------------------------------------- /cargo/remote/BUILD.ppv-lite86-0.2.10.bazel: -------------------------------------------------------------------------------- 1 | """ 2 | @generated 3 | cargo-raze crate build file. 4 | 5 | DO NOT EDIT! Replaced on runs of cargo-raze 6 | """ 7 | 8 | # buildifier: disable=load 9 | load( 10 | "@io_bazel_rules_rust//rust:rust.bzl", 11 | "rust_binary", 12 | "rust_library", 13 | "rust_test", 14 | ) 15 | 16 | # buildifier: disable=load 17 | load("@bazel_skylib//lib:selects.bzl", "selects") 18 | 19 | package(default_visibility = [ 20 | # Public for visibility by "@raze__crate__version//" targets. 21 | # 22 | # Prefer access through "//cargo", which limits external 23 | # visibility to explicit Cargo.toml dependencies. 24 | "//visibility:public", 25 | ]) 26 | 27 | licenses([ 28 | "notice", # MIT from expression "MIT OR Apache-2.0" 29 | ]) 30 | 31 | # Generated Targets 32 | 33 | rust_library( 34 | name = "ppv_lite86", 35 | srcs = glob(["**/*.rs"]), 36 | crate_features = [ 37 | "simd", 38 | "std", 39 | ], 40 | crate_root = "src/lib.rs", 41 | crate_type = "lib", 42 | data = [], 43 | edition = "2018", 44 | rustc_flags = [ 45 | "--cap-lints=allow", 46 | ], 47 | tags = [ 48 | "cargo-raze", 49 | "manual", 50 | ], 51 | version = "0.2.10", 52 | # buildifier: leave-alone 53 | deps = [ 54 | ], 55 | ) 56 | -------------------------------------------------------------------------------- /cargo/remote/BUILD.spin-0.5.2.bazel: -------------------------------------------------------------------------------- 1 | """ 2 | @generated 3 | cargo-raze crate build file. 4 | 5 | DO NOT EDIT! Replaced on runs of cargo-raze 6 | """ 7 | 8 | # buildifier: disable=load 9 | load( 10 | "@io_bazel_rules_rust//rust:rust.bzl", 11 | "rust_binary", 12 | "rust_library", 13 | "rust_test", 14 | ) 15 | 16 | # buildifier: disable=load 17 | load("@bazel_skylib//lib:selects.bzl", "selects") 18 | 19 | package(default_visibility = [ 20 | # Public for visibility by "@raze__crate__version//" targets. 21 | # 22 | # Prefer access through "//cargo", which limits external 23 | # visibility to explicit Cargo.toml dependencies. 24 | "//visibility:public", 25 | ]) 26 | 27 | licenses([ 28 | "notice", # MIT from expression "MIT" 29 | ]) 30 | 31 | # Generated Targets 32 | 33 | # Unsupported target "debug" with type "example" omitted 34 | 35 | rust_library( 36 | name = "spin", 37 | srcs = glob(["**/*.rs"]), 38 | crate_features = [ 39 | ], 40 | crate_root = "src/lib.rs", 41 | crate_type = "lib", 42 | data = [], 43 | edition = "2015", 44 | rustc_flags = [ 45 | "--cap-lints=allow", 46 | ], 47 | tags = [ 48 | "cargo-raze", 49 | "manual", 50 | ], 51 | version = "0.5.2", 52 | # buildifier: leave-alone 53 | deps = [ 54 | ], 55 | ) 56 | -------------------------------------------------------------------------------- /cargo/remote/BUILD.type-map-0.3.0.bazel: -------------------------------------------------------------------------------- 1 | """ 2 | @generated 3 | cargo-raze crate build file. 4 | 5 | DO NOT EDIT! Replaced on runs of cargo-raze 6 | """ 7 | 8 | # buildifier: disable=load 9 | load( 10 | "@io_bazel_rules_rust//rust:rust.bzl", 11 | "rust_binary", 12 | "rust_library", 13 | "rust_test", 14 | ) 15 | 16 | # buildifier: disable=load 17 | load("@bazel_skylib//lib:selects.bzl", "selects") 18 | 19 | package(default_visibility = [ 20 | # Public for visibility by "@raze__crate__version//" targets. 21 | # 22 | # Prefer access through "//cargo", which limits external 23 | # visibility to explicit Cargo.toml dependencies. 24 | "//visibility:public", 25 | ]) 26 | 27 | licenses([ 28 | "notice", # MIT from expression "MIT OR Apache-2.0" 29 | ]) 30 | 31 | # Generated Targets 32 | 33 | rust_library( 34 | name = "type_map", 35 | srcs = glob(["**/*.rs"]), 36 | crate_features = [ 37 | ], 38 | crate_root = "src/lib.rs", 39 | crate_type = "lib", 40 | data = [], 41 | edition = "2018", 42 | rustc_flags = [ 43 | "--cap-lints=allow", 44 | ], 45 | tags = [ 46 | "cargo-raze", 47 | "manual", 48 | ], 49 | version = "0.3.0", 50 | # buildifier: leave-alone 51 | deps = [ 52 | "@raze__fxhash__0_2_1//:fxhash", 53 | ], 54 | ) 55 | -------------------------------------------------------------------------------- /qt/tests/run_format.py: -------------------------------------------------------------------------------- 1 | import os 2 | import subprocess 3 | import sys 4 | 5 | if __name__ == "__main__": 6 | isort_ini = sys.argv[1] 7 | isort_ini = os.path.abspath(isort_ini) 8 | fix = len(sys.argv) > 2 9 | 10 | if fix: 11 | os.chdir(os.path.join(os.environ["BUILD_WORKSPACE_DIRECTORY"], "qt")) 12 | args = [] 13 | else: 14 | folder = os.path.join(os.path.dirname(__file__), "..") 15 | os.chdir(folder) 16 | args = ["--diff", "--check"] 17 | 18 | retcode = subprocess.run( 19 | [ 20 | sys.executable, 21 | "-m", 22 | "black", 23 | "-t", 24 | "py38", 25 | "--exclude=aqt/forms|colors", 26 | "aqt", 27 | "tests", 28 | "tools", 29 | ] 30 | + args, 31 | check=False, 32 | ).returncode 33 | if retcode != 0: 34 | sys.exit(retcode) 35 | 36 | retcode = subprocess.run( 37 | [ 38 | sys.executable, 39 | "-m", 40 | "isort", 41 | "--settings-path", 42 | isort_ini, 43 | "aqt", 44 | "tests", 45 | "tools", 46 | ] 47 | + args, 48 | check=False, 49 | ).returncode 50 | if retcode != 0: 51 | sys.exit(retcode) 52 | -------------------------------------------------------------------------------- /cargo/remote/BUILD.matches-0.1.8.bazel: -------------------------------------------------------------------------------- 1 | """ 2 | @generated 3 | cargo-raze crate build file. 4 | 5 | DO NOT EDIT! Replaced on runs of cargo-raze 6 | """ 7 | 8 | # buildifier: disable=load 9 | load( 10 | "@io_bazel_rules_rust//rust:rust.bzl", 11 | "rust_binary", 12 | "rust_library", 13 | "rust_test", 14 | ) 15 | 16 | # buildifier: disable=load 17 | load("@bazel_skylib//lib:selects.bzl", "selects") 18 | 19 | package(default_visibility = [ 20 | # Public for visibility by "@raze__crate__version//" targets. 21 | # 22 | # Prefer access through "//cargo", which limits external 23 | # visibility to explicit Cargo.toml dependencies. 24 | "//visibility:public", 25 | ]) 26 | 27 | licenses([ 28 | "notice", # MIT from expression "MIT" 29 | ]) 30 | 31 | # Generated Targets 32 | 33 | rust_library( 34 | name = "matches", 35 | srcs = glob(["**/*.rs"]), 36 | crate_features = [ 37 | ], 38 | crate_root = "lib.rs", 39 | crate_type = "lib", 40 | data = [], 41 | edition = "2015", 42 | rustc_flags = [ 43 | "--cap-lints=allow", 44 | ], 45 | tags = [ 46 | "cargo-raze", 47 | "manual", 48 | ], 49 | version = "0.1.8", 50 | # buildifier: leave-alone 51 | deps = [ 52 | ], 53 | ) 54 | 55 | # Unsupported target "macro_use_one" with type "test" omitted 56 | -------------------------------------------------------------------------------- /cargo/remote/BUILD.rand_hc-0.2.0.bazel: -------------------------------------------------------------------------------- 1 | """ 2 | @generated 3 | cargo-raze crate build file. 4 | 5 | DO NOT EDIT! Replaced on runs of cargo-raze 6 | """ 7 | 8 | # buildifier: disable=load 9 | load( 10 | "@io_bazel_rules_rust//rust:rust.bzl", 11 | "rust_binary", 12 | "rust_library", 13 | "rust_test", 14 | ) 15 | 16 | # buildifier: disable=load 17 | load("@bazel_skylib//lib:selects.bzl", "selects") 18 | 19 | package(default_visibility = [ 20 | # Public for visibility by "@raze__crate__version//" targets. 21 | # 22 | # Prefer access through "//cargo", which limits external 23 | # visibility to explicit Cargo.toml dependencies. 24 | "//visibility:public", 25 | ]) 26 | 27 | licenses([ 28 | "notice", # MIT from expression "MIT OR Apache-2.0" 29 | ]) 30 | 31 | # Generated Targets 32 | 33 | rust_library( 34 | name = "rand_hc", 35 | srcs = glob(["**/*.rs"]), 36 | crate_features = [ 37 | ], 38 | crate_root = "src/lib.rs", 39 | crate_type = "lib", 40 | data = [], 41 | edition = "2018", 42 | rustc_flags = [ 43 | "--cap-lints=allow", 44 | ], 45 | tags = [ 46 | "cargo-raze", 47 | "manual", 48 | ], 49 | version = "0.2.0", 50 | # buildifier: leave-alone 51 | deps = [ 52 | "@raze__rand_core__0_5_1//:rand_core", 53 | ], 54 | ) 55 | -------------------------------------------------------------------------------- /cargo/remote/BUILD.untrusted-0.7.1.bazel: -------------------------------------------------------------------------------- 1 | """ 2 | @generated 3 | cargo-raze crate build file. 4 | 5 | DO NOT EDIT! Replaced on runs of cargo-raze 6 | """ 7 | 8 | # buildifier: disable=load 9 | load( 10 | "@io_bazel_rules_rust//rust:rust.bzl", 11 | "rust_binary", 12 | "rust_library", 13 | "rust_test", 14 | ) 15 | 16 | # buildifier: disable=load 17 | load("@bazel_skylib//lib:selects.bzl", "selects") 18 | 19 | package(default_visibility = [ 20 | # Public for visibility by "@raze__crate__version//" targets. 21 | # 22 | # Prefer access through "//cargo", which limits external 23 | # visibility to explicit Cargo.toml dependencies. 24 | "//visibility:public", 25 | ]) 26 | 27 | licenses([ 28 | "notice", # ISC from expression "ISC" 29 | ]) 30 | 31 | # Generated Targets 32 | 33 | rust_library( 34 | name = "untrusted", 35 | srcs = glob(["**/*.rs"]), 36 | crate_features = [ 37 | ], 38 | crate_root = "src/untrusted.rs", 39 | crate_type = "lib", 40 | data = [], 41 | edition = "2018", 42 | rustc_flags = [ 43 | "--cap-lints=allow", 44 | ], 45 | tags = [ 46 | "cargo-raze", 47 | "manual", 48 | ], 49 | version = "0.7.1", 50 | # buildifier: leave-alone 51 | deps = [ 52 | ], 53 | ) 54 | 55 | # Unsupported target "tests" with type "test" omitted 56 | -------------------------------------------------------------------------------- /cargo/remote/BUILD.cfg-if-0.1.10.bazel: -------------------------------------------------------------------------------- 1 | """ 2 | @generated 3 | cargo-raze crate build file. 4 | 5 | DO NOT EDIT! Replaced on runs of cargo-raze 6 | """ 7 | 8 | # buildifier: disable=load 9 | load( 10 | "@io_bazel_rules_rust//rust:rust.bzl", 11 | "rust_binary", 12 | "rust_library", 13 | "rust_test", 14 | ) 15 | 16 | # buildifier: disable=load 17 | load("@bazel_skylib//lib:selects.bzl", "selects") 18 | 19 | package(default_visibility = [ 20 | # Public for visibility by "@raze__crate__version//" targets. 21 | # 22 | # Prefer access through "//cargo", which limits external 23 | # visibility to explicit Cargo.toml dependencies. 24 | "//visibility:public", 25 | ]) 26 | 27 | licenses([ 28 | "notice", # MIT from expression "MIT OR Apache-2.0" 29 | ]) 30 | 31 | # Generated Targets 32 | 33 | rust_library( 34 | name = "cfg_if", 35 | srcs = glob(["**/*.rs"]), 36 | crate_features = [ 37 | ], 38 | crate_root = "src/lib.rs", 39 | crate_type = "lib", 40 | data = [], 41 | edition = "2018", 42 | rustc_flags = [ 43 | "--cap-lints=allow", 44 | ], 45 | tags = [ 46 | "cargo-raze", 47 | "manual", 48 | ], 49 | version = "0.1.10", 50 | # buildifier: leave-alone 51 | deps = [ 52 | ], 53 | ) 54 | 55 | # Unsupported target "xcrate" with type "test" omitted 56 | -------------------------------------------------------------------------------- /cargo/remote/BUILD.cfg-if-1.0.0.bazel: -------------------------------------------------------------------------------- 1 | """ 2 | @generated 3 | cargo-raze crate build file. 4 | 5 | DO NOT EDIT! Replaced on runs of cargo-raze 6 | """ 7 | 8 | # buildifier: disable=load 9 | load( 10 | "@io_bazel_rules_rust//rust:rust.bzl", 11 | "rust_binary", 12 | "rust_library", 13 | "rust_test", 14 | ) 15 | 16 | # buildifier: disable=load 17 | load("@bazel_skylib//lib:selects.bzl", "selects") 18 | 19 | package(default_visibility = [ 20 | # Public for visibility by "@raze__crate__version//" targets. 21 | # 22 | # Prefer access through "//cargo", which limits external 23 | # visibility to explicit Cargo.toml dependencies. 24 | "//visibility:public", 25 | ]) 26 | 27 | licenses([ 28 | "notice", # MIT from expression "MIT OR Apache-2.0" 29 | ]) 30 | 31 | # Generated Targets 32 | 33 | rust_library( 34 | name = "cfg_if", 35 | srcs = glob(["**/*.rs"]), 36 | crate_features = [ 37 | ], 38 | crate_root = "src/lib.rs", 39 | crate_type = "lib", 40 | data = [], 41 | edition = "2018", 42 | rustc_flags = [ 43 | "--cap-lints=allow", 44 | ], 45 | tags = [ 46 | "cargo-raze", 47 | "manual", 48 | ], 49 | version = "1.0.0", 50 | # buildifier: leave-alone 51 | deps = [ 52 | ], 53 | ) 54 | 55 | # Unsupported target "xcrate" with type "test" omitted 56 | -------------------------------------------------------------------------------- /cargo/remote/BUILD.fallible-iterator-0.2.0.bazel: -------------------------------------------------------------------------------- 1 | """ 2 | @generated 3 | cargo-raze crate build file. 4 | 5 | DO NOT EDIT! Replaced on runs of cargo-raze 6 | """ 7 | 8 | # buildifier: disable=load 9 | load( 10 | "@io_bazel_rules_rust//rust:rust.bzl", 11 | "rust_binary", 12 | "rust_library", 13 | "rust_test", 14 | ) 15 | 16 | # buildifier: disable=load 17 | load("@bazel_skylib//lib:selects.bzl", "selects") 18 | 19 | package(default_visibility = [ 20 | # Public for visibility by "@raze__crate__version//" targets. 21 | # 22 | # Prefer access through "//cargo", which limits external 23 | # visibility to explicit Cargo.toml dependencies. 24 | "//visibility:public", 25 | ]) 26 | 27 | licenses([ 28 | "notice", # MIT from expression "MIT OR Apache-2.0" 29 | ]) 30 | 31 | # Generated Targets 32 | 33 | rust_library( 34 | name = "fallible_iterator", 35 | srcs = glob(["**/*.rs"]), 36 | crate_features = [ 37 | "default", 38 | "std", 39 | ], 40 | crate_root = "src/lib.rs", 41 | crate_type = "lib", 42 | data = [], 43 | edition = "2018", 44 | rustc_flags = [ 45 | "--cap-lints=allow", 46 | ], 47 | tags = [ 48 | "cargo-raze", 49 | "manual", 50 | ], 51 | version = "0.2.0", 52 | # buildifier: leave-alone 53 | deps = [ 54 | ], 55 | ) 56 | -------------------------------------------------------------------------------- /cargo/remote/BUILD.lock_api-0.4.2.bazel: -------------------------------------------------------------------------------- 1 | """ 2 | @generated 3 | cargo-raze crate build file. 4 | 5 | DO NOT EDIT! Replaced on runs of cargo-raze 6 | """ 7 | 8 | # buildifier: disable=load 9 | load( 10 | "@io_bazel_rules_rust//rust:rust.bzl", 11 | "rust_binary", 12 | "rust_library", 13 | "rust_test", 14 | ) 15 | 16 | # buildifier: disable=load 17 | load("@bazel_skylib//lib:selects.bzl", "selects") 18 | 19 | package(default_visibility = [ 20 | # Public for visibility by "@raze__crate__version//" targets. 21 | # 22 | # Prefer access through "//cargo", which limits external 23 | # visibility to explicit Cargo.toml dependencies. 24 | "//visibility:public", 25 | ]) 26 | 27 | licenses([ 28 | "notice", # Apache-2.0 from expression "Apache-2.0 OR MIT" 29 | ]) 30 | 31 | # Generated Targets 32 | 33 | rust_library( 34 | name = "lock_api", 35 | srcs = glob(["**/*.rs"]), 36 | crate_features = [ 37 | ], 38 | crate_root = "src/lib.rs", 39 | crate_type = "lib", 40 | data = [], 41 | edition = "2018", 42 | rustc_flags = [ 43 | "--cap-lints=allow", 44 | ], 45 | tags = [ 46 | "cargo-raze", 47 | "manual", 48 | ], 49 | version = "0.4.2", 50 | # buildifier: leave-alone 51 | deps = [ 52 | "@raze__scopeguard__1_1_0//:scopeguard", 53 | ], 54 | ) 55 | -------------------------------------------------------------------------------- /cargo/remote/BUILD.stable_deref_trait-1.2.0.bazel: -------------------------------------------------------------------------------- 1 | """ 2 | @generated 3 | cargo-raze crate build file. 4 | 5 | DO NOT EDIT! Replaced on runs of cargo-raze 6 | """ 7 | 8 | # buildifier: disable=load 9 | load( 10 | "@io_bazel_rules_rust//rust:rust.bzl", 11 | "rust_binary", 12 | "rust_library", 13 | "rust_test", 14 | ) 15 | 16 | # buildifier: disable=load 17 | load("@bazel_skylib//lib:selects.bzl", "selects") 18 | 19 | package(default_visibility = [ 20 | # Public for visibility by "@raze__crate__version//" targets. 21 | # 22 | # Prefer access through "//cargo", which limits external 23 | # visibility to explicit Cargo.toml dependencies. 24 | "//visibility:public", 25 | ]) 26 | 27 | licenses([ 28 | "notice", # MIT from expression "MIT OR Apache-2.0" 29 | ]) 30 | 31 | # Generated Targets 32 | 33 | rust_library( 34 | name = "stable_deref_trait", 35 | srcs = glob(["**/*.rs"]), 36 | crate_features = [ 37 | "alloc", 38 | "std", 39 | ], 40 | crate_root = "src/lib.rs", 41 | crate_type = "lib", 42 | data = [], 43 | edition = "2015", 44 | rustc_flags = [ 45 | "--cap-lints=allow", 46 | ], 47 | tags = [ 48 | "cargo-raze", 49 | "manual", 50 | ], 51 | version = "1.2.0", 52 | # buildifier: leave-alone 53 | deps = [ 54 | ], 55 | ) 56 | -------------------------------------------------------------------------------- /cargo/remote/BUILD.subtle-2.4.0.bazel: -------------------------------------------------------------------------------- 1 | """ 2 | @generated 3 | cargo-raze crate build file. 4 | 5 | DO NOT EDIT! Replaced on runs of cargo-raze 6 | """ 7 | 8 | # buildifier: disable=load 9 | load( 10 | "@io_bazel_rules_rust//rust:rust.bzl", 11 | "rust_binary", 12 | "rust_library", 13 | "rust_test", 14 | ) 15 | 16 | # buildifier: disable=load 17 | load("@bazel_skylib//lib:selects.bzl", "selects") 18 | 19 | package(default_visibility = [ 20 | # Public for visibility by "@raze__crate__version//" targets. 21 | # 22 | # Prefer access through "//cargo", which limits external 23 | # visibility to explicit Cargo.toml dependencies. 24 | "//visibility:public", 25 | ]) 26 | 27 | licenses([ 28 | "notice", # BSD-3-Clause from expression "BSD-3-Clause" 29 | ]) 30 | 31 | # Generated Targets 32 | 33 | rust_library( 34 | name = "subtle", 35 | srcs = glob(["**/*.rs"]), 36 | crate_features = [ 37 | ], 38 | crate_root = "src/lib.rs", 39 | crate_type = "lib", 40 | data = [], 41 | edition = "2015", 42 | rustc_flags = [ 43 | "--cap-lints=allow", 44 | ], 45 | tags = [ 46 | "cargo-raze", 47 | "manual", 48 | ], 49 | version = "2.4.0", 50 | # buildifier: leave-alone 51 | deps = [ 52 | ], 53 | ) 54 | 55 | # Unsupported target "mod" with type "test" omitted 56 | -------------------------------------------------------------------------------- /cargo/remote/BUILD.heck-0.3.2.bazel: -------------------------------------------------------------------------------- 1 | """ 2 | @generated 3 | cargo-raze crate build file. 4 | 5 | DO NOT EDIT! Replaced on runs of cargo-raze 6 | """ 7 | 8 | # buildifier: disable=load 9 | load( 10 | "@io_bazel_rules_rust//rust:rust.bzl", 11 | "rust_binary", 12 | "rust_library", 13 | "rust_test", 14 | ) 15 | 16 | # buildifier: disable=load 17 | load("@bazel_skylib//lib:selects.bzl", "selects") 18 | 19 | package(default_visibility = [ 20 | # Public for visibility by "@raze__crate__version//" targets. 21 | # 22 | # Prefer access through "//cargo", which limits external 23 | # visibility to explicit Cargo.toml dependencies. 24 | "//visibility:public", 25 | ]) 26 | 27 | licenses([ 28 | "notice", # MIT from expression "MIT OR Apache-2.0" 29 | ]) 30 | 31 | # Generated Targets 32 | 33 | rust_library( 34 | name = "heck", 35 | srcs = glob(["**/*.rs"]), 36 | crate_features = [ 37 | ], 38 | crate_root = "src/lib.rs", 39 | crate_type = "lib", 40 | data = [], 41 | edition = "2018", 42 | rustc_flags = [ 43 | "--cap-lints=allow", 44 | ], 45 | tags = [ 46 | "cargo-raze", 47 | "manual", 48 | ], 49 | version = "0.3.2", 50 | # buildifier: leave-alone 51 | deps = [ 52 | "@raze__unicode_segmentation__1_7_1//:unicode_segmentation", 53 | ], 54 | ) 55 | -------------------------------------------------------------------------------- /cargo/remote/BUILD.proc-macro-crate-0.1.5.bazel: -------------------------------------------------------------------------------- 1 | """ 2 | @generated 3 | cargo-raze crate build file. 4 | 5 | DO NOT EDIT! Replaced on runs of cargo-raze 6 | """ 7 | 8 | # buildifier: disable=load 9 | load( 10 | "@io_bazel_rules_rust//rust:rust.bzl", 11 | "rust_binary", 12 | "rust_library", 13 | "rust_test", 14 | ) 15 | 16 | # buildifier: disable=load 17 | load("@bazel_skylib//lib:selects.bzl", "selects") 18 | 19 | package(default_visibility = [ 20 | # Public for visibility by "@raze__crate__version//" targets. 21 | # 22 | # Prefer access through "//cargo", which limits external 23 | # visibility to explicit Cargo.toml dependencies. 24 | "//visibility:public", 25 | ]) 26 | 27 | licenses([ 28 | "notice", # Apache-2.0 from expression "Apache-2.0 OR MIT" 29 | ]) 30 | 31 | # Generated Targets 32 | 33 | rust_library( 34 | name = "proc_macro_crate", 35 | srcs = glob(["**/*.rs"]), 36 | crate_features = [ 37 | ], 38 | crate_root = "src/lib.rs", 39 | crate_type = "lib", 40 | data = [], 41 | edition = "2018", 42 | rustc_flags = [ 43 | "--cap-lints=allow", 44 | ], 45 | tags = [ 46 | "cargo-raze", 47 | "manual", 48 | ], 49 | version = "0.1.5", 50 | # buildifier: leave-alone 51 | deps = [ 52 | "@raze__toml__0_5_8//:toml", 53 | ], 54 | ) 55 | -------------------------------------------------------------------------------- /cargo/remote/BUILD.adler-0.2.3.bazel: -------------------------------------------------------------------------------- 1 | """ 2 | @generated 3 | cargo-raze crate build file. 4 | 5 | DO NOT EDIT! Replaced on runs of cargo-raze 6 | """ 7 | 8 | # buildifier: disable=load 9 | load( 10 | "@io_bazel_rules_rust//rust:rust.bzl", 11 | "rust_binary", 12 | "rust_library", 13 | "rust_test", 14 | ) 15 | 16 | # buildifier: disable=load 17 | load("@bazel_skylib//lib:selects.bzl", "selects") 18 | 19 | package(default_visibility = [ 20 | # Public for visibility by "@raze__crate__version//" targets. 21 | # 22 | # Prefer access through "//cargo", which limits external 23 | # visibility to explicit Cargo.toml dependencies. 24 | "//visibility:public", 25 | ]) 26 | 27 | licenses([ 28 | "notice", # MIT from expression "0BSD OR (MIT OR Apache-2.0)" 29 | ]) 30 | 31 | # Generated Targets 32 | 33 | # Unsupported target "bench" with type "bench" omitted 34 | 35 | rust_library( 36 | name = "adler", 37 | srcs = glob(["**/*.rs"]), 38 | crate_features = [ 39 | ], 40 | crate_root = "src/lib.rs", 41 | crate_type = "lib", 42 | data = [], 43 | edition = "2015", 44 | rustc_flags = [ 45 | "--cap-lints=allow", 46 | ], 47 | tags = [ 48 | "cargo-raze", 49 | "manual", 50 | ], 51 | version = "0.2.3", 52 | # buildifier: leave-alone 53 | deps = [ 54 | ], 55 | ) 56 | -------------------------------------------------------------------------------- /cargo/remote/BUILD.fixedbitset-0.2.0.bazel: -------------------------------------------------------------------------------- 1 | """ 2 | @generated 3 | cargo-raze crate build file. 4 | 5 | DO NOT EDIT! Replaced on runs of cargo-raze 6 | """ 7 | 8 | # buildifier: disable=load 9 | load( 10 | "@io_bazel_rules_rust//rust:rust.bzl", 11 | "rust_binary", 12 | "rust_library", 13 | "rust_test", 14 | ) 15 | 16 | # buildifier: disable=load 17 | load("@bazel_skylib//lib:selects.bzl", "selects") 18 | 19 | package(default_visibility = [ 20 | # Public for visibility by "@raze__crate__version//" targets. 21 | # 22 | # Prefer access through "//cargo", which limits external 23 | # visibility to explicit Cargo.toml dependencies. 24 | "//visibility:public", 25 | ]) 26 | 27 | licenses([ 28 | "notice", # MIT from expression "MIT OR Apache-2.0" 29 | ]) 30 | 31 | # Generated Targets 32 | 33 | # Unsupported target "benches" with type "bench" omitted 34 | 35 | rust_library( 36 | name = "fixedbitset", 37 | srcs = glob(["**/*.rs"]), 38 | crate_features = [ 39 | ], 40 | crate_root = "src/lib.rs", 41 | crate_type = "lib", 42 | data = [], 43 | edition = "2015", 44 | rustc_flags = [ 45 | "--cap-lints=allow", 46 | ], 47 | tags = [ 48 | "cargo-raze", 49 | "manual", 50 | ], 51 | version = "0.2.0", 52 | # buildifier: leave-alone 53 | deps = [ 54 | ], 55 | ) 56 | -------------------------------------------------------------------------------- /cargo/remote/BUILD.futures-core-0.3.8.bazel: -------------------------------------------------------------------------------- 1 | """ 2 | @generated 3 | cargo-raze crate build file. 4 | 5 | DO NOT EDIT! Replaced on runs of cargo-raze 6 | """ 7 | 8 | # buildifier: disable=load 9 | load( 10 | "@io_bazel_rules_rust//rust:rust.bzl", 11 | "rust_binary", 12 | "rust_library", 13 | "rust_test", 14 | ) 15 | 16 | # buildifier: disable=load 17 | load("@bazel_skylib//lib:selects.bzl", "selects") 18 | 19 | package(default_visibility = [ 20 | # Public for visibility by "@raze__crate__version//" targets. 21 | # 22 | # Prefer access through "//cargo", which limits external 23 | # visibility to explicit Cargo.toml dependencies. 24 | "//visibility:public", 25 | ]) 26 | 27 | licenses([ 28 | "notice", # MIT from expression "MIT OR Apache-2.0" 29 | ]) 30 | 31 | # Generated Targets 32 | 33 | rust_library( 34 | name = "futures_core", 35 | srcs = glob(["**/*.rs"]), 36 | crate_features = [ 37 | "alloc", 38 | "default", 39 | "std", 40 | ], 41 | crate_root = "src/lib.rs", 42 | crate_type = "lib", 43 | data = [], 44 | edition = "2018", 45 | rustc_flags = [ 46 | "--cap-lints=allow", 47 | ], 48 | tags = [ 49 | "cargo-raze", 50 | "manual", 51 | ], 52 | version = "0.3.8", 53 | # buildifier: leave-alone 54 | deps = [ 55 | ], 56 | ) 57 | -------------------------------------------------------------------------------- /cargo/remote/BUILD.futures-sink-0.3.8.bazel: -------------------------------------------------------------------------------- 1 | """ 2 | @generated 3 | cargo-raze crate build file. 4 | 5 | DO NOT EDIT! Replaced on runs of cargo-raze 6 | """ 7 | 8 | # buildifier: disable=load 9 | load( 10 | "@io_bazel_rules_rust//rust:rust.bzl", 11 | "rust_binary", 12 | "rust_library", 13 | "rust_test", 14 | ) 15 | 16 | # buildifier: disable=load 17 | load("@bazel_skylib//lib:selects.bzl", "selects") 18 | 19 | package(default_visibility = [ 20 | # Public for visibility by "@raze__crate__version//" targets. 21 | # 22 | # Prefer access through "//cargo", which limits external 23 | # visibility to explicit Cargo.toml dependencies. 24 | "//visibility:public", 25 | ]) 26 | 27 | licenses([ 28 | "notice", # MIT from expression "MIT OR Apache-2.0" 29 | ]) 30 | 31 | # Generated Targets 32 | 33 | rust_library( 34 | name = "futures_sink", 35 | srcs = glob(["**/*.rs"]), 36 | crate_features = [ 37 | "alloc", 38 | "default", 39 | "std", 40 | ], 41 | crate_root = "src/lib.rs", 42 | crate_type = "lib", 43 | data = [], 44 | edition = "2018", 45 | rustc_flags = [ 46 | "--cap-lints=allow", 47 | ], 48 | tags = [ 49 | "cargo-raze", 50 | "manual", 51 | ], 52 | version = "0.3.8", 53 | # buildifier: leave-alone 54 | deps = [ 55 | ], 56 | ) 57 | --------------------------------------------------------------------------------