mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
Format Python scripts with yapf.
We also add a very basic yapf configuration file. Most of the changes in this patch were performed automatically, but we broke one overly long string into multiple components on `src/make_dbg_constants.py`.
This commit is contained in:
parent
1f388e3f40
commit
fd56eddcfb
5 changed files with 39 additions and 14 deletions
|
@ -56,4 +56,5 @@ for k in stats:
|
|||
num_covered += 1
|
||||
|
||||
if len(stats) > 0:
|
||||
print("%s/%s (%.1f%%) Zeek script statements covered." % (num_covered, len(stats), float(num_covered)/len(stats)*100))
|
||||
print("%s/%s (%.1f%%) Zeek script statements covered." %
|
||||
(num_covered, len(stats), float(num_covered) / len(stats) * 100))
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
import http.server as BaseHTTPServer
|
||||
|
||||
class MyRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
|
||||
|
||||
class MyRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
|
||||
def do_GET(self):
|
||||
self.send_response(200)
|
||||
self.send_header("Content-type", "text/plain")
|
||||
|
@ -34,17 +34,21 @@ class MyRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
|
|||
if __name__ == "__main__":
|
||||
from optparse import OptionParser
|
||||
p = OptionParser()
|
||||
p.add_option("-a", "--addr", type="string", default="localhost",
|
||||
p.add_option("-a",
|
||||
"--addr",
|
||||
type="string",
|
||||
default="localhost",
|
||||
help=("listen on given address (numeric IP or host name), "
|
||||
"an empty string (the default) means INADDR_ANY"))
|
||||
p.add_option("-p", "--port", type="int", default=32123,
|
||||
help="listen on given TCP port number")
|
||||
p.add_option("-m", "--max", type="int", default=-1,
|
||||
p.add_option("-p", "--port", type="int", default=32123, help="listen on given TCP port number")
|
||||
p.add_option("-m",
|
||||
"--max",
|
||||
type="int",
|
||||
default=-1,
|
||||
help="max number of requests to respond to, -1 means no max")
|
||||
options, args = p.parse_args()
|
||||
|
||||
httpd = BaseHTTPServer.HTTPServer((options.addr, options.port),
|
||||
MyRequestHandler)
|
||||
httpd = BaseHTTPServer.HTTPServer((options.addr, options.port), MyRequestHandler)
|
||||
if options.max == -1:
|
||||
httpd.serve_forever()
|
||||
else:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue