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

numpy's and torch's functions are suddenly treated as typos #969

Closed
Borda opened this issue Apr 2, 2024 · 5 comments · Fixed by #976
Closed

numpy's and torch's functions are suddenly treated as typos #969

Borda opened this issue Apr 2, 2024 · 5 comments · Fixed by #976

Comments

@Borda
Copy link

Borda commented Apr 2, 2024

Another case is when we see an increase in detected typos, but not sure if they shall be treated as typos...

  - repo: https://github.com/crate-ci/typos
    rev: v1.20.0
    hooks:
      - id: typos

gives following

error: `arange` should be `arrange`
  --> src/torchmetrics/functional/retrieval/precision_recall_curve.py:89:22
   |
89 |         topk = torch.arange(1, max_k + 1, device=preds.device)
   |                      ^^^^^^
   |
error: `arange` should be `arrange`
  --> tests/unittests/image/test_psnr.py:55:44
   |
55 |         batch = np.moveaxis(batch, dim, np.arange(-num_dims, 0))
   |                                            ^^^^^^
   |
error: `arange` should be `arrange`

see full log here

@Borda Borda changed the title numppy functions are suddenly treated as typos numpy's and torch's functions are suddenly treated as typos Apr 2, 2024
@epage
Copy link
Collaborator

epage commented Apr 2, 2024

Should be fixed in 1.20.3 which is building release binaries

@my1e5
Copy link

my1e5 commented Jun 14, 2024

@epage On v1.22.0, this is still failing when I use np.arange in a code block within my documentation markdown files.
For example if I have a .md file within docs/

# Example markdown file

This file includes a code block

'''py
foo = np.arange(0,100,1)
'''

(Pretend the ''' in the above example are ```)

This line gets changed to np.arrange.

@epage
Copy link
Collaborator

epage commented Jun 14, 2024

We limited the fix to just Python files.

We do not have syntax-aware spell checking which means we cannot tell when one file type is embedded in another file type. Even if we did, it would be reasonable to refer to a symbol with arrange and would then need to deal with that somehow as well.

@darosio
Copy link

darosio commented Aug 27, 2024

This is now back in jupyther notebook (ipynb) files where cells containing np.arange() become np.arrange()

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 a pull request may close this issue.

5 participants