From 369ce905c1a0243bf88e8f84814e2dcf6ab0dc5e Mon Sep 17 00:00:00 2001 From: Madhur Tandon Date: Fri, 7 Dec 2018 22:51:56 +0530 Subject: [PATCH] Adhere to flake8 --- pyodide_build/serve.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/pyodide_build/serve.py b/pyodide_build/serve.py index 284161d5c..813727706 100644 --- a/pyodide_build/serve.py +++ b/pyodide_build/serve.py @@ -8,23 +8,31 @@ import pathlib TEST_PATH = pathlib.Path(__file__).parents[0].resolve() BUILD_PATH = TEST_PATH / '..' / 'build' + class Handler(http.server.SimpleHTTPRequestHandler): def end_headers(self): self.send_header('Access-Control-Allow-Origin', '*') super().end_headers() + Handler.extensions_map['.wasm'] = 'application/wasm' + def make_parser(parser): - parser.description = ('Start a server with the supplied build_dir and port.') - parser.add_argument('--build_dir', action='store', type=str, default=BUILD_PATH, help='set the build directory') - parser.add_argument('--port', action='store', type=int, default=8000, help='set the PORT number') + parser.description = ('Start a server with the supplied ' + 'build_dir and port.') + parser.add_argument('--build_dir', action='store', type=str, + default=BUILD_PATH, help='set the build directory') + parser.add_argument('--port', action='store', type=int, + default=8000, help='set the PORT number') return parser + def server(port): httpd = socketserver.TCPServer(('', port), Handler) return httpd + def main(args): build_dir = args.build_dir port = args.port @@ -38,7 +46,8 @@ def main(args): httpd.shutdown() sys.exit() + if __name__ == "__main__": parser = make_parser(argparse.ArgumentParser()) args = parser.parse_args() - main(args) \ No newline at end of file + main(args)