Adhere to flake8

This commit is contained in:
Madhur Tandon 2018-12-07 22:51:56 +05:30
parent 0a72c4efd8
commit 369ce905c1
1 changed files with 13 additions and 4 deletions

View File

@ -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,6 +46,7 @@ def main(args):
httpd.shutdown()
sys.exit()
if __name__ == "__main__":
parser = make_parser(argparse.ArgumentParser())
args = parser.parse_args()