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

Fix invalid escape sequence in einsum docstring #298

Merged
merged 1 commit into from
Dec 11, 2023

Conversation

atwam
Copy link
Contributor

@atwam atwam commented Dec 8, 2023

Current einsum docstring has an invalid escape sequence, specifically in the \sum for some LaTeX code. This can be checked by running the following:

$ PYTHONWARNINGS=error python -c "import einops"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "~/.venv/lib/python3.10/site-packages/einops/__init__.py", line 14, in <module>
    from .einops import rearrange, reduce, repeat, einsum, parse_shape, asnumpy
  File "~/.venv/lib/python3.10/site-packages/einops/einops.py", line 827
    """
    ^^^
SyntaxError: invalid escape sequence '\s'

This can be annoying, especially when running tests if one wants to run them in strict mode (warnings-as-errors) Replacing with a raw docstring removes the issue.

Current einsum docstring has an invalid escape sequence, specifically in the `\sum` for some LaTeX code.
This can be checked by running the following:

```bash
$ PYTHONWARNINGS=error python -c "import einops"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "~/.venv/lib/python3.10/site-packages/einops/__init__.py", line 14, in <module>
    from .einops import rearrange, reduce, repeat, einsum, parse_shape, asnumpy
  File "~/.venv/lib/python3.10/site-packages/einops/einops.py", line 827
    """
    ^^^
```

This can be annoying, especially when running tests if one wants to run them in strict mode (warnings-as-errors)
Replacing with a raw docstring removes the issue.
@arogozhnikov
Copy link
Owner

Interesting catch @atwam , I wonder how ruff ignores this.

And when I run

PYTHONWARNINGS=error python -c "import einops"

on python3.10 on mac, it reports nothing back too.
Which python version do you use?

@atwam
Copy link
Contributor Author

atwam commented Dec 11, 2023

Hum, I'm on python 3.10.11 on WSL/Ubuntu

@arogozhnikov arogozhnikov merged commit 44080db into arogozhnikov:master Dec 11, 2023
4 checks passed
@arogozhnikov
Copy link
Owner

Interstingly, it complains on just using '\s', but does not complain on einops import, so I can't check if this is resolved. Hopefully yes

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