Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
finam
Manage
Activity
Members
Labels
Plan
Issues
31
Issue boards
Milestones
Code
Merge requests
3
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
FINAM
finam
Commits
6f3b8395
Commit
6f3b8395
authored
2 years ago
by
Martin Lange
Browse files
Options
Downloads
Patches
Plain Diff
add a check for rule types
parent
4233e807
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!154
Auto-transfer infos
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/finam/sdk/component.py
+1
-1
1 addition, 1 deletion
src/finam/sdk/component.py
src/finam/tools/connect_helper.py
+14
-7
14 additions, 7 deletions
src/finam/tools/connect_helper.py
tests/tools/test_connect.py
+8
-0
8 additions, 0 deletions
tests/tools/test_connect.py
with
23 additions
and
8 deletions
src/finam/sdk/component.py
+
1
−
1
View file @
6f3b8395
...
...
@@ -281,7 +281,7 @@ class Component(IComponent, Loggable, ABC):
}
)
The :class:`.Info` object for output ``Out`` will be crated and pushed automatically in :meth:`.try_connect`
The :class:`.Info` object for output ``Out`` will be cr
e
ated and pushed automatically in :meth:`.try_connect`
as soon as the metadata for ``In`` becomes available.
Here, the metadata of an output is composed from the metadata of two inputs and a user-defined value:
...
...
This diff is collapsed.
Click to expand it.
src/finam/tools/connect_helper.py
+
14
−
7
View file @
6f3b8395
...
...
@@ -174,13 +174,20 @@ class ConnectHelper(Loggable):
self
.
_check_rule
(
rule
)
def
_check_rule
(
self
,
rule
):
if
isinstance
(
rule
,
FromInput
)
and
rule
.
name
not
in
self
.
_inputs
:
raise
KeyError
(
f
"
No input named
'
{
rule
.
name
}
'
to use in info transfer rule.
"
)
if
isinstance
(
rule
,
FromOutput
)
and
rule
.
name
not
in
self
.
_outputs
:
raise
KeyError
(
f
"
No output named
'
{
rule
.
name
}
'
to use in info transfer rule.
"
if
isinstance
(
rule
,
FromInput
):
if
rule
.
name
not
in
self
.
_inputs
:
raise
KeyError
(
f
"
No input named
'
{
rule
.
name
}
'
to use in info transfer rule.
"
)
elif
isinstance
(
rule
,
FromOutput
):
if
rule
.
name
not
in
self
.
_outputs
:
raise
KeyError
(
f
"
No output named
'
{
rule
.
name
}
'
to use in info transfer rule.
"
)
elif
not
isinstance
(
rule
,
FromValue
):
raise
TypeError
(
f
"
Rules must be one of the types FromInput, FromOutput or FromValue.
"
f
"
Got
'
{
rule
.
__class__
.
__name__
}
'
.
"
)
@property
...
...
This diff is collapsed.
Click to expand it.
tests/tools/test_connect.py
+
8
−
0
View file @
6f3b8395
...
...
@@ -358,3 +358,11 @@ class TestConnectHelper(unittest.TestCase):
outputs
,
in_info_rules
=
{
"
In1
"
:
[
FromOutput
(
"
OutX
"
,
"
grid
"
)]},
)
with
self
.
assertRaises
(
TypeError
):
_connector
:
ConnectHelper
=
ConnectHelper
(
"
TestLogger
"
,
inputs
,
outputs
,
in_info_rules
=
{
"
In1
"
:
[
0
]},
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment