Skip to content

Commit

Permalink
MNT refactor: subprocess.run -> run_subprocess (#352)
Browse files Browse the repository at this point in the history
* subprocess.run -> run_subprocess

* Review comments

* Last fixes

* Move from init

Co-authored-by: Adrin Jalali <adrin.jalali@gmail.com>
  • Loading branch information
LysandreJik and adrinjalali committed Apr 26, 2022
1 parent b37d7b5 commit e61f39b
Show file tree
Hide file tree
Showing 4 changed files with 132 additions and 265 deletions.
10 changes: 4 additions & 6 deletions src/huggingface_hub/commands/user.py
Expand Up @@ -26,6 +26,8 @@
from huggingface_hub.hf_api import HfApi, HfFolder
from requests.exceptions import HTTPError

from ..utils import run_subprocess


class UserCommands(BaseHuggingfaceCLICommand):
@staticmethod
Expand Down Expand Up @@ -122,13 +124,9 @@ def tabulate(rows: List[List[Union[str, int]]], headers: List[str]) -> str:

def currently_setup_credential_helpers(directory=None) -> List[str]:
try:
output = subprocess.run(
output = run_subprocess(
"git config --list".split(),
stderr=subprocess.PIPE,
stdout=subprocess.PIPE,
encoding="utf-8",
check=True,
cwd=directory,
directory,
).stdout.split("\n")

current_credential_helpers = []
Expand Down

0 comments on commit e61f39b

Please sign in to comment.