From f4b45deb7ffa299b5f17fde787c7b9152ba96b14 Mon Sep 17 00:00:00 2001 From: John Piasetzki Date: Thu, 20 Oct 2016 00:16:16 -0400 Subject: [PATCH] Convert dict to set --- sanic/router.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sanic/router.py b/sanic/router.py index 45248cde..2d04c9b9 100644 --- a/sanic/router.py +++ b/sanic/router.py @@ -50,9 +50,8 @@ class Router: """ # Dict for faster lookups of if method allowed - methods_dict = None if methods: - methods_dict = {method: True for method in methods} + methods = frozenset(methods) parameters = [] @@ -73,7 +72,7 @@ class Router: pattern = re.compile(r'^{}$'.format(pattern_string)) route = Route( - handler=handler, methods=methods_dict, pattern=pattern, + handler=handler, methods=methods, pattern=pattern, parameters=parameters) self.routes.append(route)