Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

non-functional: sync Decks with libAnki #15813

Merged
merged 4 commits into from
Mar 16, 2024

Conversation

david-allison
Copy link
Member

@david-allison david-allison commented Mar 8, 2024

Purpose / Description

Decks was pretty badly out of sync with decks.py

https://github.com/ankitects/anki/blob/main/pylib/anki/decks.py

I want to get back in sync, as #15611 has shown that we still have issues.

This will also allow us to more easily deprecate the legacy methods, rather than using a combination of new and legacy methods

DeckManager.register_deprecated_aliases(
    confForDid=DeckManager.config_dict_for_deck_id,
    setConf=DeckManager.set_config_id_for_deck_dict,
    allConf=DeckManager.all_config,
    getConf=DeckManager.get_config,
    confId=DeckManager.add_config_returning_id,
    newDyn=DeckManager.new_filtered,
    isDyn=DeckManager.is_filtered,
)

As a long-term stretch goal, this brings us closer to automation to map from libanki to pylib

Approach

  • rename + reorder methods
  • Introduce LibAnkiAlias: I suspect we'll eventually want all methods in libAnki to be annotated by this OR NotinLibAnki. This makes it easier to map from libanki to pylib
  • Brief look through and add cleanup annotations where necessary

How Has This Been Tested?

Ran unit tests, then rebased onto main

Checklist

  • You have a descriptive commit message with a short title (first line, max 50 chars).
  • You have commented your code, particularly in hard-to-understand areas
  • You have performed a self-review of your own code
  • UI changes: include screenshots of all affected screens (in particular showing any new or changed strings)
  • UI Changes: You have tested your change using the Google Accessibility Scanner

using mapping:

https://github.com/ankitects/anki/blob/9228c87b3af7e8ecd611aa4b221d7a2012c56b32/pylib/anki/decks.py#L577-L589

```python
DeckManager.register_deprecated_aliases(
    confForDid=DeckManager.config_dict_for_deck_id,
    setConf=DeckManager.set_config_id_for_deck_dict,
    allConf=DeckManager.all_config,
    getConf=DeckManager.get_config,
    confId=DeckManager.add_config_returning_id,
    newDyn=DeckManager.new_filtered,
    isDyn=DeckManager.is_filtered,
)

# in the list, but unused:
    remConf=DeckManager.remove_config,
    updateConf=DeckManager.update_config,
    didsForConf=DeckManager.decks_using_config,
    nameOrNone=DeckManager.name_if_exists,
```
* Add missing method stubs
* Reorder methods
@BrayanDSO BrayanDSO added Needs Second Approval Has one approval, one more approval to merge and removed Needs Review labels Mar 8, 2024
@lukstbit lukstbit added Pending Merge Things with approval that are waiting future merge (e.g. targets a future release, CI wait, etc) and removed Needs Second Approval Has one approval, one more approval to merge labels Mar 16, 2024
@lukstbit lukstbit added this pull request to the merge queue Mar 16, 2024
Merged via the queue into ankidroid:main with commit d323167 Mar 16, 2024
7 checks passed
@github-actions github-actions bot added this to the 2.18 release milestone Mar 16, 2024
@github-actions github-actions bot removed the Pending Merge Things with approval that are waiting future merge (e.g. targets a future release, CI wait, etc) label Mar 16, 2024
@david-allison david-allison deleted the deck-refactor branch March 16, 2024 18:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants