Skip to content

Commit 4ec7b38

Browse files
authored
Merge pull request #5925 from mbaluna/mypy-annotations-for-utils-appdirs
Add mypy annotations for utils/appdirs
2 parents b72a5da + eed9489 commit 4ec7b38

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/pip/_internal/utils/appdirs.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,16 @@
1010
from pip._vendor.six import PY2, text_type
1111

1212
from pip._internal.utils.compat import WINDOWS, expanduser
13+
from pip._internal.utils.typing import MYPY_CHECK_RUNNING
14+
15+
if MYPY_CHECK_RUNNING:
16+
from typing import ( # noqa: F401
17+
List, Union
18+
)
1319

1420

1521
def user_cache_dir(appname):
22+
# type: (str) -> str
1623
r"""
1724
Return full path to the user-specific cache dir for this application.
1825
@@ -61,6 +68,7 @@ def user_cache_dir(appname):
6168

6269

6370
def user_data_dir(appname, roaming=False):
71+
# type: (str, bool) -> str
6472
r"""
6573
Return full path to the user-specific data dir for this application.
6674
@@ -113,6 +121,7 @@ def user_data_dir(appname, roaming=False):
113121

114122

115123
def user_config_dir(appname, roaming=True):
124+
# type: (str, bool) -> str
116125
"""Return full path to the user-specific config dir for this application.
117126
118127
"appname" is the name of application.
@@ -146,6 +155,7 @@ def user_config_dir(appname, roaming=True):
146155
# for the discussion regarding site_config_dirs locations
147156
# see <https://github.com/pypa/pip/issues/1733>
148157
def site_config_dirs(appname):
158+
# type: (str) -> List[str]
149159
r"""Return a list of potential user-shared config dirs for this application.
150160
151161
"appname" is the name of application.
@@ -186,6 +196,7 @@ def site_config_dirs(appname):
186196
# -- Windows support functions --
187197

188198
def _get_win_folder_from_registry(csidl_name):
199+
# type: (str) -> str
189200
"""
190201
This is a fallback technique at best. I'm not sure if using the
191202
registry for this guarantees us the correct answer for all CSIDL_*
@@ -208,6 +219,7 @@ def _get_win_folder_from_registry(csidl_name):
208219

209220

210221
def _get_win_folder_with_ctypes(csidl_name):
222+
# type: (str) -> str
211223
csidl_const = {
212224
"CSIDL_APPDATA": 26,
213225
"CSIDL_COMMON_APPDATA": 35,

0 commit comments

Comments
 (0)