all: Go back to using default ruff quote style.

Commit dc2fcfcc55 seems to have accidentally
changed the ruff quote style to "preserve", instead of keeping it at the
default which is "double".

Put it back to the default and update relevant .py files with this rule.

Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
Damien George
2025-07-22 22:58:52 +10:00
parent 6a4306a0df
commit 7729e80fdd
16 changed files with 45 additions and 46 deletions

View File

@@ -5,5 +5,5 @@ cause: MicroPython is optimised for code space.
workaround: Always use balanced braces and brackets in expressions inside f-strings
"""
print(f'{"hello { world"}')
print(f'{"hello ] world"}')
print(f"{'hello { world'}")
print(f"{'hello ] world'}")

View File

@@ -28,7 +28,7 @@ l.pop()
# Try to compress. This will try to allocate a large window and fail.
try:
g.write('test')
g.write("test")
except MemoryError:
print("MemoryError")

View File

@@ -86,7 +86,7 @@ except ValueError:
# incomplete array declaration
try:
my_print(json.loads('[0,'))
my_print(json.loads("[0,"))
except ValueError:
print("ValueError")

View File

@@ -13,4 +13,4 @@ print(json.loads("9111222333444555666"))
print(json.loads("-9111222333444555666"))
print(json.loads("9111222333444555666"))
print(json.loads("-9111222333444555666"))
print(json.loads("[\"9111222333444555666777\",9111222333444555666]"))
print(json.loads('["9111222333444555666777",9111222333444555666]'))

View File

@@ -35,7 +35,7 @@ client_socket = DummySocket()
dtls_server_ctx = SSLContext(PROTOCOL_DTLS_SERVER)
dtls_server_ctx.verify_mode = CERT_NONE
dtls_server = dtls_server_ctx.wrap_socket(
server_socket, do_handshake_on_connect=False, client_id=b'dummy_client_id'
server_socket, do_handshake_on_connect=False, client_id=b"dummy_client_id"
)
print("Wrapped DTLS Server")

View File

@@ -52,6 +52,6 @@ for function_name, function, test_vals in functions:
except ValueError as e:
ans = str(e)
# a tiny error in REPR_C value for 1.5204998778 causes a wrong rounded value
if is_REPR_C and function_name == 'erfc' and ans == "1.521":
if is_REPR_C and function_name == "erfc" and ans == "1.521":
ans = "1.52"
print("{}({:.4g}) = {}".format(function_name, value, ans))

View File

@@ -7,39 +7,39 @@ try:
except TypeError:
# 2-argument version of next() not supported
# we are probably not at MICROPY_CONFIG_ROM_LEVEL_BASIC_FEATURES
print('SKIP')
print("SKIP")
raise SystemExit
# 1. test default visibility
from pkgstar_default import *
print('visibleFun' in globals())
print('VisibleClass' in globals())
print('_hiddenFun' in globals())
print('_HiddenClass' in globals())
print("visibleFun" in globals())
print("VisibleClass" in globals())
print("_hiddenFun" in globals())
print("_HiddenClass" in globals())
print(visibleFun())
# 2. test explicit visibility as defined by __all__ (as an array)
from pkgstar_all_array import *
print('publicFun' in globals())
print('PublicClass' in globals())
print('unlistedFun' in globals())
print('UnlistedClass' in globals())
print('_privateFun' in globals())
print('_PrivateClass' in globals())
print("publicFun" in globals())
print("PublicClass" in globals())
print("unlistedFun" in globals())
print("UnlistedClass" in globals())
print("_privateFun" in globals())
print("_PrivateClass" in globals())
print(publicFun())
# test dynamic import as used in asyncio
print('dynamicFun' in globals())
print("dynamicFun" in globals())
print(dynamicFun())
# 3. test explicit visibility as defined by __all__ (as an tuple)
from pkgstar_all_tuple import *
print('publicFun2' in globals())
print('PublicClass2' in globals())
print('unlistedFun2' in globals())
print('UnlistedClass2' in globals())
print("publicFun2" in globals())
print("PublicClass2" in globals())
print("unlistedFun2" in globals())
print("UnlistedClass2" in globals())
print(publicFun2())
# 4. test reporting of missing entries in __all__

View File

@@ -1,4 +1,4 @@
__all__ = ['publicFun', 'PublicClass', 'dynamicFun']
__all__ = ["publicFun", "PublicClass", "dynamicFun"]
# Definitions below should always be imported by a star import

View File

@@ -1,4 +1,4 @@
__all__ = ('existingFun', 'missingFun')
__all__ = ("existingFun", "missingFun")
def existingFun():

View File

@@ -1,4 +1,4 @@
__all__ = ('publicFun2', 'PublicClass2')
__all__ = ("publicFun2", "PublicClass2")
# Definitions below should always be imported by a star import

View File

@@ -16,7 +16,7 @@ import threading
import tempfile
# Maximum time to run a single test, in seconds.
TEST_TIMEOUT = float(os.environ.get('MICROPY_TEST_TIMEOUT', 30))
TEST_TIMEOUT = float(os.environ.get("MICROPY_TEST_TIMEOUT", 30))
# See stackoverflow.com/questions/2632199: __file__ nor sys.argv[0]
# are guaranteed to always work, this one should though.
@@ -411,7 +411,7 @@ def run_micropython(pyb, args, test_file, test_file_abspath, is_special=False):
def send_get(what):
# Detect {\x00} pattern and convert to ctrl-key codes.
ctrl_code = lambda m: bytes([int(m.group(1))])
what = re.sub(rb'{\\x(\d\d)}', ctrl_code, what)
what = re.sub(rb"{\\x(\d\d)}", ctrl_code, what)
os.write(master, what)
return get()