anki.utils#
Attributes#
Functions#
|
The time in integer seconds. Pass scale=1000 to get milliseconds. |
|
|
|
Strip HTML but keep media filenames |
|
|
|
Given a list of integers, return a string '(int1,int2,...)'. |
|
Return a non-conflicting timestamp for table. |
|
Return the first safe ID to use. |
|
|
|
|
|
Return a base91-encoded 64bit random number. |
|
|
|
|
|
|
|
|
|
A reusable temp folder which we clean out on each program invocation. |
|
|
|
Return tmpdir+name. Deletes any existing file. |
|
|
|
Execute a command. If WAIT, return exit code. |
|
|
|
|
|
|
|
Anki's version as an integer in the form YYMMPP, e.g. 230900. |
|
Module Contents#
- anki.utils.to_json_bytes: collections.abc.Callable[[Any], bytes]#
- anki.utils.int_time(scale: int = 1) int#
The time in integer seconds. Pass scale=1000 to get milliseconds.
- anki.utils.strip_html(txt: str) str#
- anki.utils.strip_html_media(txt: str) str#
Strip HTML but keep media filenames
- anki.utils.html_to_text_line(txt: str) str#
- anki.utils.ids2str(ids: collections.abc.Iterable[int | str]) str#
Given a list of integers, return a string ‘(int1,int2,…)’.
- anki.utils.timestamp_id(db: anki.dbproxy.DBProxy, table: str) int#
Return a non-conflicting timestamp for table.
- anki.utils.max_id(db: anki.dbproxy.DBProxy) int#
Return the first safe ID to use.
- anki.utils.base62(num: int, extra: str = '') str#
- anki.utils.base91(num: int) str#
- anki.utils.guid64() str#
Return a base91-encoded 64bit random number.
- anki.utils.join_fields(list: join_fields.list[str]) str#
- anki.utils.split_fields(string: str) list[str]#
- anki.utils.checksum(data: bytes | str) str#
- anki.utils.field_checksum(data: str) int#
- anki.utils.tmpdir() str#
A reusable temp folder which we clean out on each program invocation.
- anki.utils.tmpfile(prefix: str = '', suffix: str = '') str#
- anki.utils.namedtmp(name: str, remove: bool = True) str#
Return tmpdir+name. Deletes any existing file.
- anki.utils.no_bundled_libs() collections.abc.Iterator[None]#
- anki.utils.call(argv: list[str], wait: bool = True, **kwargs: Any) int#
Execute a command. If WAIT, return exit code.
- anki.utils.is_mac = False#
- anki.utils.is_win = False#
- anki.utils.is_lin = True#
- anki.utils.is_gnome#
- anki.utils.dev_mode#
- anki.utils.hmr_mode#
- anki.utils.INVALID_FILENAME_CHARS = ':*?"<>|'#
- anki.utils.invalid_filename(str: invalid_filename.str, dirsep: bool = True) invalid_filename.str | None#
- anki.utils.plat_desc() str#
- anki.utils.version_with_build() str#
- anki.utils.int_version() int#
Anki’s version as an integer in the form YYMMPP, e.g. 230900. (year, month, patch). In 2.1.x releases, this was just the last number.
- anki.utils.int_version_to_str(ver: int) str#
- anki.utils.point_version#
- anki.utils.pointVersion#