Represents an extension in the Scratch block pallete - e.g. video sensing
| 13 | |
| 14 | @dataclass |
| 15 | class Extension(base.JSONSerializable): |
| 16 | """ |
| 17 | Represents an extension in the Scratch block pallete - e.g. video sensing |
| 18 | """ |
| 19 | code: str |
| 20 | name: str = None |
| 21 | |
| 22 | def __eq__(self, other): |
| 23 | return self.code == other.code |
| 24 | |
| 25 | @staticmethod |
| 26 | def from_json(data: str): |
| 27 | assert isinstance(data, str) |
| 28 | _extension = Extensions.find(data, "code") |
| 29 | if _extension is None: |
| 30 | _extension = Extension(data) |
| 31 | |
| 32 | return _extension |
| 33 | |
| 34 | def to_json(self) -> str: |
| 35 | return self.code |
| 36 | |
| 37 | |
| 38 | class Extensions(enums._EnumWrapper): |
no outgoing calls
no test coverage detected