-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable to define custom predicates on decisions
The patch enables to address the decision points of the generator. Having these addresses, custom model implementations have the power to redefine them according to the expected input format.
- Loading branch information
1 parent
3f7abef
commit fdffe7a
Showing
6 changed files
with
96 additions
and
68 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Copyright (c) 2020 Renata Hodovan, Akos Kiss. | ||
# | ||
# Licensed under the BSD 3-Clause License | ||
# <LICENSE.rst or https://opensource.org/licenses/BSD-3-Clause>. | ||
# This file may not be copied, modified, or distributed except | ||
# according to those terms. | ||
|
||
from .default_model import DefaultModel | ||
|
||
|
||
class DispatchingModel(DefaultModel): | ||
|
||
def choice(self, node, idx, choices): | ||
name = 'choice_' + node.name | ||
return (getattr(self, name) if hasattr(self, name) else super().choice)(node, idx, choices) | ||
|
||
def quantify(self, node, idx, min, max): | ||
name = 'quantify_' + node.name | ||
yield from (getattr(self, name) if hasattr(self, name) else super().quantify)(node, idx, min, max) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters