| 236 | |
| 237 | @dataclass(frozen=True) |
| 238 | class ValueRange: |
| 239 | start: int |
| 240 | end: int |
| 241 | step: int |
| 242 | |
| 243 | def __repr__(self): |
| 244 | if self.step == 1: |
| 245 | return f"<range: {self.start:#x} to {self.end:#x}>" |
| 246 | return f"<range: {self.start:#x} to {self.end:#x}, step {self.step:#x}>" |
| 247 | |
| 248 | def __contains__(self, other): |
| 249 | if not isinstance(other, int): |
| 250 | return NotImplemented |
| 251 | return other in range(self.start, self.end, self.step) |
| 252 | |
| 253 | |
| 254 | @decorators.passive |