tBuLi / symfit

Symbolic Fitting; fitting as it should be.
http://symfit.readthedocs.org
MIT License
236 stars 19 forks source link

Fix "SyntaxWarning: invalid escape sequence" #376

Open paulftw opened 2 weeks ago

paulftw commented 2 weeks ago

I am getting SyntaxWarnings from Pyodide, but other python projects seem to have similar issues, e.g. this one (and a matching fix).

At the moment fit_result.py escapes first asterisk with a backslash (line 36) but not the second one, so I guess backslashes are indeed unnecessary.

To reproduce open pyodide console and enter

import micropip; await micropip.install('symfit'); import symfit

Observed output:

>>> import micropip; await micropip.install('symfit'); import symfit
/lib/python3.12/site-packages/symfit/core/operators.py:48: SyntaxWarning: invalid escape sequence '\*'
  """
/lib/python3.12/site-packages/symfit/core/support.py:296: SyntaxWarning: invalid escape sequence '\*'
  """
/lib/python3.12/site-packages/symfit/core/fit.py:32: SyntaxWarning: invalid escape sequence '\_'
  """
/lib/python3.12/site-packages/symfit/core/minimizers.py:211: SyntaxWarning: invalid escape sequence '\*'
  '''
/lib/python3.12/site-packages/symfit/core/minimizers.py:327: SyntaxWarning: invalid escape sequence '\*'
  """
/lib/python3.12/site-packages/symfit/core/minimizers.py:793: SyntaxWarning: invalid escape sequence '\*'
  """
/lib/python3.12/site-packages/symfit/core/fit_results.py:29: SyntaxWarning: invalid escape sequence '\*'
  """
/lib/python3.12/site-packages/symfit/core/objectives.py:389: SyntaxWarning: invalid escape sequence '\c'
  """