Browse Source

Add labours script

Vadim Markovtsev 8 years ago
parent
commit
ad401f5a7c
2 changed files with 20 additions and 3 deletions
  1. 3 3
      README.md
  2. 17 0
      labours.py

+ 3 - 3
README.md

@@ -6,9 +6,9 @@ This tool calculates the weekly lines burnout in a Git repository.
 ###Usage
 
 ```
-hercules https://github.com/src-d/go-git
-hercules /path/to/cloned/go-git
-hercules https://github.com/torvalds/linux /tmp/linux_cache
+hercules https://github.com/src-d/go-git | python3 labours.py
+hercules /path/to/cloned/go-git | python3 labours.py
+hercules https://github.com/torvalds/linux /tmp/linux_cache | python3 labours.py
 ```
 
 ###License

+ 17 - 0
labours.py

@@ -0,0 +1,17 @@
+import sys
+
+import matplotlib.pyplot as pyplot
+import numpy
+import seaborn  # to get nice colors, he-he
+
+
+def main():
+    matrix = []
+    for line in sys.stdin.read().split("\n")[:-1]:
+        matrix.append(numpy.fromstring(line, dtype=int, sep=" "))
+    matrix = numpy.array(matrix).T
+    pyplot.stackplot(numpy.arange(matrix.shape[1]), matrix)
+    pyplot.show()
+
+if __name__ == "__main__":
+    sys.exit(main())