Permalink
Browse files

more pythonic way to find 'fatal' in string

use 'in' instead of find.
  • Loading branch information...
1 parent 50615c9 commit aca152237bfe4b7e54a5c2cfe9b88d76793da400 @olivierverdier committed May 4, 2012
Showing with 2 additions and 2 deletions.
  1. +2 −2 gitstatus.py
View
@@ -14,14 +14,14 @@
error_string = error.decode('utf-8')
-if error_string.find('fatal: Not a git repository') != -1:
+if 'fatal: Not a git repository' in error_string:
sys.exit(0)
branch = branch.strip()[11:]
res, err = Popen(['git','diff','--name-status'], stdout=PIPE, stderr=PIPE).communicate()
err_string = err.decode('utf-8')
-if err_string.find('fatal') != -1:
+if 'fatal' in err_string:
sys.exit(0)
changed_files = [namestat[0] for namestat in res.splitlines()]
staged_files = [namestat[0] for namestat in Popen(['git','diff', '--staged','--name-status'], stdout=PIPE).communicate()[0].splitlines()]

0 comments on commit aca1522

Please sign in to comment.