]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
tests: make whitespace between functions and classes consistent
authorDan Fandrich <dan@coneharvesters.com>
Sun, 5 Apr 2026 16:00:55 +0000 (09:00 -0700)
committerDan Fandrich <dan@coneharvesters.com>
Wed, 8 Apr 2026 17:28:05 +0000 (10:28 -0700)
Mostly, this means two blank lines between classes and functions and one
line between methods. Since these checks are currently in preview, they
are done in a separate ruff invocation to avoid turning ALL the preview
checks on at the same time.

scripts/pythonlint.sh
tests/dictserver.py
tests/ech_combos.py
tests/http/conftest.py
tests/http/scorecard.py
tests/negtelnetserver.py
tests/smbserver.py
tests/util.py

index 0164821548a58102090727e012ccb3ba065a6902..5c1a3cdcc3fdf6df227a8b4126305acd5e0ee8ea 100755 (executable)
@@ -31,3 +31,5 @@ ruff check --extend-select=B007,B016,C405,C416,COM818,D200,D213,D204,D401,\
 D415,FURB129,N818,PERF401,PERF403,PIE790,PIE808,PLW0127,Q004,RUF010,SIM101,\
 SIM117,SIM118,TRY400,TRY401,RET503,RET504,UP004,B018,B904,RSE102,RET505,I001 \
 "$@"
+# Checks that are in preview only, since --preview otherwise turns them all on
+ruff check --preview --select=E301,E302,E303,E304,E305,E306,E502 "$@"
index 8dc33cd0dc727168f0affe9b6000a11414d50a7f..b4e1afd78b4b150321b1184c278b9d7b9908d1ae 100755 (executable)
@@ -40,6 +40,7 @@ try:  # Python 2
 except ImportError:  # Python 3
     import socketserver
 
+
 log = logging.getLogger(__name__)
 HOST = "localhost"
 
index 4eba4de1c2f5c3d90c2b51432199dffc1a5b8fba..8c100c2bb734a0f61bccb0c26795c7e1b5c6ddf9 100755 (executable)
@@ -72,6 +72,7 @@ def CombinationRepetitionUtil(chosen, arr, badarr, index,
     CombinationRepetitionUtil(chosen, arr, badarr, index,
                               r, start + 1, end)
 
+
 # The main function that prints all
 # combinations of size r in arr[] of
 # size n. This function mainly uses
@@ -86,6 +87,7 @@ def CombinationRepetition(arr, badarr, n, r):
     # temporary array 'chosen[]'
     CombinationRepetitionUtil(chosen, arr, badarr, 0, r, 0, n)
 
+
 # Driver code
 badarr = [ '--ech grease', '--ech false', '--ech ecl:$badecl', '--ech pn:$badpn' ]
 goodarr = [ '--ech hard', '--ech true', '--ech ecl:$goodecl',  '--ech pn:$goodpn' ]
index dddcdc32799938add75c5040447232f2c6a1fbfb..08da73ac0fdfad5e7d6115aba07b407c00644b85 100644 (file)
@@ -148,11 +148,13 @@ def configures_httpd(env, httpd) -> Generator[bool, None, None]:
     # include this fixture as test parameter if the test configures httpd itself
     yield True
 
+
 @pytest.fixture(scope='session')
 def configures_nghttpx(env, httpd) -> Generator[bool, None, None]:
     # include this fixture as test parameter if the test configures nghttpx itself
     yield True
 
+
 @pytest.fixture(autouse=True, scope='function')
 def server_reset(request, env, httpd, nghttpx):
     # make sure httpd is in default configuration when a test starts
index e5e9e26292372fd45c2eb0aac4bb53ed7488d43b..205b556f61e26a25e122d16b1b6790a29d25ac31 100644 (file)
@@ -763,7 +763,6 @@ def run_score(args, protocol):
         for x in args.request_parallels:
             request_parallels.extend([int(s) for s in x.split(',')])
 
-
     if args.downloads or args.uploads or args.requests or args.handshakes:
         handshakes = args.handshakes
         if not args.downloads:
index 34be28182b26e2a80c818df36c4e7b4d6507bbeb..c31fc033aaa0973921ab5248e58849fb8b32d26e 100755 (executable)
@@ -38,6 +38,7 @@ if sys.version_info.major >= 3:
 else:
     import SocketServer as socketserver
 
+
 log = logging.getLogger(__name__)
 HOST = "localhost"
 IDENT = "NTEL"
@@ -46,6 +47,7 @@ IDENT = "NTEL"
 VERIFIED_REQ = "verifiedserver"
 VERIFIED_RSP = "WE ROOLZ: {pid}"
 
+
 def telnetserver(options):
     """Start up a TCP server with a telnet handler and serve DICT requests forever."""
     if options.pidfile:
@@ -66,6 +68,7 @@ def telnetserver(options):
     # leaving `with` calls server.close() automatically
     return ScriptRC.SUCCESS
 
+
 class NegotiatingTelnetHandler(socketserver.BaseRequestHandler):
     """Handler class for Telnet connections."""
 
@@ -109,6 +112,7 @@ class NegotiatingTelnetHandler(socketserver.BaseRequestHandler):
         except IOError:
             log.exception("IOError hit during request")
 
+
 class Negotiator:
     NO_NEG = 0
     START_NEG = 1
@@ -237,6 +241,7 @@ class Negotiator:
         log.debug("Sending WONT %s", option_str)
         self.send_iac([NegTokens.WONT, NegOptions.to_val(option_str)])
 
+
 class NegBase:
     @classmethod
     def to_val(cls, name):
@@ -250,6 +255,7 @@ class NegBase:
 
         return "<unknown>"
 
+
 class NegTokens(NegBase):
     # The start of a negotiation sequence
     IAC = 255
@@ -267,6 +273,7 @@ class NegTokens(NegBase):
     # The end of sub-negotiation options.
     SE = 240
 
+
 class NegOptions(NegBase):
     # Binary Transmission
     BINARY = 0
@@ -279,6 +286,7 @@ class NegOptions(NegBase):
     # Charset option
     CHARSET = 42
 
+
 def get_options():
     parser = argparse.ArgumentParser()
 
@@ -297,6 +305,7 @@ def get_options():
 
     return parser.parse_args()
 
+
 def setup_logging(options):
     """Set up logging from the command line options."""
     root_logger = logging.getLogger()
@@ -329,6 +338,7 @@ def setup_logging(options):
         stdout_handler.setLevel(logging.DEBUG)
         root_logger.addHandler(stdout_handler)
 
+
 class ScriptRC:
     """Enum for script return codes."""
 
@@ -336,6 +346,7 @@ class ScriptRC:
     FAILURE = 1
     EXCEPTION = 2
 
+
 if __name__ == '__main__':
     # Get the options from the user.
     options = get_options()
index 34d3dabc008de377ca510b6c766ce21bd70fcfc0..c2942079882e6bd955ee363409eb99fbb5e92242 100755 (executable)
@@ -43,6 +43,7 @@ except ImportError:
         'Warning: Python package impacket is required for smb testing; '
         'use pip or your package manager to install it\n')
     sys.exit(1)
+
 from impacket import smb as imp_smb
 from impacket import smbserver as imp_smbserver
 from impacket.nt_errors import STATUS_ACCESS_DENIED, STATUS_NO_SUCH_FILE, STATUS_SUCCESS
@@ -53,6 +54,7 @@ TESTS_MAGIC = "TESTS_MAGIC"
 VERIFIED_REQ = "verifiedserver"
 VERIFIED_RSP = "WE ROOLZ: {pid}\n"
 
+
 class ShutdownHandler(threading.Thread):
     """
     Cleanly shut down the SMB server.
index 942a590a8f4119f46f750debe871c75d6fd2f995..7db47d0a006b168adf07ad5a42b7b0ecf5f61115 100755 (executable)
@@ -31,6 +31,7 @@ log = logging.getLogger(__name__)
 
 REPLY_DATA = re.compile("<reply>[ \t\n\r]*<data[^<]*>(.*?)</data>", re.MULTILINE | re.DOTALL)
 
+
 class ClosingFileHandler(logging.StreamHandler):
     def __init__(self, filename):
         super(ClosingFileHandler, self).__init__()
@@ -59,6 +60,7 @@ class ClosingFileHandler(logging.StreamHandler):
                 self.release()
         return result
 
+
 class TestData:
     def __init__(self, data_folder):
         self.data_folder = data_folder
@@ -80,6 +82,7 @@ class TestData:
         # Left-strip the data so we do not get a newline before our data.
         return m.group(1).lstrip()
 
+
 if __name__ == '__main__':
     td = TestData("./data")
     data = td.get_test_data(1451)