home · contact · privacy
Remove dead code.
authorPlom Heller <plom@plomlompom.com>
Sun, 9 Aug 2026 03:51:30 +0000 (05:51 +0200)
committerPlom Heller <plom@plomlompom.com>
Sun, 9 Aug 2026 03:51:30 +0000 (05:51 +0200)
src/bricksplom/misc.py

index 19a65b499917ec18b43f66296dabb1b7be5cd4e4..becb8cecafcf8dc00d154984216612d2921c0941 100644 (file)
@@ -108,7 +108,7 @@ class WithDb:
 
     def __init__(
             self,
-            db: Optional['BricksDb'] = None,
+            db: 'BricksDb',
             **kwargs
             ) -> None:
         self.db = db
@@ -326,14 +326,12 @@ class BrickDesign(Textfiled, WithDb, Lookupable):
             if not item.ldraw:
                 return 'no LDRAW file associated'
             lines: list[str] = []
-            assert item.db is not None
             walk(lines, item.ldraw, item.db.ldraw.tree(item.ldraw))
             return CHAR_NEWLINE.join(lines)
 
         def to_boxes(
                 item: Self
                 ) -> str:
-            assert item.db is not None
             brick_ids = tuple(b.id_ for b in item.db.bricks.values()
                               if b.design_id in item.all_ids)
             boxes = set()
@@ -499,7 +497,6 @@ class Brick(Textfiled, WithDb, Lookupable):
     def __str__(
             self
             ) -> str:
-        assert self.db
         design = self.db.designs[self.design_id]
         color = str(self.db.colors[self.color_id]).strip()
         comment = f' # {self.comment}' if self.comment else ''
@@ -616,7 +613,6 @@ class BrickSet(Textfiled, WithDb, Lookupable):
             self
             ) -> str:
         def format_line(count, brick_id, comment) -> str:
-            assert self.db
             brick = self.db.bricks[brick_id]
             design_id = brick.design_id
             tail_comment = f' # {comment}' if comment else ''
@@ -663,7 +659,6 @@ class Box(WithDb, Lookupable):
             **kwargs
             ) -> None:
         super().__init__(**kwargs)
-        assert self.db
         self.id_ = id_
         self._set = bricks_set
         designed_listings: list[tuple[BrickDesign, list[BrickListing]]] = []
@@ -693,7 +688,6 @@ class Box(WithDb, Lookupable):
     def show(
             self,
             ) -> str:
-        assert self.db
         lines = []
         for design, listings in self.designs_to_listings:
             lines += [