czech_plus.config#

Module for config management.

Module Contents#

Classes#

LogLevel

Log level for the addon.

LogSettings

Settings for logs.

BaseCardFields

Base class for card fields.

NounCardFields

Additional fields in noun cards.

VerbCardFields

Additional fields in verb cards.

AdjectiveCardFields

Additional fields in adjective cards.

NounCardsSettings

Settings for noun cards.

VerbCardsSettings

Settings for verb cards.

AdjectivesCardsSettings

Settings for adjective cards.

CardsSettings

Settings for cards.

Config

Config for the addon.

Functions#

_get_anki_config(→ _CONFIG_AS_DICT)

Get the config from Anki.

Attributes#

BASE_DIR[source]#
_CONFIG_PATH[source]#
_ADDON_META_PATH[source]#
_CONFIG_AS_DICT: typing_extensions.TypeAlias = 'dict[str, t.Union[str, _CONFIG_AS_DICT]]'[source]#
_get_anki_config() _CONFIG_AS_DICT[source]#

Get the config from Anki.

class LogLevel[source]#

Bases: enum.IntEnum

Log level for the addon.

TRACE = 5[source]#

Use only for tracing error without a debugger.

DEBUG = 10[source]#
INFO = 20[source]#
SUCCESS = 25[source]#
WARNING = 30[source]#
ERROR = 40[source]#
CRITICAL = 50[source]#
class LogSettings[source]#

Settings for logs.

level: LogLevel[source]#

Log level for the app.

json: bool = False[source]#

Upload logs into JSON.

class BaseCardFields[source]#

Base class for card fields.

czech: str = 'Czech'[source]#

Name of the field, where czech word is.

processed: str = 'Processed'[source]#

Name of the field, where already processed card is.

class NounCardFields[source]#

Bases: BaseCardFields

Additional fields in noun cards.

gender: str = 'Gender'[source]#

Name of the field, where gender is.

class VerbCardFields[source]#

Bases: BaseCardFields

Additional fields in verb cards.

prepositions_and_cases: str = 'Prepositions and Cases'[source]#

Name of the field, where prepositions and cases is.

class AdjectiveCardFields[source]#

Bases: BaseCardFields

Additional fields in adjective cards.

completion_of_comparison_degrees: str = 'Completion of Comparison Degrees'[source]#

Name of the field, where completion of comparison degrees is.

class NounCardsSettings[source]#

Settings for noun cards.

note_type_name: str = 'Noun'[source]#

Name of the Note Type for nouns.

fields: NounCardFields[source]#

Settings for fields in noun cards.

class VerbCardsSettings[source]#

Settings for verb cards.

note_type_name: str = 'Verb'[source]#

Name of the Note Type for verbs.

fields: VerbCardFields[source]#

Settings for fields in verb cards.

class AdjectivesCardsSettings[source]#

Settings for adjective cards.

note_type_name: str = 'Adjective'[source]#

Name of the Note Type for adjectives.

fields: AdjectiveCardFields[source]#

Settings for fields in adjective cards.

class CardsSettings[source]#

Settings for cards.

nouns: NounCardsSettings[source]#

Settings for noun cards.

verbs: VerbCardsSettings[source]#

Settings for verb cards.

adjectives: AdjectivesCardsSettings[source]#

Settings for adjective cards.

class Config[source]#

Config for the addon.

logging: LogSettings[source]#

Settings for logs.

cards: CardsSettings[source]#

Settings for cards.

__post_init__() None[source]#

Post init hook.

_setup() None[source]#

Perform setup of the config.

_write_config() None[source]#

Write config to the file.

_set_values(object_to_set: Any, config: _CONFIG_AS_DICT, /) None[source]#

Set values from dict config to object.

We use this method of setting attributes because we use frozen dataclass. This was found on https://github.com/python/cpython/issues/82625.

Parameters:
  • object_to_set – Object to set values to. To support recursion.

  • config – Dict config to set values from.

classmethod _start_watching_for_changes() None[source]#

Start watching for changes in config.

This ensures that we will never start two config watchers in one time.

_watch_for_changes() None[source]#

Watch for changes in config file and update self based on changes.