petereon / beaupy

A Python library of interactive CLI elements you have been looking for
https://petereon.github.io/beaupy/
MIT License
200 stars 13 forks source link

Remove warning about invalid escape sequence #89

Closed ashb closed 6 months ago

ashb commented 6 months ago

Python 3.12 now issues this as a warning at runtime, not just a flake8/linter error.

I'm not quite sure why my script complains about this when python -c 'import beaupy._internals' doesn't, but it seems like an easy fix:

shell ❯ ./py312-test/bin/teleport-assume
/Users/ash/code/astro/teleport-assume/py312-test/lib/python3.12/site-packages/beaupy/_internals.py:60: SyntaxWarning: invalid escape sequence '\['
  prefix = '\[{}]'.format(' ' * len(_replace_emojis(tick_character)))  # noqa: W605
/Users/ash/code/astro/teleport-assume/py312-test/lib/python3.12/site-packages/beaupy/_internals.py:62: SyntaxWarning: invalid escape sequence '\['
  prefix = f'\[[{tick_style}]{tick_character}[/{tick_style}]]'  # noqa: W605

This was the output I got on startup of my script. (Maybe some other module I imported changed the default warnings filter 🤷🏻 )

petereon commented 6 months ago

Thanks for the contribution! I'll merge and release today