def sort2(component): if component.getPrefix().lower() in SortPrefix: # Sort by Prefix then by Value result = [component.getPrefix(), componentValue(component.getValue())] print('sort="{}"'.format(result)) return result else: # Sort by Reference Designator only result = natural_sort(component.getRef()) print('sort={}'.format(result)) return result
def sortComponents(self): self.components = sorted(self.components, key=lambda c: natural_sort(c.getRef()))
def sort1(component): return natural_sort(component.getRef())