glideapps / glideapps/quicktype
Please do not use assert() in python to enforce interface constraints.
Open
- Dominant language
- TypeScript
- Stars
- 13.9k
- Forks
- 1.2k
- Avg merge
- 8h 53m
- Merged PRs (30d)
- 369
Description
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.
Contributor guide
Assessment
This issue has not been assessed yet.