quicktype
quicktype copied to clipboard
Please do not use assert() in python to enforce interface constraints.
A typical generated python class looks like this:
@dataclass
class UpdateIssueEventNoteSchema:
note: str
@staticmethod
def from_dict(obj: Any) -> 'UpdateIssueEventNoteSchema':
assert isinstance(obj, dict)
note = from_str(obj.get("note"))
return UpdateIssueEventNoteSchema(note)
However, the assert and the enclosed code might will be removed when compiling to optimised byte code.
Please see https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html for more information.
I would suggest to throw an AssertionError explicitly.