def visualization(): while (True): print("\n\t----------Please specify the visualization----------") command = raw_input( "\t\tType 'a' for viewing contribution of all members;\n\t\tType 'b' for viewing commit history of a user;\n\t\tType 'c' for viewing commit history comparison;\n\t\tType 'd' for viewing commit history of a file;\n\t\tType 'e' for viewing number of lines of code;\n\t\tType others to go back to the main menu;\n\t\t\tSpecify your command: " ) if command == "a": print("\n\t----------Task A----------") contribution.main() elif command == "b": print("\n\t----------Task B----------") onecontributor.main() elif command == "c": print("\n\t----------Task C----------") compare.main() elif command == "d": print("\n\t----------Task D----------") commithistory.main() elif command == "e": print("\n\t----------Task E----------") lines.main() else: print break
def test_union(): sys.stdout = io.StringIO() lines.main(["-u", "examples/f1", "examples/f2"]) output = set(sys.stdout.getvalue().split()) assert output == set(["a", "b", "c", "d", "e", "f"])
def test_patterns(): sys.stdout = io.StringIO() lines.main(["--patterns", "examples/f4"]) output = sys.stdout.getvalue() assert output == "17 elements\n1 elements - {'Wintermute'}\n"
def test_squeeze(): sys.stdout = io.StringIO() lines.main(["--squeeze", "examples/f3"]) output = sys.stdout.getvalue() assert output == "a\nb\nc\nd\ne\nf\n"
def test_symmetric_difference(): sys.stdout = io.StringIO() lines.main(["-s", "examples/f1", "examples/f2"]) output = set(sys.stdout.getvalue().split()) assert output == set(["a", "b", "e", "f"])
def test_relative_complement(): sys.stdout = io.StringIO() lines.main(["-d", "examples/f1", "examples/f2"]) output = set(sys.stdout.getvalue().split()) assert output == set(["a", "b"])
def test_intersection(): sys.stdout = io.StringIO() lines.main(["-i", "examples/f1", "examples/f2"]) output = set(sys.stdout.getvalue().split()) assert output == set(["c", "d"])
from lines import main from tesseract import matchTemplate import numpy as np import cv2 img, dist, count = main('../img/test-2.png') grid = np.zeros((count, count)) width, height, shape = img.shape def getBox(x, y, pad): x1 = max(x * dist - pad, 0) x2 = min((x + 1) * dist + pad, width) y1 = max(y * dist - pad, 0) y2 = min((y + 1) * dist + pad, height) return img[x1:x2, y1:y2] crop = matchTemplate(getBox(7, 5, 20)) w, h, shape = getBox(7, 5, 20).shape sides = { "top": crop[:round(w / 2), :], "bottom": crop[round(w / 2):, :], "right": crop[:, :round(w / 2)], "left": crop[:, round(w / 2):], } top = crop[round(w / 2):, :] gray = cv2.cvtColor(top, cv2.COLOR_BGR2GRAY) kernel = np.ones((3, 3), np.uint8)