In [37]:
# coding=utf8
from SentenceParserPython3 import SentenceParser
import pandas as pd
import numpy as np
from bs4 import BeautifulSoup
import sys
import re
def printProgressBar (iteration, total, prefix = '', suffix = '', decimals = 1, length = 100, fill = '='):
    percent = ("{0:." + str(decimals) + "f}").format(100 * (iteration / float(total)))
    filledLength = int(length * iteration // total)
    bar = fill * filledLength + '.' * (length - filledLength)
    sys.stdout.write('\r%s |%s| %s%% %s' % (prefix, bar, percent, suffix))
    sys.stdout.flush()

In [40]:
def matchgit(test_str):
    teststr = re.sub(r'[\n\r\t\a\b]+', ' ', test_str)
    pattern =  r'\[Git Change .*\](.*)Bug ([0-9]+)'
    templist = []
    for item in re.findall(pattern, test_str):
        templist.append(item[0])
    return templist, re.sub(pattern, ' ', test_str)

matchgit(mystr)


Out[40]:
([],
 '\n\n[Git Change 2081e0570c0c63a6c90c15194d4667098502eea0 by Michael Frydrych \n(Branch: dev-gfx Repo: tegra/tests-graphics/android)] \n\nhwcomposer: use correct egl context\n\nEgl context needs to be reactivated after the control returns from\nhwcomposer set back to the test. At least the compression tests\ndefined in test_gl_compression.cpp have had this fault. Failure to\nreactivate its own egl context may have led to destruction of objects\nfrom hwcomposer context which has been active at that time.\n\nBug 1899629\n\nChange-Id: I98b6f75d61d9f5b1514f051f9beafcf0732a92aa\nReviewed-on: http://git-master/r/1490341\n(cherry picked from commit 0935ae6f713d05497e7ab832e6ddd48ea567a0d6)\nReviewed-on: http://git-master/r/1493015\nReviewed-by: Michael Frydrych <mfrydrych@nvidia.com>\nTested-by: Michael Frydrych <mfrydrych@nvidia.com>\n')

In [38]:
mystr = """

[Git Change 2081e0570c0c63a6c90c15194d4667098502eea0 by Michael Frydrych 
(Branch: dev-gfx Repo: tegra/tests-graphics/android)] 

hwcomposer: use correct egl context

Egl context needs to be reactivated after the control returns from
hwcomposer set back to the test. At least the compression tests
defined in test_gl_compression.cpp have had this fault. Failure to
reactivate its own egl context may have led to destruction of objects
from hwcomposer context which has been active at that time.

Bug 1899629

Change-Id: I98b6f75d61d9f5b1514f051f9beafcf0732a92aa
Reviewed-on: http://git-master/r/1490341
(cherry picked from commit 0935ae6f713d05497e7ab832e6ddd48ea567a0d6)
Reviewed-on: http://git-master/r/1493015
Reviewed-by: Michael Frydrych <mfrydrych@nvidia.com>
Tested-by: Michael Frydrych <mfrydrych@nvidia.com>
"""

In [ ]: