From 2e0f7ceaf97ec8327eed5e266cb7591dbff470a9 Mon Sep 17 00:00:00 2001 From: iopapamanoglou Date: Tue, 27 Aug 2024 00:03:35 +0200 Subject: [PATCH] gen_F fix --- src/faebryk/library/_F.py | 398 +++++++++++++++++++------------------- tools/library/gen_F.py | 11 +- 2 files changed, 208 insertions(+), 201 deletions(-) diff --git a/src/faebryk/library/_F.py b/src/faebryk/library/_F.py index 44f8cf87..f8a62660 100644 --- a/src/faebryk/library/_F.py +++ b/src/faebryk/library/_F.py @@ -17,598 +17,598 @@ try: from faebryk.library.ANY import ANY -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.B4B_ZR_SM4_TF import B4B_ZR_SM4_TF -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.BH1750FVI_TR import BH1750FVI_TR -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.BJT import BJT -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.Battery import Battery -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.Button import Button -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.ButtonCell import ButtonCell -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.CBM9002A_56ILG import CBM9002A_56ILG -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.CBM9002A_56ILG_Reference_Design import CBM9002A_56ILG_Reference_Design -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.CD4011 import CD4011 -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.CH340x import CH340x -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.Capacitor import Capacitor -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.Common_Mode_Filter import Common_Mode_Filter -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.Comparator import Comparator -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.Constant import Constant -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.Crystal import Crystal -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.Crystal_Oscillator import Crystal_Oscillator -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.DIP import DIP -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.DifferentialPair import DifferentialPair -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.Diode import Diode -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.EEPROM import EEPROM -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.ESP32 import ESP32 -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.ESP32_C3 import ESP32_C3 -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.ESP32_C3_MINI_1 import ESP32_C3_MINI_1 -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.ESP32_C3_MINI_1_Reference_Design import ESP32_C3_MINI_1_Reference_Design -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.ElectricLogic import ElectricLogic -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.ElectricLogicGate import ElectricLogicGate -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.ElectricLogicGates import ElectricLogicGates -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.ElectricPower import ElectricPower -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.Electrical import Electrical -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.Ethernet import Ethernet -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.Fan import Fan -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.Footprint import Footprint -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.Fuse import Fuse -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.GDT import GDT -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.GenericBusProtection import GenericBusProtection -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.HLK_LD2410B_P import HLK_LD2410B_P -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.Header import Header -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.I2C import I2C -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.Inductor import Inductor -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.JTAG import JTAG -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.KicadFootprint import KicadFootprint -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.LDO import LDO -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.LED import LED -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.LEDIndicator import LEDIndicator -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.Logic import Logic -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.Logic74xx import Logic74xx -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.LogicGate import LogicGate -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.LogicGates import LogicGates -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.LogicOps import LogicOps -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.M24C08_FMN6TP import M24C08_FMN6TP -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.MCP2221A import MCP2221A -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.ME6211C33M5G_N import ME6211C33M5G_N -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.MOSFET import MOSFET -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.Mechanical import Mechanical -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.Mounting_Hole import Mounting_Hole -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.MultiSPI import MultiSPI -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.Net import Net -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.OLED_Module import OLED_Module -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.OpAmp import OpAmp -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.Operation import Operation -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.PJ398SM import PJ398SM -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.PM1006 import PM1006 -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.Pad import Pad -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.Potentiometer import Potentiometer -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.Power import Power -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.PowerSwitch import PowerSwitch -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.PowerSwitchMOSFET import PowerSwitchMOSFET -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.PowerSwitchStatic import PowerSwitchStatic -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.PoweredLED import PoweredLED -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.Powered_Relay import Powered_Relay -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.QFN import QFN -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.QWIIC import QWIIC -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.QWIIC_Connector import QWIIC_Connector -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.RJ45_Receptacle import RJ45_Receptacle -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.RP2040 import RP2040 -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.RP2040_Reference_Design import RP2040_Reference_Design -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.RS232 import RS232 -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.RS485 import RS485 -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.RS485_Bus_Protection import RS485_Bus_Protection -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.Range import Range -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.Relay import Relay -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.Resistor import Resistor -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.Resistor_Voltage_Divider import Resistor_Voltage_Divider -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.SCD40 import SCD40 -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.SK9822_EC20 import SK9822_EC20 -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.SMDTwoPin import SMDTwoPin -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.SNx4LVC541A import SNx4LVC541A -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.SOIC import SOIC -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.SPI import SPI -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.SPIFlash import SPIFlash -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.SWD import SWD -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.SWDConnector import SWDConnector -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.Sercom import Sercom -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.Set import Set -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.Switch import Switch -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.TBD import TBD -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.TD541S485H import TD541S485H -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.TI_CD4011BE import TI_CD4011BE -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.TVS import TVS -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.TXS0102DCUR import TXS0102DCUR -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.TXS0102DCUR_UART import TXS0102DCUR_UART -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.UART import UART -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.UART_Base import UART_Base -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.UART_RS485 import UART_RS485 -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.USB2514B import USB2514B -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.USB2_0 import USB2_0 -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.USB2_0_ESD_Protection import USB2_0_ESD_Protection -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.USB2_0_IF import USB2_0_IF -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.USB3 import USB3 -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.USB3_IF import USB3_IF -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.USB3_connector import USB3_connector -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.USBLC6_2P6 import USBLC6_2P6 -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.USB_C import USB_C -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.USB_C_5V_PSU import USB_C_5V_PSU -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.USB_C_PSU_Vertical import USB_C_PSU_Vertical -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.USB_C_PowerOnly import USB_C_PowerOnly -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.USB_RS485 import USB_RS485 -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.USB_Type_C_Receptacle_14_pin_Vertical import USB_Type_C_Receptacle_14_pin_Vertical -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.USB_Type_C_Receptacle_16_pin import USB_Type_C_Receptacle_16_pin -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.USB_Type_C_Receptacle_24_pin import USB_Type_C_Receptacle_24_pin -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.XL_3528RGBW_WS2812B import XL_3528RGBW_WS2812B -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.can_attach_to_footprint import can_attach_to_footprint -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.can_attach_to_footprint_symmetrically import can_attach_to_footprint_symmetrically -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.can_attach_to_footprint_via_pinmap import can_attach_to_footprint_via_pinmap -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.can_attach_via_pinmap import can_attach_via_pinmap -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.can_attach_via_pinmap_equal import can_attach_via_pinmap_equal -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.can_attach_via_pinmap_pinlist import can_attach_via_pinmap_pinlist -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.can_be_decoupled import can_be_decoupled -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.can_be_decoupled_defined import can_be_decoupled_defined -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.can_be_surge_protected import can_be_surge_protected -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.can_be_surge_protected_defined import can_be_surge_protected_defined -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.can_bridge import can_bridge -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.can_bridge_defined import can_bridge_defined -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.can_switch_power import can_switch_power -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.can_switch_power_defined import can_switch_power_defined -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.has_capacitance import has_capacitance -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.has_datasheet import has_datasheet -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.has_datasheet_defined import has_datasheet_defined -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.has_defined_capacitance import has_defined_capacitance -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.has_defined_descriptive_properties import has_defined_descriptive_properties -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.has_defined_kicad_ref import has_defined_kicad_ref -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.has_defined_resistance import has_defined_resistance -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.has_descriptive_properties import has_descriptive_properties -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.has_designator import has_designator -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.has_designator_defined import has_designator_defined -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.has_designator_prefix import has_designator_prefix -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.has_designator_prefix_defined import has_designator_prefix_defined -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.has_equal_pins import has_equal_pins -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.has_equal_pins_in_ifs import has_equal_pins_in_ifs -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.has_esphome_config import has_esphome_config -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.has_esphome_config_defined import has_esphome_config_defined -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.has_footprint import has_footprint -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.has_footprint_defined import has_footprint_defined -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.has_footprint_impl import has_footprint_impl -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.has_footprint_requirement import has_footprint_requirement -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.has_footprint_requirement_defined import has_footprint_requirement_defined -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.has_kicad_footprint import has_kicad_footprint -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.has_kicad_footprint_equal_ifs import has_kicad_footprint_equal_ifs -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.has_kicad_footprint_equal_ifs_defined import has_kicad_footprint_equal_ifs_defined -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.has_kicad_manual_footprint import has_kicad_manual_footprint -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.has_kicad_ref import has_kicad_ref -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.has_linked_pad import has_linked_pad -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.has_linked_pad_defined import has_linked_pad_defined -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.has_multi_picker import has_multi_picker -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.has_overriden_name import has_overriden_name -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.has_overriden_name_defined import has_overriden_name_defined -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.has_pcb_layout import has_pcb_layout -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.has_pcb_layout_defined import has_pcb_layout_defined -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.has_pcb_position import has_pcb_position -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.has_pcb_position_defined import has_pcb_position_defined -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.has_pcb_position_defined_relative import has_pcb_position_defined_relative -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.has_pcb_position_defined_relative_to_parent import has_pcb_position_defined_relative_to_parent -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.has_pcb_routing_strategy import has_pcb_routing_strategy -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.has_pcb_routing_strategy_greedy_direct_line import has_pcb_routing_strategy_greedy_direct_line -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.has_pcb_routing_strategy_manual import has_pcb_routing_strategy_manual -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.has_pcb_routing_strategy_via_to_layer import has_pcb_routing_strategy_via_to_layer -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.has_picker import has_picker -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.has_pin_association_heuristic import has_pin_association_heuristic -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.has_pin_association_heuristic_lookup_table import has_pin_association_heuristic_lookup_table -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.has_resistance import has_resistance -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.has_simple_value_representation import has_simple_value_representation -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.has_simple_value_representation_based_on_param import has_simple_value_representation_based_on_param -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.has_simple_value_representation_based_on_params import has_simple_value_representation_based_on_params -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.has_simple_value_representation_defined import has_simple_value_representation_defined -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.has_single_connection import has_single_connection -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.has_single_connection_impl import has_single_connection_impl -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.has_single_electric_reference import has_single_electric_reference -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.has_single_electric_reference_defined import has_single_electric_reference_defined -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.is_decoupled import is_decoupled -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.is_decoupled_nodes import is_decoupled_nodes -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.is_esphome_bus import is_esphome_bus -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.is_esphome_bus_defined import is_esphome_bus_defined -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.is_representable_by_single_value import is_representable_by_single_value -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.is_representable_by_single_value_defined import is_representable_by_single_value_defined -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.is_surge_protected import is_surge_protected -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.is_surge_protected_defined import is_surge_protected_defined -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.pf_533984002 import pf_533984002 -except AttributeError: ... +except (AttributeError, ImportError): ... try: from faebryk.library.pf_74AHCT2G125 import pf_74AHCT2G125 -except AttributeError: ... +except (AttributeError, ImportError): ... diff --git a/tools/library/gen_F.py b/tools/library/gen_F.py index 0b92f883..76a140b2 100755 --- a/tools/library/gen_F.py +++ b/tools/library/gen_F.py @@ -8,6 +8,7 @@ import logging import os from pathlib import Path +from typing import Iterable logger = logging.getLogger(__name__) @@ -43,9 +44,12 @@ def main(): logger.info(f"Found {len(modules_out)} classes") - def try_(stmt: str, exc: str | type[Exception]): + def try_(stmt: str, exc: str | type[Exception] | Iterable[type[Exception]]): if isinstance(exc, type): exc = exc.__name__ + if not isinstance(exc, str): + exc = f'({", ".join(e.__name__ for e in exc)})' + return f"try:\n {stmt}\nexcept {exc}: ..." OUT.write_text( @@ -67,7 +71,10 @@ def try_(stmt: str, exc: str | type[Exception]): "# flake8: noqa: E501\n" "\n" + "\n".join( - try_(f"from faebryk.library.{module} import {class_}", AttributeError) + try_( + f"from faebryk.library.{module} import {class_}", + (AttributeError, ImportError), + ) for module, class_ in sorted(modules_out.items(), key=lambda x: x[0]) ) + "\n"