Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] canvas: Fix proposed connection scoring for dynamic signals #2431

Merged
merged 1 commit into from
Jun 23, 2017
Merged
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
12 changes: 10 additions & 2 deletions Orange/canvas/scheme/scheme.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from .link import SchemeLink, compatible_channels
from .annotations import BaseSchemeAnnotation

from ..utils import check_arg, check_type
from ..utils import check_arg, check_type, name_lookup

from .errors import (
SchemeCycleError, IncompatibleChannelTypeError, SinkChannelError,
Expand Down Expand Up @@ -541,11 +541,19 @@ def propose_links(self, source_node, sink_node):
if link.sink_channel.single]

def weight(out_c, in_c):
# type: (OutputSignal, InputSignal) -> int
if out_c.explicit or in_c.explicit:
# Zero weight for explicit links
weight = 0
else:
check = [not out_c.dynamic, # Dynamic signals are last
# Does the connection type check (can only ever be False for
# dynamic signals)
type_checks = issubclass(name_lookup(out_c.type),
name_lookup(in_c.type))
assert type_checks or out_c.dynamic
# Dynamic signals that require runtime instance type check
# are considered last.
check = [type_checks,
in_c not in already_connected_sinks,
bool(in_c.default),
bool(out_c.default)
Expand Down