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

Add error checking to Card initialisation #1

Closed
ImplyingICheck opened this issue May 9, 2023 · 1 comment
Closed

Add error checking to Card initialisation #1

ImplyingICheck opened this issue May 9, 2023 · 1 comment

Comments

@ImplyingICheck
Copy link
Owner

[#1]
Ensure len(field_names) and len(fields) match
Raise error if differing lengths

[ankideckconstructor] card.py (Lines 12-20)


 def __init__(self, fields, has_html=False, tags=None, field_names=None,
               note_type=None, deck=None, guid=None):
    self.has_html = has_html
    self.tags = tags
    self.field_names = self.__set_field_names(field_names, len(fields))
    self.fields = fields
    self.note_type = note_type
    self.deck = deck
    self.guid = guid

Open in IDE

Created from JetBrains using CodeStream

ImplyingICheck pushed a commit that referenced this issue May 16, 2023
Change scoping of _generate_field_names to module level declaration
rather than @staticmethod tag. Follow project coding style.
@ImplyingICheck
Copy link
Owner Author

ImplyingICheck commented Jul 19, 2023

Implemented by [#25]

As of [#35], lengths do not need to be exactly the same. Excess field_names are discarded and generic replacements are generated when too few field_names are provided.

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

No branches or pull requests

1 participant