Skip to content
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

added aggregate class method on SingleTimeSeries class #48

Merged
merged 4 commits into from
Nov 8, 2024

Conversation

KapilDuwadi
Copy link
Collaborator

No description provided.

@KapilDuwadi
Copy link
Collaborator Author

@daniel-thom Could you review this ?

@codecov-commenter
Copy link

codecov-commenter commented Nov 8, 2024

Codecov Report

Attention: Patch coverage is 82.92683% with 7 lines in your changes missing coverage. Please review.

Please upload report for BASE (main@5e1c61d). Learn more about missing BASE report.

Files with missing lines Patch % Lines
src/infrasys/time_series_models.py 65.00% 7 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main      #48   +/-   ##
=======================================
  Coverage        ?   95.24%           
=======================================
  Files           ?       33           
  Lines           ?     2778           
  Branches        ?        0           
=======================================
  Hits            ?     2646           
  Misses          ?      132           
  Partials        ?        0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@daniel-thom daniel-thom left a comment

Choose a reason for hiding this comment

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

LGTM - just two minor comments.

@@ -89,6 +101,72 @@ def check_data(

return data

@classmethod
def aggregate(cls, ts_data: list[Self]) -> Self:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Perhaps [Iterable] instead of list?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

actually no mypy complains if I do iterable because I am accessing ts_data in multiple places which you can not do if you pass generator

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ah, because you are accessing it by index. Technically, you could have made it typing.Sequence, which allows list or tuple, at least. But don't worry about it.


# Validate uniformity across properties
if any(len(prop) != 1 for prop in unique_props.values()):
msg = f"Inconsistent timeseries data: {unique_props}"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Perhaps this should only print the sets with length greater than one.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sure

@KapilDuwadi KapilDuwadi merged commit 169accf into main Nov 8, 2024
6 checks passed
@KapilDuwadi KapilDuwadi deleted the aggregate_single_time_series branch November 8, 2024 20:15
github-actions bot pushed a commit that referenced this pull request Nov 8, 2024
added aggregate class method on SingleTimeSeries class
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants