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

Add static typing to labeler utils #668

Merged
merged 5 commits into from
Sep 29, 2022

Conversation

tonywu315
Copy link
Contributor

@taylorfturner taylorfturner enabled auto-merge (squash) September 29, 2022 18:44
@taylorfturner taylorfturner added the static_typing mypy static typing issues label Sep 29, 2022

if y_type.startswith("multilabel"):
average_options = ("micro", "macro", "weighted", "samples")
average_options: Tuple[str, ...] = ("micro", "macro", "weighted", "samples")
Copy link
Contributor

Choose a reason for hiding this comment

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

why the ... do we not want to enforce a len of four? so something like Tuple[str, str, str, str]?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The next line is a tuple with length 3

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

To specify a variable-length tuple of homogeneous type, use literal ellipsis, e.g. Tuple[int, ...]. A plain [Tuple](https://docs.python.org/3/library/typing.html#typing.Tuple) is equivalent to Tuple[Any, ...], and in turn to [tuple](https://docs.python.org/3/library/stdtypes.html#tuple).

dataprofiler/labelers/labeler_utils.py Outdated Show resolved Hide resolved
dataprofiler/labelers/labeler_utils.py Outdated Show resolved Hide resolved
auto-merge was automatically disabled September 29, 2022 20:20

Head branch was pushed to by a user without write access

@taylorfturner taylorfturner enabled auto-merge (squash) September 29, 2022 20:36
@taylorfturner taylorfturner merged commit 839629c into capitalone:main Sep 29, 2022
@tonywu315 tonywu315 deleted the static_typing/labelers/utils branch September 30, 2022 21:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
static_typing mypy static typing issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants