for coll in collections.values():
if coll.is_in is None:
continue
- direction = 1 if coll.is_in else (-1)
for count, piece_id, _ in coll.piece_listings_flat():
- counts[piece_id] = counts.get(piece_id, 0) + (direction * count)
+ counts[piece_id] = (counts.get(piece_id, 0)
+ + ((1 if coll.is_in else (-1)) * count))
for piece_id, count in counts.items():
assert count == 0, (piece_id, count)
def main(
) -> None:
+ 'Load tables from BRICKSPLOM_DIR and put out in reproducible listings.'
dir_tables = environ.get(NAME_ENV_DIRNAME, '.')
colors = Color.from_textfile((dir_tables, PATH_COLORS))
pieces = Piece.from_textfile((dir_tables, PATH_PIECES))