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

Commit

Permalink
Fix: recursion
Browse files Browse the repository at this point in the history
  • Loading branch information
ruben-iteng committed Sep 12, 2024
1 parent 49c35f1 commit 163faa5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/faebryk/library/ElectricLogic.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# This file is part of the faebryk project
# SPDX-License-Identifier: MIT

import sys
from abc import abstractmethod
from enum import Enum, auto
from typing import Iterable, Self
Expand Down Expand Up @@ -170,7 +171,12 @@ def connect_all_node_references(
F.Electrical.connect(*{r.lv for r in refs})
return next(iter(refs))

# TODO remove this workaround when we have lazy mifs
recursion_depth = sys.getrecursionlimit()
sys.setrecursionlimit(10000)
F.ElectricPower.connect(*refs)
sys.setrecursionlimit(recursion_depth)

return next(iter(refs))

@classmethod
Expand Down Expand Up @@ -215,3 +221,10 @@ def connect_shallow(
self.reference.lv.connect(other.reference.lv)

return super().connect_shallow(other)

def connect(self, *other: Self, linkcls=None):
recursion_depth = sys.getrecursionlimit()
sys.setrecursionlimit(10000)
ret = super().connect(*other, linkcls=linkcls)
sys.setrecursionlimit(recursion_depth)
return ret
3 changes: 3 additions & 0 deletions src/faebryk/library/PowerSwitchStatic.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# This file is part of the faebryk project
# SPDX-License-Identifier: MIT
import faebryk.library._F as F
from faebryk.libs.picker.picker import has_part_picked_remove


class PowerSwitchStatic(F.PowerSwitch):
Expand All @@ -10,6 +11,8 @@ class PowerSwitchStatic(F.PowerSwitch):
This is useful when transforming an F.ElectricLogic to an F.ElectricPower
"""

picked: has_part_picked_remove

def __init__(self) -> None:
super().__init__(normally_closed=False)

Expand Down

0 comments on commit 163faa5

Please sign in to comment.