Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion edg/BoardTop.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

class BaseBoardTop(DesignTop):
"""Design top with refinements for intermediate-level (0603+ SMD), hand-solderable components."""
@init_in_parent
def __init__(self):
super().__init__()
self.refdes_prefix = self.Parameter(StringExpr())
Expand Down
1 change: 0 additions & 1 deletion edg/abstract_parts/AbstractAnalogSwitch.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ def __init__(self) -> None:
class AnalogSwitchTree(AnalogSwitch, GeneratorBlock):
"""Generates an n-ported analog switch by creating a tree of individual, smaller switches.
Parameterized by the size of the element switches."""
@init_in_parent
def __init__(self, switch_size: IntLike = 0):
super().__init__()
self.switch_size = self.ArgParameter(switch_size)
Expand Down
2 changes: 0 additions & 2 deletions edg/abstract_parts/AbstractAntenna.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

@abstract_block
class Antenna(Interface, Block):
@init_in_parent
def __init__(self, frequency: RangeLike, impedance: RangeLike = Range.all(), power: RangeLike = (0, 0)*Watt):
super().__init__()

Expand All @@ -31,7 +30,6 @@ class TableAntenna(Antenna, PartsTableSelector, GeneratorBlock):
IMPEDANCE = PartsTableColumn(Range)
POWER_RATING = PartsTableColumn(Range)

@init_in_parent
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.generator_param(self.frequency, self.power, self.impedance)
Expand Down
2 changes: 0 additions & 2 deletions edg/abstract_parts/AbstractBjt.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ def Npn(*args, **kwargs) -> 'Bjt':
def Pnp(*args, **kwargs) -> 'Bjt':
return Bjt(*args, **kwargs, channel='PNP')

@init_in_parent
def __init__(self, collector_voltage: RangeLike, collector_current: RangeLike, *,
gain: RangeLike = Range.all(), power: RangeLike = Range.exact(0),
channel: StringLike = StringExpr()) -> None:
Expand Down Expand Up @@ -91,7 +90,6 @@ class TableBjt(PartsTableSelector, Bjt):
POWER_RATING = PartsTableColumn(Range)
CHANNEL = PartsTableColumn(str) # either 'PNP' or 'NPN'

@init_in_parent
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.generator_param(self.collector_voltage, self.collector_current, self.gain, self.power, self.channel)
Expand Down
12 changes: 3 additions & 9 deletions edg/abstract_parts/AbstractCapacitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ class CapacitorStandardFootprint(StandardFootprint['Capacitor']):
@abstract_block
class UnpolarizedCapacitor(PassiveComponent):
"""Base type for a capacitor, that defines its parameters and without ports (since capacitors can be polarized)"""
@init_in_parent
def __init__(self, capacitance: RangeLike, voltage: RangeLike, *,
voltage_rating_derating: FloatLike = 0.5,
exact_capacitance: BoolLike = False) -> None:
Expand Down Expand Up @@ -150,7 +149,6 @@ def parse_capacitor(cls, value: str) -> Tuple[Range, Range]:
def block_from_symbol(cls, symbol_name: str, properties: Mapping[str, str]) -> 'Capacitor':
return Capacitor(*cls.parse_capacitor(properties['Value']))

@init_in_parent
def __init__(self, *args, **kwargs) -> None:
super().__init__(*args, **kwargs)

Expand Down Expand Up @@ -178,7 +176,6 @@ class TableCapacitor(PartsTableSelector, Capacitor):
NOMINAL_CAPACITANCE = PartsTableColumn(float) # nominal capacitance, even with asymmetrical tolerances
VOLTAGE_RATING = PartsTableColumn(Range)

@init_in_parent
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.generator_param(self.capacitance, self.voltage, self.voltage_rating_derating, self.exact_capacitance)
Expand Down Expand Up @@ -220,7 +217,6 @@ class TableDeratingCapacitor(TableCapacitor):
DERATE_LOWEST = 0.2 # floor for maximum derating factor
# LOOSELY approximated from https://www.maximintegrated.com/en/design/technical-documents/tutorials/5/5527.html

@init_in_parent
def __init__(self, *args, single_nominal_capacitance: RangeLike = (0, 22)*uFarad, **kwargs):
super().__init__(*args, **kwargs)
self.single_nominal_capacitance = self.ArgParameter(single_nominal_capacitance)
Expand Down Expand Up @@ -292,7 +288,6 @@ class DummyCapacitorFootprint(DummyDevice, Capacitor, FootprintBlock):

TODO: use footprint table?
"""
@init_in_parent
def __init__(self, footprint: StringLike = "", manufacturer: StringLike = "", part_number: StringLike = "",
value: StringLike = "",
*args, **kwargs):
Expand All @@ -316,7 +311,6 @@ def symbol_pinning(self, symbol_name: str) -> Dict[str, BasePort]:
assert symbol_name in ('Device:C', 'Device:C_Small', 'Device:C_Polarized', 'Device:C_Polarized_Small')
return {'1': self.pwr, '2': self.gnd}

@init_in_parent
def __init__(self, capacitance: RangeLike, *, exact_capacitance: BoolLike = False) -> None:
super().__init__()

Expand All @@ -342,7 +336,7 @@ def connected(self, gnd: Optional[Port[GroundLink]] = None, pwr: Optional[Port[V
return self


class CombinedCapacitorElement(Capacitor): # to avoid an abstract part error
class CombinedCapacitorElement(Capacitor):
def contents(self):
super().contents()
self.assign(self.actual_capacitance, self.capacitance) # fake it, since a combined capacitance is handwavey
Expand All @@ -351,11 +345,11 @@ def contents(self):
class CombinedCapacitor(MultipackDevice, MultipackBlock, GeneratorBlock):
"""A packed capacitor that combines multiple individual capacitors into a single component,
with the sum of or taking the max of the constituent capacitances."""
@init_in_parent
def __init__(self, *, extend_upper: BoolLike = False) -> None:
super().__init__()

self.elements = self.PackedPart(PackedBlockArray(CombinedCapacitorElement()))
self.elements = self.PackedPart(PackedBlockArray(CombinedCapacitorElement(capacitance=RangeExpr(),
voltage=RangeExpr())))
Comment on lines +351 to +352
Copy link

Copilot AI Nov 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CombinedCapacitorElement is being instantiated with RangeExpr() for capacitance and voltage parameters. With the new metaclass approach, these should be passed as unbound parameters (no arguments), not empty RangeExpr() instances. This may cause issues since the metaclass expects to transform the arguments. Consider removing the explicit RangeExpr() calls or ensuring they are properly handled by the new metaclass.

Suggested change
self.elements = self.PackedPart(PackedBlockArray(CombinedCapacitorElement(capacitance=RangeExpr(),
voltage=RangeExpr())))
self.elements = self.PackedPart(PackedBlockArray(CombinedCapacitorElement(capacitance=RangeExpr,
voltage=RangeExpr)))

Copilot uses AI. Check for mistakes.
self.pos = self.PackedExport(self.elements.ports_array(lambda x: x.pos))
self.neg = self.PackedExport(self.elements.ports_array(lambda x: x.neg))
self.capacitances = self.PackedParameter(self.elements.params_array(lambda x: x.capacitance))
Expand Down
1 change: 0 additions & 1 deletion edg/abstract_parts/AbstractComparator.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ def symbol_pinning(self, symbol_name: str) -> Mapping[str, BasePort]:
def block_from_symbol(cls, symbol_name: str, properties: Mapping[str, str]) -> 'Comparator':
return Comparator()

@init_in_parent
def __init__(self) -> None:
super().__init__()

Expand Down
1 change: 0 additions & 1 deletion edg/abstract_parts/AbstractConnector.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ def __init__(self) -> None:

class RfConnectorTestPoint(BlockInterfaceMixin[RfConnector]):
"""Test point mixin that allows the footprint to take a name"""
@init_in_parent
def __init__(self, name: StringLike):
super().__init__()
self.tp_name = self.ArgParameter(name)
Expand Down
3 changes: 0 additions & 3 deletions edg/abstract_parts/AbstractCrystal.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ class CrystalStandardFootprint(StandardFootprint['Crystal']):
class Crystal(DiscreteComponent, HasStandardFootprint):
_STANDARD_FOOTPRINT = CrystalStandardFootprint

@init_in_parent
def __init__(self, frequency: RangeLike) -> None:
"""Discrete crystal component."""
super().__init__()
Expand All @@ -60,7 +59,6 @@ class TableCrystal(PartsTableSelector, Crystal):
FREQUENCY = PartsTableColumn(Range)
CAPACITANCE = PartsTableColumn(float)

@init_in_parent
def __init__(self, *args, **kwargs) -> None:
"""Discrete crystal component."""
super().__init__(*args, **kwargs)
Expand All @@ -78,7 +76,6 @@ def _row_generate(self, row: PartsTableRow) -> None:

@abstract_block_default(lambda: OscillatorCrystal)
class OscillatorReference(DiscreteApplication):
@init_in_parent
def __init__(self, frequency: RangeLike) -> None:
"""Crystal and supporting circuitry to connect it to an oscillator driver.
Should include load capacitors."""
Expand Down
1 change: 0 additions & 1 deletion edg/abstract_parts/AbstractDevices.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

@abstract_block
class Battery(PowerSource):
@init_in_parent
def __init__(self, voltage: RangeLike,
current: RangeLike = RangeExpr.ZERO, *,
capacity: FloatLike = 0.0):
Expand Down
7 changes: 0 additions & 7 deletions edg/abstract_parts/AbstractDiodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ class BaseDiode(DiscreteSemiconductor, HasStandardFootprint):
"""
_STANDARD_FOOTPRINT = DiodeStandardFootprint

@init_in_parent
def __init__(self) -> None:
super().__init__()

Expand All @@ -59,7 +58,6 @@ def symbol_pinning(self, symbol_name: str) -> Dict[str, BasePort]:
assert symbol_name in ('Device:D', 'Device:D_Small')
return {'A': self.anode, 'K': self.cathode}

@init_in_parent
def __init__(self, reverse_voltage: RangeLike, current: RangeLike, *,
voltage_drop: RangeLike = Range.all(),
reverse_recovery_time: RangeLike = Range.all()) -> None:
Expand Down Expand Up @@ -95,7 +93,6 @@ class TableDiode(PartsTableSelector, Diode):
FORWARD_VOLTAGE = PartsTableColumn(Range) # possible forward voltage range
REVERSE_RECOVERY = PartsTableColumn(Range) # possible reverse recovery time

@init_in_parent
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.generator_param(self.reverse_voltage, self.current, self.voltage_drop, self.reverse_recovery_time)
Expand Down Expand Up @@ -125,7 +122,6 @@ def symbol_pinning(self, symbol_name: str) -> Dict[str, BasePort]:
assert symbol_name in ('Device:D_Zener', 'Device:D_Zener_Small')
return {'A': self.anode, 'K': self.cathode}

@init_in_parent
def __init__(self, zener_voltage: RangeLike) -> None:
super().__init__()

Expand All @@ -149,7 +145,6 @@ class TableZenerDiode(PartsTableSelector, ZenerDiode):
ZENER_VOLTAGE = PartsTableColumn(Range)
POWER_RATING = PartsTableColumn(Range) # tolerable power

@init_in_parent
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.generator_param(self.zener_voltage)
Expand All @@ -167,7 +162,6 @@ def _row_generate(self, row: PartsTableRow) -> None:
class ProtectionZenerDiode(Protection):
"""Zener diode reversed across a power rail to provide transient overvoltage protection (and become an incandescent
indicator on a reverse voltage)"""
@init_in_parent
def __init__(self, voltage: RangeLike):
super().__init__()

Expand All @@ -188,7 +182,6 @@ def contents(self):
@deprecated("Use AnalogClampResistor, which should be cheaper and cause less signal distortion")
class AnalogClampZenerDiode(Protection, KiCadImportableBlock):
"""Analog overvoltage protection diode to clamp the input voltage"""
@init_in_parent
def __init__(self, voltage: RangeLike):
super().__init__()

Expand Down
3 changes: 0 additions & 3 deletions edg/abstract_parts/AbstractFerriteBead.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ def symbol_pinning(self, symbol_name: str) -> Dict[str, BasePort]:
assert symbol_name in ('Device:L_Ferrite', 'Device:L_Ferrite_Small')
return {'1': self.a, '2': self.b}

@init_in_parent
def __init__(self, *, current: RangeLike = RangeExpr.ZERO,
hf_impedance: RangeLike = RangeExpr.ALL,
dc_resistance: RangeLike = RangeExpr.ALL) -> None:
Expand Down Expand Up @@ -73,7 +72,6 @@ class TableFerriteBead(PartsTableSelector, FerriteBead):
HF_IMPEDANCE = PartsTableColumn(Range)
DC_RESISTANCE = PartsTableColumn(Range)

@init_in_parent
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.generator_param(self.current, self.hf_impedance, self.dc_resistance)
Expand All @@ -97,7 +95,6 @@ def symbol_pinning(self, symbol_name: str) -> Dict[str, BasePort]:
assert symbol_name in ('Device:L_Ferrite', 'Device:L_Ferrite_Small')
return {'1': self.pwr_in, '2': self.pwr_out}

@init_in_parent
def __init__(self, hf_impedance: RangeLike = RangeExpr.ALL,
dc_resistance: RangeLike = RangeExpr.ALL) -> None:
super().__init__()
Expand Down
4 changes: 0 additions & 4 deletions edg/abstract_parts/AbstractFets.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ def NFet(*args, **kwargs) -> 'Fet':
def PFet(*args, **kwargs) -> 'Fet':
return Fet(*args, **kwargs, channel='P')

@init_in_parent
def __init__(self, drain_voltage: RangeLike, drain_current: RangeLike, *,
gate_voltage: RangeLike = (0, 0), gate_threshold_voltage: RangeLike = Range.all(),
rds_on: RangeLike = Range.all(),
Expand Down Expand Up @@ -150,7 +149,6 @@ class BaseTableFet(Fet):

@non_library
class TableFet(PartsTableSelector, BaseTableFet):
@init_in_parent
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.generator_param(self.drain_voltage, self.drain_current, self.gate_voltage, self.gate_threshold_voltage,
Expand Down Expand Up @@ -195,7 +193,6 @@ def PFet(*args, **kwargs):
return SwitchFet(*args, **kwargs, channel='P')


@init_in_parent
def __init__(self, *, frequency: RangeLike = 0*Hertz(tol=0), drive_current: RangeLike = Range.all(), **kwargs) -> None:
super().__init__(**kwargs)

Expand All @@ -209,7 +206,6 @@ class TableSwitchFet(PartsTableSelector, SwitchFet, BaseTableFet):
STATIC_POWER = PartsTableColumn(Range)
TOTAL_POWER = PartsTableColumn(Range)

@init_in_parent
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.generator_param(self.frequency, self.drain_voltage, self.drain_current,
Expand Down
3 changes: 0 additions & 3 deletions edg/abstract_parts/AbstractFuse.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ class FuseStandardFootprint(StandardFootprint['Fuse']):
class Fuse(DiscreteComponent, HasStandardFootprint):
_STANDARD_FOOTPRINT = FuseStandardFootprint

@init_in_parent
def __init__(self, trip_current: RangeLike, *, hold_current: RangeLike = RangeExpr.ALL,
voltage: RangeLike = RangeExpr.ZERO) -> None:
"""Model-wise, equivalent to a VoltageSource|Sink passthrough, with a trip rating."""
Expand Down Expand Up @@ -74,7 +73,6 @@ class SeriesPowerFuse(Protection):
"""Series fuse for power applications"""
FUSE_TYPE = Fuse

@init_in_parent
def __init__(self, trip_current: RangeLike) -> None:
super().__init__()

Expand Down Expand Up @@ -116,7 +114,6 @@ class TableFuse(PartsTableSelector, Fuse):
HOLD_CURRENT = PartsTableColumn(Range)
VOLTAGE_RATING = PartsTableColumn(Range)

@init_in_parent
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.generator_param(self.trip_current, self.hold_current, self.voltage)
Expand Down
3 changes: 0 additions & 3 deletions edg/abstract_parts/AbstractInductor.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ def symbol_pinning(self, symbol_name: str) -> Dict[str, BasePort]:
assert symbol_name in ('Device:L', 'Device:L_Small')
return {'1': self.a, '2': self.b}

@init_in_parent
def __init__(self, inductance: RangeLike,
current: RangeLike = RangeExpr.ZERO,
frequency: RangeLike = RangeExpr.ZERO,
Expand Down Expand Up @@ -136,7 +135,6 @@ class TableInductor(PartsTableSelector, Inductor):
CURRENT_RATING = PartsTableColumn(Range) # tolerable current
DC_RESISTANCE = PartsTableColumn(Range) # actual DCR

@init_in_parent
def __init__(self, *args, **kwargs) -> None:
super().__init__(*args, **kwargs)
self.generator_param(self.inductance, self.current, self.frequency, self.resistance_dc,
Expand Down Expand Up @@ -170,7 +168,6 @@ def _row_sort_by(cls, row: PartsTableRow) -> Any:

class SeriesPowerInductor(DiscreteApplication):
"""VoltageSource/Sink-typed series inductor for power filtering"""
@init_in_parent
def __init__(self, inductance: RangeLike, current: RangeLike = RangeExpr.ZERO,
frequency: RangeLike = RangeExpr.ZERO) -> None:
super().__init__()
Expand Down
9 changes: 0 additions & 9 deletions edg/abstract_parts/AbstractLed.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ class Led(DiscreteSemiconductor, HasStandardFootprint):
Orange: LedColor = "orange"
Any: LedColor = ""

@init_in_parent
def __init__(self, color: LedColorLike = Any):
super().__init__()

Expand All @@ -55,7 +54,6 @@ def __init__(self, color: LedColorLike = Any):
class TableLed(PartsTableSelector, Led):
COLOR = PartsTableColumn(str)

@init_in_parent
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.generator_param(self.color)
Expand Down Expand Up @@ -83,7 +81,6 @@ def __init__(self):
# TODO should there be some kind of abstract LED class, that works for both high and low side?
class IndicatorLed(Light):
"""High-side-driven (default, "common cathode") indicator LED"""
@init_in_parent
def __init__(self, color: LedColorLike = Led.Any, *, current_draw: RangeLike = (1, 10)*mAmp) -> None:
"""Controlled LEDs, with provisions for both current source and sink configurations.
signal_in is a constant-voltage digital source, so this must contain some ballast.
Expand Down Expand Up @@ -115,7 +112,6 @@ def __init__(self, color: LedColorLike = Led.Any, *, current_draw: RangeLike = (

class IndicatorLedArray(Light, GeneratorBlock):
"""An array of IndicatorLed, just a convenience wrapper."""
@init_in_parent
def __init__(self, count: IntLike, color: LedColorLike = Led.Any, *,
current_draw: RangeLike = (1, 10) * mAmp):
super().__init__()
Expand All @@ -139,7 +135,6 @@ def generate(self):
@abstract_block
class IndicatorSinkLed(Light, Block):
"""Abstract part for an low-side-driven ("common anode") indicator LED"""
@init_in_parent
def __init__(self, color: LedColorLike = Led.Any, *, current_draw: RangeLike = (1, 10)*mAmp) -> None:
"""Controlled LEDs, with provisions for both current source and sink configurations.
signal_in is a constant-voltage digital source, so this must contain some ballast.
Expand All @@ -155,7 +150,6 @@ def __init__(self, color: LedColorLike = Led.Any, *, current_draw: RangeLike = (

class IndicatorSinkLedResistor(IndicatorSinkLed):
"""TODO: should the resistor sided-ness be configurable, eg as a generator? Similar for IndicatorLed"""
@init_in_parent
def __init__(self, *args, **kwargs) -> None:
super().__init__(*args, **kwargs)

Expand All @@ -178,7 +172,6 @@ def __init__(self, *args, **kwargs) -> None:

class IndicatorSinkLedArray(Light, GeneratorBlock):
"""An array of IndicatorSinkLed, just a convenience wrapper."""
@init_in_parent
def __init__(self, count: IntLike, color: LedColorLike = Led.Any, *,
current_draw: RangeLike = (1, 10) * mAmp):
super().__init__()
Expand All @@ -201,7 +194,6 @@ def generate(self):

class VoltageIndicatorLed(Light):
"""LED connected to a voltage rail as an indicator that there is voltage present"""
@init_in_parent
def __init__(self, color: LedColorLike = Led.Any, *, current_draw: RangeLike = (1, 10)*mAmp) -> None:
"""
TODO: support non single color wavelength (eg, color temperature?)
Expand Down Expand Up @@ -231,7 +223,6 @@ def __init__(self, color: LedColorLike = Led.Any, *, current_draw: RangeLike = (
# TODO should there be some kind of abstract LED class, that works for both CA and CC type LEDs?
class IndicatorSinkRgbLed(Light):
"""Common anode indicator RGB LED"""
@init_in_parent
def __init__(self, current_draw: RangeLike = (1, 10)*mAmp) -> None:
"""RGB LEDs, with provisions for both common-anode and common-cathode configurations.
This should not contain amplifiers."""
Expand Down
Loading
Loading