Skip to content

Commit 2663982

Browse files
committed
MNT: Add type annotations to other pkg_info functions
1 parent c9965ce commit 2663982

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

35
from packaging.version import Version
@@ -11,12 +13,12 @@
1113
COMMIT_HASH = '$Format:%h$'
1214

1315

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

1820

19-
def cmp_pkg_version(version_str, pkg_version_str=__version__):
21+
def cmp_pkg_version(version_str: str, pkg_version_str: str = __version__) -> int:
2022
"""Compare ``version_str`` to current package version
2123
2224
This comparator follows `PEP-440`_ conventions for determining version
@@ -67,7 +69,7 @@ def cmp_pkg_version(version_str, pkg_version_str=__version__):
6769
return _cmp(Version(version_str), Version(pkg_version_str))
6870

6971

70-
def pkg_commit_hash(pkg_path: str = None):
72+
def pkg_commit_hash(pkg_path: str = None) -> tuple[str, str]:
7173
"""Get short form of commit hash
7274
7375
In this file is a variable called COMMIT_HASH. This contains a substitution
@@ -112,7 +114,7 @@ def pkg_commit_hash(pkg_path: str = None):
112114
return '(none found)', '<not found>'
113115

114116

115-
def get_pkg_info(pkg_path):
117+
def get_pkg_info(pkg_path: str) -> dict:
116118
"""Return dict describing the context of this package
117119
118120
Parameters

0 commit comments

Comments
 (0)