This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pytest | |
class IntervalMap: | |
def __init__(self): | |
self.limits = [] | |
self.map = {} | |
def __setitem__(self, upper_bound, value): | |
self.limits.append(upper_bound) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pytest | |
class IntervalMap: | |
def __init__(self): | |
self.limits = [] | |
self.map = {} | |
def __setitem__(self, upper_bound, value): | |
self.limits.append(upper_bound) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from itertools import zip_longest | |
class Bits(bytes): | |
CHUNK = 8 | |
def __new__(cls, n): | |
return super().__new__(cls, cls.number_to_bits(n)) | |
@staticmethod |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Geometry""" | |
class Point: | |
def __init__(self, x, y): | |
self.x = x | |
self.y = y | |
def __eq__(self, other): | |
return self.x == other.x and self.y == other.y |