Skip to content

TYP: some types for util._print_versions #29880

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 27, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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