Fixed mypy config.

This commit is contained in:
Martin Mahner 2020-06-03 16:51:16 +02:00
parent ba0faeffd0
commit e5a267ffbf

View file

@ -1,29 +1,16 @@
import os
from contextlib import contextmanager from contextlib import contextmanager
from typing import Iterator from typing import Iterator
from monkeytype.config import DefaultConfig from monkeytype.config import DefaultConfig
class DpasteConfig(DefaultConfig): class MyConfig(DefaultConfig):
@contextmanager @contextmanager
def cli_context(self, command: str) -> Iterator[None]: def cli_context(self, command: str) -> Iterator[None]:
"""
Django Settings setup
"""
try:
import dpaste.settings.local # isort: skip
settings = "dpaste.settings.local"
except ImportError:
settings = "dpaste.settings.base"
os.environ.setdefault("DJANGO_SETTINGS_MODULE", settings)
import django # isort: skip import django # isort: skip
django.setup() django.setup()
yield yield
CONFIG = DpasteConfig() config = MyConfig()