Fix type checking

This commit is contained in:
Paul Nameless 2020-09-09 10:40:41 +03:00
parent 78a5a30f65
commit 5c067ab5c7
2 changed files with 5 additions and 5 deletions

View file

@ -5,7 +5,7 @@ overwritten by external config file
import os
import platform
import runpy
from typing import Dict
from typing import Dict, Optional
_os_name = platform.system()
_darwin = "Darwin"
@ -15,7 +15,7 @@ _linux = "Linux"
CONFIG_DIR = os.path.expanduser("~/.config/tg/")
CONFIG_FILE = os.path.join(CONFIG_DIR, "conf.py")
FILES_DIR = os.path.expanduser("~/.cache/tg/")
MAILCAP_FILE = None
MAILCAP_FILE: Optional[str] = None
LOG_LEVEL = "INFO"
LOG_PATH = os.path.expanduser("~/.local/share/tg/")

View file

@ -17,7 +17,7 @@ from functools import lru_cache
from logging.handlers import RotatingFileHandler
from subprocess import CompletedProcess
from types import TracebackType
from typing import Any, Optional, Tuple, Type
from typing import Any, Dict, Optional, Tuple, Type
from tg import config
@ -72,10 +72,10 @@ def get_mime(file_path: str) -> str:
return mtype.split("/")[0]
def get_mailcap():
def get_mailcap() -> Dict:
if config.MAILCAP_FILE:
with open(config.MAILCAP_FILE) as f:
return mailcap.readmailcapfile(f)
return mailcap.readmailcapfile(f) # type: ignore
return mailcap.getcaps()