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 #1101

Merged
merged 3 commits into from
Oct 27, 2024

Conversation

janmayer
Copy link
Contributor

Hello! When using GPy with Python 3.12, there are a lot of warnings like

GPy\mappings\kernel.py:10
   GPy\mappings\kernel.py:10: SyntaxWarning:invalid escape sequence '\m'

GPy\mappings\linear.py:10
   GPy\mappings\linear.py:10: SyntaxWarning:invalid escape sequence '\m'

GPy\mappings\additive.py:8
   GPy\mappings\additive.py:8: SyntaxWarning:invalid escape sequence '\m'

GPy\mappings\compound.py:7
  GPy\mappings\compound.py:7: SyntaxWarning:invalid escape sequence '\m'

GPy\mappings\constant.py:7
   GPy\mappings\constant.py:7: SyntaxWarning:invalid escape sequence '\m'

GPy\models\warped_gp.py:144
  GPy\models\warped_gp.py:144: SyntaxWarning:invalid escape sequence '\m'

and yes, that is mostly coming from docstrings.

I have used ruff to hopefully find and fix all these occurrences by either adding more slashes, or r-Strings.

Note that ruff hints at many more issues, some of which could be autofixed.

@MartinBubel
Copy link
Contributor

Hi @janmayer
thanks for the contribution!
Test ci looks fine. Is your PR final? If yes, I will merge it.

@janmayer
Copy link
Contributor Author

Hi, thanks for the quick response! I hope I got them all now, feel free to merge when you see fit.

If you have the time, could you run/integrate a formatter and maybe a linter with autofix, like ruff?
I could also do so, but you'd have to verify an even larger amount of brainless changes.

@MartinBubel
Copy link
Contributor

Thanks for the update. Looks fine and I'll merge.

Regarding ruff, looks interesting. I am using flake8 mostly but felt increasingly unhappy with it when working on large files. Since ruff claims higher speed, I will try it out :)

I will prepare a PR and it and probably ask for your review?

@MartinBubel MartinBubel merged commit 1fcb408 into SheffieldML:devel Oct 27, 2024
14 checks passed
@janmayer janmayer deleted the fix_invalid_escape_sequence branch October 28, 2024 17:37
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