Skip to content

Remove invalid escape sequence from docstring#441

Merged
kanekosh merged 3 commits intomdolab:mainfrom
dingraha:escape_sequence
May 9, 2025
Merged

Remove invalid escape sequence from docstring#441
kanekosh merged 3 commits intomdolab:mainfrom
dingraha:escape_sequence

Conversation

@dingraha
Copy link
Contributor

@dingraha dingraha commented May 2, 2025

Purpose

This PR removes an invalid escape sequence from one docstring, and so fixes the warning:

> python
Python 3.13.3 | packaged by conda-forge | (main, Apr 14 2025, 20:44:03) [GCC 13.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from pyoptsparse import pySNOPT
/home/dingraha/projects/aviary_propeller/ved/pyoptsparse/pyoptsparse/pyOpt_optimizer.py:979: SyntaxWarning: invalid escape sequence '\*'
  \*args, \*\*kwargs : varies
>>>

Here is a stackoverflow post explaining the issue: https://stackoverflow.com/questions/52335970/how-to-fix-syntaxwarning-invalid-escape-sequence-in-python, and here are the valid escape sequences in Python: https://docs.python.org/3/reference/lexical_analysis.html#escape-sequences. You'll see that \* is not listed.

Expected time until merged

Not urgent.

Type of change

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (non-backwards-compatible fix or feature)
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no API changes)
  • Documentation update
  • Maintenance update
  • Other (please describe)

Testing

No testing needed, but I did run the tests in tests and they seemed OK (but I don't have all the optimizers pyoptsparse supports so it's tough to tell).

Checklist

  • I have run flake8 and black to make sure the Python code adheres to PEP-8 and is consistently formatted
  • I have formatted the Fortran code with fprettify or C/C++ code with clang-format as applicable
  • I have run unit and regression tests which pass locally with my changes
  • I have added new tests that prove my fix is effective or that my feature works
  • I have added necessary documentation

@dingraha dingraha requested a review from a team as a code owner May 2, 2025 14:40
@dingraha dingraha requested review from marcomangano and sanjan98 May 2, 2025 14:40
@codecov
Copy link

codecov bot commented May 2, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.32%. Comparing base (61d8b83) to head (949e4dc).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##             main     #441       +/-   ##
===========================================
- Coverage   85.97%   74.32%   -11.65%     
===========================================
  Files          22       22               
  Lines        3315     3315               
===========================================
- Hits         2850     2464      -386     
- Misses        465      851      +386     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Collaborator

@kanekosh kanekosh left a comment

Choose a reason for hiding this comment

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

Thank you for catching this!

@kanekosh kanekosh merged commit f96d560 into mdolab:main May 9, 2025
17 of 18 checks passed
@ewu63
Copy link
Collaborator

ewu63 commented May 9, 2025

Not sure if this was the intention
image

What I would do instead is either double backslash e.g. \\* as seen here, or single backslash as we had before \* but wrap the entire docstring as a raw string, i.e. r"""....

@kanekosh
Copy link
Collaborator

Sorry I overlooked, I'll fix it

@kanekosh kanekosh mentioned this pull request May 28, 2025
13 tasks
@kanekosh kanekosh mentioned this pull request Aug 20, 2025
13 tasks
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.

3 participants