add type annotations in run and create_server

This commit is contained in:
Sergey Fedoruk
2019-01-01 23:58:59 +01:00
committed by Sergey Fedoruk
parent a86a10b128
commit b7a6f36e95
2 changed files with 67 additions and 30 deletions

View File

@@ -1,5 +1,6 @@
import os
import types
from distutils.util import strtobool
from sanic.exceptions import PyFileError
@@ -124,7 +125,7 @@ class Config(dict):
try:
self[config_key] = float(v)
except ValueError:
if v in ["True", "False"]:
self[config_key] = v == "True"
else:
try:
self[config_key] = bool(strtobool(v))
except ValueError:
self[config_key] = v