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

Better value validation for state parameter of fetch_*_table #1616

Merged
merged 8 commits into from
Jan 19, 2024

Conversation

Raalsky
Copy link
Contributor

@Raalsky Raalsky commented Jan 18, 2024

Before submitting checklist

  • Did you update the CHANGELOG? (not for test updates, internal changes/refactors or CI/CD setup)
  • Did you ask the docs owner to review all the user-facing changes?

@Raalsky Raalsky requested a review from normandy7 January 18, 2024 15:03
Copy link

codecov bot commented Jan 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (9c6514b) 76.54% compared to head (8dab719) 76.54%.

Additional details and impacted files
@@                   Coverage Diff                   @@
##           dev/fetch-ui-parity    #1616      +/-   ##
=======================================================
- Coverage                76.54%   76.54%   -0.01%     
=======================================================
  Files                      292      292              
  Lines                    14671    14678       +7     
=======================================================
+ Hits                     11230    11235       +5     
- Misses                    3441     3443       +2     
Flag Coverage Δ
macos 73.65% <100.00%> (-0.01%) ⬇️
py3.7 73.94% <100.00%> (-0.01%) ⬇️
ubuntu 73.80% <100.00%> (-0.01%) ⬇️
unit 73.94% <100.00%> (-0.01%) ⬇️
windows 73.13% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@@ -80,6 +81,11 @@ def verify_type(var_name: str, var, expected_type: Union[type, tuple]):
raise TypeError("{} is a stream, which does not implement read method".format(var_name))


def verify_value(var_name: str, var, expected_values: Iterable[T]):
Copy link
Contributor

Choose a reason for hiding this comment

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

Type hints?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@@ -189,7 +192,7 @@ def fetch_runs_table(
self,
*,
id: Optional[Union[str, Iterable[str]]] = None,
state: Optional[Union[str, Iterable[str]]] = None,
state: Optional[Union[Literal["inactive", "active"], Iterable[Literal['inactive", "active']]]] = None,
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't understand ' vs " order here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Me either 😉. Fixed 🚀

@@ -286,6 +289,10 @@ def fetch_runs_table(
verify_type("sort_by", sort_by, str)
verify_type("ascending", ascending, bool)

if states is not None:
Copy link
Contributor

Choose a reason for hiding this comment

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

From what I see, states will never be None, right? The type hint for the as_list function doesn't seem to be adequate, or am I missing something?

def as_list(name: str, value: Optional[Union[str, Iterable[str]]]) -> Optional[Iterable[str]]:

Copy link
Contributor

Choose a reason for hiding this comment

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

I know that the as_list function is not part of your PR, but just noticed that its confusing return type hint requires additional, unnecessary if statement

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks a lot! Fixed I think

@Raalsky Raalsky requested a review from AleksanderWWW January 18, 2024 21:06
Copy link
Collaborator

@normandy7 normandy7 left a comment

Choose a reason for hiding this comment

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

@Raalsky Just to check -- may I also review the merge of the dev branch as a whole, as agreed previously?

src/neptune/internal/utils/__init__.py Show resolved Hide resolved
@Raalsky
Copy link
Contributor Author

Raalsky commented Jan 19, 2024

@Raalsky Just to check -- may I also review the merge of the dev branch as a whole, as agreed previously?

Yes! You can start to review all the things that we have here: #1587 . I forget not to request a review with a partial changes 😉

@Raalsky Raalsky merged commit 6d78043 into dev/fetch-ui-parity Jan 19, 2024
4 checks passed
@Raalsky Raalsky deleted the rj/state-value-verify branch January 19, 2024 10:00
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