Skip to content

Commit

Permalink
fix logic updated by black
Browse files Browse the repository at this point in the history
  • Loading branch information
longshuicy committed Oct 23, 2024
1 parent 2d16aca commit b2a1da4
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion pyincore/utils/datasetutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ def _apply_retrofit_value(row):
)
else None
)
_ = (
type = (
row["config_mappingEntryKey"]["type"]
if (
"config_mappingEntryKey" in row.index
Expand All @@ -164,6 +164,14 @@ def _apply_retrofit_value(row):

if target_column and expression:
if target_column in row.index:
# Don't delete this line. Retrofit value is calculated based on the expression and will be
# used in the later eval
retrofit_value = ( # noqa: F841
float(row["retrofit_value"])
if type == "number"
else row["retrofit_value"]
)

# Dangerous! Be careful with the expression
row[target_column] = eval(f"row[target_column]{expression}")
else:
Expand Down

0 comments on commit b2a1da4

Please sign in to comment.