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

Commit

Permalink
Remove _on_connect
Browse files Browse the repository at this point in the history
  • Loading branch information
iopapamanoglou committed Nov 8, 2024
1 parent 695c218 commit d5ff64b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 16 deletions.
3 changes: 2 additions & 1 deletion src/faebryk/core/cpp/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ PYMOD(m) {
m.def("set_leak_warnings", &nb::set_leak_warnings, "value"_a);
m.def("print_obj", &print_obj, "obj"_a);

m.def("find_paths", &find_paths, "src"_a, "dst"_a);
// TODO why this rv_pol needed
m.def("find_paths", &find_paths, "src"_a, "dst"_a, nb::rv_policy::reference);

// Graph
using GI = GraphInterface;
Expand Down
2 changes: 1 addition & 1 deletion src/faebryk/core/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import logging
from typing import TYPE_CHECKING, Callable, Iterable

from faebryk.core.moduleinterface import GraphInterfaceModuleSibling
from faebryk.core.cpp import GraphInterfaceModuleSibling
from faebryk.core.node import Node, NodeException, f_field
from faebryk.core.trait import Trait
from faebryk.libs.util import cast_assert, unique_ref
Expand Down
16 changes: 2 additions & 14 deletions src/faebryk/core/moduleinterface.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
cast,
)

from deprecated import deprecated
from typing_extensions import Self

from faebryk.core.cpp import (
Expand Down Expand Up @@ -65,11 +64,6 @@ def __init__(self):

def __preinit__(self) -> None: ...

@deprecated("Isn't called anymore. Use parameter.is_dynamic")
def _on_connect(self, other: "ModuleInterface"):
"""override to handle custom connection logic"""
...

def connect(self: Self, *other: Self, linkcls=None) -> Self:
if not {type(o) for o in other}.issubset({type(self)}):
raise NodeException(
Expand Down Expand Up @@ -142,13 +136,7 @@ def specialize[T: ModuleInterface](self, special: T) -> T:
# return None

def __init_subclass__(cls, *, init: bool = True) -> None:
if cls._on_connect is not ModuleInterface._on_connect:
logger.warning(
f"ModuleInterface subclass {cls} has custom _on_connect method"
)
# TODO raise
# raise TypeError(
# "Overriding _on_connect is deprecated"
# )
if hasattr(cls, "_on_connect"):
raise TypeError("Overriding _on_connect is deprecated")

return super().__init_subclass__(init=init)

0 comments on commit d5ff64b

Please sign in to comment.