Skip to content

Commit cf564cf

Browse files
committed
MNT: Add type annotations to other pkg_info functions
1 parent 9b6705d commit cf564cf

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

nibabel/pkg_info.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import annotations
2+
13
import sys
24
from subprocess import run
35

@@ -12,12 +14,12 @@
1214
COMMIT_HASH = '$Format:%h$'
1315

1416

15-
def _cmp(a, b):
17+
def _cmp(a, b) -> int:
1618
"""Implementation of ``cmp`` for Python 3"""
1719
return (a > b) - (a < b)
1820

1921

20-
def cmp_pkg_version(version_str, pkg_version_str=__version__):
22+
def cmp_pkg_version(version_str: str, pkg_version_str: str = __version__) -> int:
2123
"""Compare ``version_str`` to current package version
2224
2325
This comparator follows `PEP-440`_ conventions for determining version
@@ -68,7 +70,7 @@ def cmp_pkg_version(version_str, pkg_version_str=__version__):
6870
return _cmp(Version(version_str), Version(pkg_version_str))
6971

7072

71-
def pkg_commit_hash(pkg_path: str = None):
73+
def pkg_commit_hash(pkg_path: str = None) -> tuple[str, str]:
7274
"""Get short form of commit hash
7375
7476
In this file is a variable called COMMIT_HASH. This contains a substitution
@@ -111,7 +113,7 @@ def pkg_commit_hash(pkg_path: str = None):
111113
return '(none found)', '<not found>'
112114

113115

114-
def get_pkg_info(pkg_path):
116+
def get_pkg_info(pkg_path: str) -> dict:
115117
"""Return dict describing the context of this package
116118
117119
Parameters

0 commit comments

Comments
 (0)