From 810da4dfdb0096cf85aac543a7f97f13508b53ad Mon Sep 17 00:00:00 2001 From: Fransman Date: Sun, 7 Jun 2020 10:15:50 +0200 Subject: [PATCH] FIX: slice operation for source files of relation --- pydcop/dcop/relations.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pydcop/dcop/relations.py b/pydcop/dcop/relations.py index a0a57178..0cf81c02 100644 --- a/pydcop/dcop/relations.py +++ b/pydcop/dcop/relations.py @@ -580,6 +580,11 @@ def slice(self, partial_assignment: Dict[str, object]) -> RelationProtocol: else: slice_f = functools.partial(self._f, **slicing_dict) + # Check if there is a source file for the relation defined + if 'source' in self._f.exp_func.__globals__: + # Add the source object + slice_f.exp_func.__globals__['source'] = self._f.exp_func.__globals__['source'] + return NAryFunctionRelation(slice_f, remaining_vars, name=self.name) def set_value_for_assignment(self, assignment, relation_value):