mirror of
https://github.com/curl/curl.git
synced 2026-08-06 13:26:14 +03:00
tests: make whitespace between functions and classes consistent
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.
This commit is contained in:
parent
98e470b3a8
commit
17e8200733
8 changed files with 23 additions and 1 deletions
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue