Skip to content
This repository has been archived by the owner on Dec 10, 2024. It is now read-only.

Commit

Permalink
Make propertys a dict
Browse files Browse the repository at this point in the history
  • Loading branch information
mawildoer committed Sep 13, 2024
1 parent 209b2d7 commit e666bf2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
20 changes: 12 additions & 8 deletions src/faebryk/libs/kicad/fileformats_sch.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,9 @@ class C_power:

name: str = field(**sexp_field(positional=True))
power: Optional[C_power] = None
propertys: list[C_property] = field(
**sexp_field(multidict=True), default_factory=list
propertys: dict[str, C_property] = field(
**sexp_field(multidict=True, key=lambda x: x.name),
default_factory=dict,
)
pin_numbers: Optional[E_hide] = None
pin_names: Optional[C_pin_names] = None
Expand Down Expand Up @@ -205,8 +206,9 @@ class C_pin:
in_bom: bool
on_board: bool
fields_autoplaced: bool = True
propertys: list[C_property] = field(
**sexp_field(multidict=True), default_factory=list
propertys: dict[str, C_property] = field(
**sexp_field(multidict=True, key=lambda x: x.name),
default_factory=dict,
)
pins: list[C_pin] = field(
**sexp_field(multidict=True), default_factory=list
Expand Down Expand Up @@ -257,8 +259,9 @@ class E_type(SymEnum):
fill: C_fill
uuid: UUID
fields_autoplaced: bool = True
propertys: list[C_property] = field(
**sexp_field(multidict=True), default_factory=list
propertys: dict[str, C_property] = field(
**sexp_field(multidict=True, key=lambda x: x.name),
default_factory=dict,
)
pins: list[C_pin] = field(
**sexp_field(multidict=True), default_factory=list
Expand All @@ -284,8 +287,9 @@ class E_shape(SymEnum):
uuid: UUID
text: str = field(**sexp_field(positional=True))
fields_autoplaced: bool = True
propertys: list[C_property] = field(
**sexp_field(multidict=True), default_factory=list
propertys: dict[str, C_property] = field(
**sexp_field(multidict=True, key=lambda x: x.name),
default_factory=dict,
)

# TODO: inheritance
Expand Down
2 changes: 1 addition & 1 deletion test/libs/kicad/test_fileformats.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def test_parser(self):

self.assertEqual(
sch.kicad_sch.lib_symbols.symbol["Amplifier_Audio:LM4990ITL"]
.propertys[3]
.propertys["Datasheet"]
.value,
"http://www.ti.com/lit/ds/symlink/lm4990.pdf",
)
Expand Down

0 comments on commit e666bf2

Please sign in to comment.