Skip to content

Commit

Permalink
Rename fill_partnumbers() to __post_init__()
Browse files Browse the repository at this point in the history
  • Loading branch information
kvid committed Oct 20, 2023
1 parent 8cd76eb commit 98e8f7f
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/wireviz/wv_dataclasses.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ class Component:
subtype: Union[MultilineHypertext, List[MultilineHypertext]] = None

# part number
partnumbers: PartNumberInfo = None # filled by fill_partnumbers()
partnumbers: PartNumberInfo = None # filled by __post_init__()
# the following are provided for user convenience and should not be accessed later.
# their contents are loaded into partnumbers during the child class __post_init__()
pn: str = None
Expand All @@ -190,7 +190,7 @@ class Component:
ignore_in_bom: bool = False
bom_id: Optional[str] = None # to be filled after harness is built

def fill_partnumbers(self):
def __post_init__(self):
partnos = [self.pn, self.manufacturer, self.mpn, self.supplier, self.spn]
partnos = [remove_links(entry) for entry in partnos]
partnos = tuple(partnos)
Expand Down Expand Up @@ -271,7 +271,7 @@ class AdditionalComponent(Component):
note: str = None

def __post_init__(self):
super().fill_partnumbers()
super().__post_init__()
self.bgcolor = SingleColor(self.bgcolor)
self.qty = self.parse_number_and_unit(self.qty, None)
self.amount = self.parse_number_and_unit(self.amount, None)
Expand Down Expand Up @@ -366,7 +366,7 @@ def unit(self): # for compatibility with BOM hashing
return None # connectors do not support units.

def __post_init__(self) -> None:
super().fill_partnumbers()
super().__post_init__()

self.bgcolor = SingleColor(self.bgcolor)
self.bgcolor_title = SingleColor(self.bgcolor_title)
Expand Down Expand Up @@ -651,7 +651,7 @@ def _get_correct_element(inp, idx):
return None # non-bundles do not support lists of part data

def __post_init__(self) -> None:
super().fill_partnumbers()
super().__post_init__()

self.bgcolor = SingleColor(self.bgcolor)
self.bgcolor_title = SingleColor(self.bgcolor_title)
Expand Down

0 comments on commit 98e8f7f

Please sign in to comment.