mirror of
https://github.com/curl/curl.git
synced 2026-08-26 22:34:45 +03:00
tests: enable additional ruff Python lint options
These all seem reasonable to enable for this code.
This commit is contained in:
parent
223fb00a78
commit
57cc523378
15 changed files with 142 additions and 177 deletions
|
|
@ -24,7 +24,7 @@
|
|||
#
|
||||
###########################################################################
|
||||
#
|
||||
""" DICT server """
|
||||
"""DICT server."""
|
||||
|
||||
from __future__ import (absolute_import, division, print_function,
|
||||
unicode_literals)
|
||||
|
|
@ -50,10 +50,7 @@ VERIFIED_RSP = "WE ROOLZ: {pid}"
|
|||
|
||||
|
||||
def dictserver(options):
|
||||
"""
|
||||
Starts up a TCP server with a DICT handler and serves DICT requests
|
||||
forever.
|
||||
"""
|
||||
"""Start up a TCP server with a DICT handler and serve DICT requests forever."""
|
||||
if options.pidfile:
|
||||
pid = os.getpid()
|
||||
# see tests/server/util.c function write_pidfile
|
||||
|
|
@ -74,13 +71,10 @@ def dictserver(options):
|
|||
|
||||
|
||||
class DictHandler(socketserver.BaseRequestHandler):
|
||||
"""Handler class for DICT connections.
|
||||
"""Handler class for DICT connections."""
|
||||
|
||||
"""
|
||||
def handle(self):
|
||||
"""
|
||||
Simple function which responds to all queries with a 552.
|
||||
"""
|
||||
"""Respond to all queries with a 552."""
|
||||
try:
|
||||
# First, send a response to allow the server to continue.
|
||||
rsp = "220 dictserver <xnooptions> <msgid@msgid>\n"
|
||||
|
|
@ -133,9 +127,7 @@ def get_options():
|
|||
|
||||
|
||||
def setup_logging(options):
|
||||
"""
|
||||
Set up logging from the command line options
|
||||
"""
|
||||
"""Set up logging from the command line options."""
|
||||
root_logger = logging.getLogger()
|
||||
add_stdout = False
|
||||
|
||||
|
|
@ -166,16 +158,13 @@ def setup_logging(options):
|
|||
|
||||
|
||||
class ScriptRC(object):
|
||||
"""Enum for script return codes"""
|
||||
"""Enum for script return codes."""
|
||||
|
||||
SUCCESS = 0
|
||||
FAILURE = 1
|
||||
EXCEPTION = 2
|
||||
|
||||
|
||||
class ScriptException(Exception):
|
||||
pass
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
# Get the options from the user.
|
||||
options = get_options()
|
||||
|
|
@ -186,8 +175,8 @@ if __name__ == '__main__':
|
|||
# Run main script.
|
||||
try:
|
||||
rc = dictserver(options)
|
||||
except Exception as e:
|
||||
log.exception(e)
|
||||
except Exception:
|
||||
log.exception('Error running server')
|
||||
rc = ScriptRC.EXCEPTION
|
||||
|
||||
if options.pidfile and os.path.isfile(options.pidfile):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue