py-models-parser icon indicating copy to clipboard operation
py-models-parser copied to clipboard

Fix invalid escape sequence messages

Open fredsonnenwald opened this issue 7 months ago • 0 comments

When running

from omymodels.models.pydantic import types

under Python 3.12 I get

<unknown>:1: SyntaxWarning: invalid escape sequence '\#'
<unknown>:1: SyntaxWarning: invalid escape sequence '\-'

Based on https://github.com/erikrose/parsimonious/issues/246 this seems to be due to Python getting more aggressive about escape sequences. It also looks like there's a fairly straightforward fix that involves marking the string as a raw string, which I've done in this patch. After making that change the invalid escape sequence messages go away.

fredsonnenwald avatar Mar 28 '25 14:03 fredsonnenwald