-
Notifications
You must be signed in to change notification settings - Fork 4
Implement Max operator #116
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
base: main
Are you sure you want to change the base?
Conversation
grammar/Expr.g4
Outdated
| | IDENTIFIER '[' expr ']' # timeIndex | ||
| | '(' expr ')' '[' shift ']' # timeShiftExpr | ||
| | '(' expr ')' '[' expr ']' # timeIndexExpr | ||
| | 'max' '(' expr (',' expr)* ')' # maxExpr |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be MAX here, no ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It depends, we want MAX or max as operand?
src/gems/expression/copy.py
Outdated
|
|
||
| @dataclass(frozen=True) | ||
| class CopyVisitor(ExpressionVisitorOperations[ExpressionNode]): | ||
| class CopyVisitor(ExpressionVisitorOperations[ExpressionNode]): # type: ignore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you need #type : ignore ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it depends with what ExpressionVisitorOperations returns. If it returns ExpressionNode, it is ok, if it returns T, we need to ignore
| def port_field_aggregator(self, node: PortFieldAggregatorNode) -> float: | ||
| raise NotImplementedError() | ||
|
|
||
| def max_node(self, node: MaxNode) -> float: # type: ignore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you need type : ignore ?
src/gems/expression/visitor.py
Outdated
| """ | ||
| import typing | ||
|
|
||
| from typing import cast |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is it used for ?
| return left_value / right_value | ||
|
|
||
| def max_node(self, node: MaxNode) -> ExpressionNode: # type: ignore | ||
| return MaxNode(operands=[visit(op, self) for op in node.operands]) # type: ignore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again why type: ignore ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because it returns ExpressionNode, wich is not homogene with ExpressionVisitor abstract method and the visit method
No description provided.