Skip to content
Prev Previous commit
Next Next commit
fix lint
Signed-off-by: Vanshika Vanshika <vvanshik@redhat.com>

rh-pre-commit.version: 2.3.2
rh-pre-commit.check-secrets: ENABLED
  • Loading branch information
Vperiodt committed Apr 10, 2026
commit 34eed9aaab57416a36454bbe48a512cdd172740e
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,7 @@ def get_historical_features(
max_ttl_seconds = 0
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicate computation: When start_date is None, max_ttl_seconds is already computed in the block above (lines 147-151) to derive start_date. This block recomputes the exact same value. Consider hoisting max_ttl_seconds to a single computation before both uses:

max_ttl_seconds = max(
    (int(fv.ttl.total_seconds()) for fv in feature_views
     if fv.ttl and isinstance(fv.ttl, timedelta)),
    default=0,
)

for fv in feature_views:
if fv.ttl and isinstance(fv.ttl, timedelta):
max_ttl_seconds = max(
max_ttl_seconds, int(fv.ttl.total_seconds())
)
max_ttl_seconds = max(max_ttl_seconds, int(fv.ttl.total_seconds()))
lookback_start_date: Optional[datetime] = (
start_date - timedelta(seconds=max_ttl_seconds)
if max_ttl_seconds > 0
Expand Down