Add static typing for utils.safeRelativePath

This commit is contained in:
Romain Failliot 2022-01-09 14:23:11 -05:00
parent 1b03b56e6a
commit dd57b466ef
1 changed files with 2 additions and 1 deletions

View File

@ -28,6 +28,7 @@ from gettext import gettext as _
from typing import Final, List, Optional, TextIO
from diffuse import constants
from diffuse.preferences import Preferences
from diffuse.resources import theResources
import gi # type: ignore
@ -143,7 +144,7 @@ def relpath(a: str, b: str) -> str:
# helper function prevent files from being confused with command line options
# by prepending './' to the basename
def safeRelativePath(abspath1, name, prefs, cygwin_pref):
def safeRelativePath(abspath1: str, name: str, prefs: Preferences, cygwin_pref: str) -> str:
s = os.path.join(os.curdir, relpath(abspath1, os.path.abspath(name)))
if isWindows():
if prefs.getBool(cygwin_pref):