Skip to content

Commit

Permalink
TYP: some types for util._print_versions (#29880)
Browse files Browse the repository at this point in the history
  • Loading branch information
simonjayhawkins authored and jreback committed Nov 27, 2019
1 parent eba821a commit 42a4fcd
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions pandas/util/_print_versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@
import struct
import subprocess
import sys
from typing import List, Optional, Tuple, Union

from pandas.compat._optional import VERSIONS, _get_version, import_optional_dependency


def get_sys_info():
"Returns system information as a dict"
def get_sys_info() -> List[Tuple[str, Optional[Union[str, int]]]]:
"Returns system information as a list"

blob = []
blob: List[Tuple[str, Optional[Union[str, int]]]] = []

# get full commit hash
commit = None
Expand All @@ -29,12 +30,7 @@ def get_sys_info():
pass
else:
if pipe.returncode == 0:
commit = so
try:
commit = so.decode("utf-8")
except ValueError:
pass
commit = commit.strip().strip('"')
commit = so.decode("utf-8").strip().strip('"')

blob.append(("commit", commit))

Expand Down Expand Up @@ -99,6 +95,7 @@ def show_versions(as_json=False):
mod = import_optional_dependency(
modname, raise_on_missing=False, on_version="ignore"
)
ver: Optional[str]
if mod:
ver = _get_version(mod)
else:
Expand Down

0 comments on commit 42a4fcd

Please sign in to comment.