-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Implement Parameter<usize> for PyParameter. (#137)
This supports using PyParameter as an index parameter with updated schema to define the return type of the Python method. Some minor related docs improvements.
- Loading branch information
Showing
4 changed files
with
163 additions
and
86 deletions.
There are no files selected for viewing
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,20 @@ | ||
class FloatParameter: | ||
"""A simple float parameter""" | ||
|
||
def __init__(self, count, *args, **kwargs): | ||
self.count = 0 | ||
|
||
def calc(self, ts, si, p_values) -> float: | ||
self.count += si | ||
return float(self.count + ts.day) | ||
|
||
|
||
class IntParameter: | ||
"""A simple int parameter""" | ||
|
||
def __init__(self, count, *args, **kwargs): | ||
self.count = 0 | ||
|
||
def calc(self, ts, si, p_values) -> int: | ||
self.count += si | ||
return self.count + ts.day |