mirror of
https://github.com/esphome/esphome.git
synced 2025-09-20 12:12:24 +01:00
[ruff] Enable SIM rules and fix code simplification violations (#9872)
This commit is contained in:
@@ -96,9 +96,7 @@ def cpp_string_escape(string, encoding="utf-8"):
|
||||
def _should_escape(byte: int) -> bool:
|
||||
if not 32 <= byte < 127:
|
||||
return True
|
||||
if byte in (ord("\\"), ord('"')):
|
||||
return True
|
||||
return False
|
||||
return byte in (ord("\\"), ord('"'))
|
||||
|
||||
if isinstance(string, str):
|
||||
string = string.encode(encoding)
|
||||
|
Reference in New Issue
Block a user