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

Update numpy.typing import and annotations #688

Merged
merged 2 commits into from
May 1, 2023

Conversation

elisno
Copy link
Member

@elisno elisno commented May 1, 2023

Changes made:

  • Moved import numpy.typing as npt under if TYPE_CHECKING guard clauses
    • Adjusted related type-hinting code to only be used when TYPE_CHECKING is True
  • Added from __future__ import annotations to affected files

The code functionality remains unchanged.
This should only be used during type-checking, but not at run time.

How was this tested

  1. Set up a Python 3.7 devcontainer (mcr.microsoft.com/vscode/devcontainers/python:3.7)
    1.5 (Optional). Setup a virtual environment.
  2. Install dependencies
    git clone https://github.com/cleanlab/cleanlab.git
    pip install numpy==1.20.0
    cd cleanlab
    pip install -e .
    
  3. In a python REPL, run import commands like:
    from cleanlab.token_classification.filter import find_label_issues

Note

The solution in #681 (comment) is no longer necessary at run time, so there's no reason to bump the lower bound of numpy version atm.

@elisno elisno requested a review from sanjanag May 1, 2023 16:42
@codecov
Copy link

codecov bot commented May 1, 2023

Codecov Report

Merging #688 (3be4733) into master (9ee78be) will decrease coverage by 0.33%.
The diff coverage is 45.45%.

@@            Coverage Diff             @@
##           master     #688      +/-   ##
==========================================
- Coverage   95.80%   95.47%   -0.33%     
==========================================
  Files          46       46              
  Lines        3645     3645              
  Branches      649      651       +2     
==========================================
- Hits         3492     3480      -12     
- Misses         79       87       +8     
- Partials       74       78       +4     
Impacted Files Coverage Δ
cleanlab/datalab/datalab.py 100.00% <ø> (ø)
cleanlab/datalab/issue_manager/duplicate.py 96.55% <ø> (-0.04%) ⬇️
cleanlab/datalab/issue_manager/noniid.py 89.80% <ø> (-0.07%) ⬇️
cleanlab/datalab/issue_manager/outlier.py 98.34% <ø> (-0.02%) ⬇️
cleanlab/internal/token_classification_utils.py 94.33% <40.00%> (-5.67%) ⬇️
cleanlab/multilabel_classification/rank.py 90.00% <40.00%> (-10.00%) ⬇️
cleanlab/datalab/issue_finder.py 96.42% <100.00%> (ø)

... and 1 file with indirect coverage changes

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.

2 participants