Skip to content

Commit

Permalink
Merge pull request #23 from PatrickBaus/fix_changing_fields
Browse files Browse the repository at this point in the history
Fixed changing field values via the complex_variant option
  • Loading branch information
set-soft authored Jan 2, 2024
2 parents cef5ff5 + 8bad6f1 commit c8fdaec
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions kibom/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def __eq__(self, other):
"""
Equivalency operator is used to determine if two parts are 'equal'
"""

# 'fitted' value must be the same for both parts
if self.isFitted() != other.isFitted():
return False
Expand Down Expand Up @@ -144,7 +144,7 @@ def getPrefix(self):
Get the reference prefix
e.g. if this component has a reference U12, will return "U"
"""

prefix = ""

for c in self.getRef():
Expand All @@ -160,7 +160,7 @@ def getSuffix(self):
Return the reference suffix #
e.g. if this component has a reference U12, will return "12"
"""

suffix = ""

for c in self.getRef():
Expand Down Expand Up @@ -258,7 +258,7 @@ def setField(self, name, value):
fields = self.element.getChild('fields')
if fields:
for field in fields.getChildren():
if field.get('field', 'name') == name:
if field.get('field', 'name').lower() == name.lower():
field.setChars(value)
return value

Expand Down Expand Up @@ -336,13 +336,13 @@ def getFieldNames(self):
"""

fieldNames = []

fields = self.element.getChild('fields')

if fields:
for f in fields.getChildren():
fieldNames.append(f.get('field', 'name').lower())

return fieldNames

def getRef(self):
Expand Down Expand Up @@ -493,7 +493,7 @@ def __init__(self):
self.stack = []

def add(self, P, N):

if self.stack == []:
self.stack.append(((P, N), (P, N)))
return
Expand Down Expand Up @@ -552,7 +552,7 @@ def getField(self, field):
field = field.lower()
if field not in self.fields or not self.fields[field]:
return ""

return u''.join(self.fields[field])

def getCount(self):
Expand Down

0 comments on commit c8fdaec

Please sign in to comment.