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

Fixing warnings in CLI startup #1972

Merged
merged 1 commit into from
Oct 25, 2024
Merged

Conversation

ntouran
Copy link
Member

@ntouran ntouran commented Oct 25, 2024

This fixes warnings when you run armi on the CLI (as run from Python 3.12):

(armi) :~/code/armi$ armi
/home/nick/code/armi/armi/settings/settingsValidation.py:781: SyntaxWarning: invalid escape sequence '\d'
  fullV = "\d+\.\d+\.\d+"
/home/nick/code/armi/armi/settings/settingsValidation.py:782: SyntaxWarning: invalid escape sequence '\d'
  medV = "\d+\.\d+"
/home/nick/code/armi/armi/settings/settingsValidation.py:783: SyntaxWarning: invalid escape sequence '\d'
  minV = "\d+"

What is the change?

Add proper backslashes to regular expression. \d is an invalid escape sequence (where \n is a newline, \d means nothing).

Why is the change being made?

Because the code prints out 3 warnings on console as a first impression, and also:

Changed in version 3.12: Unrecognized escape sequences produce a SyntaxWarning. In a future Python version they will be eventually a SyntaxError.

src: https://docs.python.org/3/reference/lexical_analysis.html#escape-sequences


Checklist

  • The release notes have been updated if necessary.
  • The documentation is still up-to-date in the doc folder.
  • The dependencies are still up-to-date in pyproject.toml.

This fixes warnings when you run `armi` on the CLI:

(armi) :~/code/armi$ armi
/home/nick/code/armi/armi/settings/settingsValidation.py:781: SyntaxWarning: invalid escape sequence '\d'
  fullV = "\d+\.\d+\.\d+"
/home/nick/code/armi/armi/settings/settingsValidation.py:782: SyntaxWarning: invalid escape sequence '\d'
  medV = "\d+\.\d+"
/home/nick/code/armi/armi/settings/settingsValidation.py:783: SyntaxWarning: invalid escape sequence '\d'
  minV = "\d+"
@john-science john-science changed the title Fix syntax warnings at startup. Fixing doc syntax warnings at startup Oct 25, 2024
@john-science john-science added the documentation Improvements or additions to documentation label Oct 25, 2024
@john-science john-science changed the title Fixing doc syntax warnings at startup Fixing CLI syntax warnings at startup Oct 25, 2024
@john-science john-science added cleanup Code/comment cleanup: Low Priority and removed documentation Improvements or additions to documentation labels Oct 25, 2024
@john-science john-science merged commit c31e5cf into terrapower:main Oct 25, 2024
11 checks passed
@john-science john-science changed the title Fixing CLI syntax warnings at startup Fixing warnings in CLI startup Oct 25, 2024
drewj-tp added a commit that referenced this pull request Oct 29, 2024
* main:
  Fixing HexBlock docstrings (#1981)
  Removing a duplicate hex rotation impl tag (#1979)
  Avoiding closing plots that are meant to be interactive (#1978)
  Ensuring HexBlock.rotate updates child spatial locators (#1943)
  Add new memory runLog info to memoryProfiler.py  (#1970)
  Fixing various doc build issues (#1974)
  Hiding sphinx-needs warnings during doc build (#1973)
  Fixing warnings in CLI startup (#1972)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cleanup Code/comment cleanup: Low Priority
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants