Skip to content

Commit

Permalink
Remove useless code
Browse files Browse the repository at this point in the history
  • Loading branch information
tbittar committed Aug 21, 2024
1 parent fd660d9 commit 620364e
Show file tree
Hide file tree
Showing 11 changed files with 154 additions and 1,392 deletions.
37 changes: 12 additions & 25 deletions src/andromede/expression/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,41 +12,28 @@

from .copy import CopyVisitor, copy_expression
from .degree import ExpressionDegreeVisitor, compute_degree
from .evaluate import EvaluationContext, EvaluationVisitor, ValueProvider, evaluate
from .evaluate_parameters import (
ParameterResolver,
ParameterValueProvider,
resolve_parameters,
)

from .expression import (
# AdditionNode,
# Comparator,
# ComparisonNode,
# DivisionNode,
ExpressionNode,
# LiteralNode,
# MultiplicationNode,
# NegationNode,
# ParameterNode,
# SubstractionNode,
VariableNode,
literal,
param,
sum_expressions,
var,
)
from .evaluate_parameters_efficient import ValueProvider
from .expression_efficient import (
AdditionNode,
Comparator,
ComparisonNode,
ComponentParameterNode,
DivisionNode,
ExpressionNodeEfficient,
ExpressionRange,
InstancesTimeIndex,
LiteralNode,
MultiplicationNode,
NegationNode,
ParameterNode,
PortFieldAggregatorNode,
PortFieldNode,
ScenarioOperatorName,
ScenarioOperatorNode,
SubstractionNode,
TimeAggregatorName,
TimeAggregatorNode,
TimeOperatorName,
TimeOperatorNode,
)
from .print import PrinterVisitor, print_expr
from .visitor import ExpressionVisitor, visit
10 changes: 0 additions & 10 deletions src/andromede/expression/evaluate.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
from dataclasses import dataclass, field
from typing import Dict

from andromede.expression.expression import VariableNode
from andromede.expression.expression_efficient import (
ComparisonNode,
ComponentParameterNode,
Expand Down Expand Up @@ -93,18 +92,12 @@ def literal(self, node: LiteralNode) -> float:
def comparison(self, node: ComparisonNode) -> float:
raise ValueError("Cannot evaluate comparison operator.")

def variable(self, node: VariableNode) -> float:
return self.context.get_variable_value(node.name)

def parameter(self, node: ParameterNode) -> float:
return self.context.get_parameter_value(node.name)

def comp_parameter(self, node: ComponentParameterNode) -> float:
return self.context.get_component_parameter_value(node.component_id, node.name)

# def comp_variable(self, node: ComponentVariableNode) -> float:
# return self.context.get_component_variable_value(node.component_id, node.name)

def time_operator(self, node: TimeOperatorNode) -> float:
raise NotImplementedError()

Expand Down Expand Up @@ -133,9 +126,6 @@ class InstancesIndexVisitor(EvaluationVisitor):
Evaluates an expression given as instances index which should have no variable and constant parameter values.
"""

def variable(self, node: VariableNode) -> float:
raise ValueError("An instance index expression cannot contain variable")

def parameter(self, node: ParameterNode) -> float:
if not self.context.parameter_is_constant_over_time(node.name):
raise ValueError(
Expand Down
99 changes: 0 additions & 99 deletions src/andromede/expression/evaluate_parameters.py

This file was deleted.

Loading

0 comments on commit 620364e

Please sign in to comment.