Skip to content

Commit

Permalink
fixed git module: using subprocess instead of ipython syntax '!'
Browse files Browse the repository at this point in the history
  • Loading branch information
ibressler committed Sep 28, 2020
1 parent 4c1f620 commit 95e7851
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions git.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,20 @@
# git.py

import os
import subprocess

def isRepo(path):
return os.path.exists(os.path.join(path, ".git"))

def isNBstripoutInstalled():
out = !nbstripout --status
return len(out) and "not recognized" not in out[0]
out = subprocess.run(["nbstripout", "--status"],
stdout=subprocess.PIPE, stderr=subprocess.PIPE).stdout.decode("utf-8")
return len(out) and "not recognized" not in out

def isNBstripoutActivated():
out = !nbstripout --status
return len(out) and "is installed" in out[0]
out = subprocess.run(["nbstripout", "--status"],
stdout=subprocess.PIPE, stderr=subprocess.PIPE).stdout.decode("utf-8")
return len(out) and "is installed" in out

def checkRepo():
if not isRepo("."):
Expand Down

0 comments on commit 95e7851

Please sign in to comment.