Open CrazyUs3r opened 1 month ago
If you add Closes #559 in the description the issue will be closed automatically if/when this is merged :wink:
If you add Closes #559 in the description the issue will be closed automatically if/when this is merged 😉
You could do this for example in this way in the commit message:
Fix regexp definition in sensor.py
Closes #559.
In general commit messages should be more descriptive. E.g. if you use git log --oneline
it is nice to get already some hint what the change is about. Then in the body of the commit message you can tell more what has been changed and why. In this case link to the issue is likely enough.
The warning you're seeing is because Python is treating \S as an invalid escape sequence within the regular expression. In Python strings, the backslash \ is used as an escape character, so \S without a preceding r (indicating a raw string) is problematic.
To fix this, you should use a raw string for your regular expression. This way, backslashes are treated literally, not as escape characters. Here's the corrected line of code:
python
if uom and (re.match(r"\S+", uom)):
By adding the r before the string, it tells Python to treat the backslashes as literal characters. This should resolve the SyntaxWarning.