def add_metadata(current_bug):
    # deal with all the bug metadata
    bug_object = Bug()
    bug_object.id = current_bug.find('bug_id').text
    bug_object.name = current_bug.find('short_desc').text
    bug_object.project = current_bug.find('product').text
    bug_object.component = current_bug.find('component').text
    bug_object.status = current_bug.find('bug_status').text
    bug_object.resolution = current_bug.find('resolution').text
    bug_object.priority = current_bug.find('priority').text
    bug_object.severity = current_bug.find('bug_severity').text
    bug_object.assignee = current_bug.find('assigned_to').get('name')
    return bug_object
Example #2
0
def getfunc():

    if request.method == "GET":
        return render_template('index.html')

    datum = request.get_json()
    return Check(Bug(datum['length'], datum['width']), W, B)
Example #3
0
 def populate(codeNum, teams):
     for j in range(1, teams + 1):
         for i in range(10):
             x = random.randint(0,19)
             y = random.randint(0,19)
             while [x,y] in taken:
                 x = random.randint(0,19)
                 y = random.randint(0,19)
                 
             bug.append(Bug(codes[codeNum], [x,y], random.randint(0,3), j))
Example #4
0
    def __convert_line(self, line_entry):
        line_entry_splited = line_entry.split(",")

        id = line_entry_splited[0]
        date_created = line_entry_splited[1]
        date_resolved = line_entry_splited[2]
        assignee = line_entry_splited[3]
        reporter = line_entry_splited[4]
        summary = line_entry_splited[5]

        return Bug(id, date_created, date_resolved, assignee, reporter,
                   summary)
Example #5
0
    def populate(self):
        '''
        Creates the bug objects and corresponding canvas graphics.
        '''

        for team in range(len(teams)):
            for i in range(teams[team].numBugs):
                x = randint(0, 19)
                y = randint(0, 19)
                while Grid.get_pos([x, y]) != Grid.states.EMPTY:
                    x = randint(0, 19)
                    y = randint(0, 19)

                bug = Bug([x, y], randint(0, 3), teams[team])
                self.buglist.append(bug)
                self.bugimages.append(self.canvas.create_image(bug._pos[0]*20+14,bug._pos[1]*20+14, \
                                                           image=self.bugdict["bug"+str(team+1)+str(bug._direction)]))

            # Set up graphics for bug statistics in the right panel
            self.canvas.create_rectangle(415, team * 70 + 2, 595, team * 70 + 64, \
                                         fill="#fafafa", outline="#ddd")
            self.teamLabels.append(
                self.canvas.create_text(420,
                                        team * 70 + 6,
                                        text="Team " + str(team + 1),
                                        anchor=NW,
                                        font=("Helvetica", "13"),
                                        fill="#444"))
            self.teamCurrentLabels.append(
                self.canvas.create_text(420,
                                        team * 70 + 44,
                                        text="Current: " +
                                        str(teams[team].numBugs),
                                        anchor=NW,
                                        fill="#444"))
            self.teamMinLabels.append(
                self.canvas.create_text(495,
                                        team * 70 + 44,
                                        text="Min: " +
                                        str(teams[team].minBugs),
                                        anchor=NW,
                                        fill="#444"))
            self.teamMaxLabels.append(
                self.canvas.create_text(550,
                                        team * 70 + 44,
                                        text="Max: " +
                                        str(teams[team].maxBugs),
                                        anchor=NW,
                                        fill="#444"))
            self.teamGraphs.append(self.canvas.create_rectangle(415, \
                                            team * 70 + 27, 420 + 167 * teams[team].percent(), \
                                            team * 70 + 42, fill=colors[team], outline=borders[team]))
Example #6
0
def getBugs(bugData):
    bugs = bugData.keys()
    url = 'https://bugzilla.mozilla.org/rest/bug?id={}'.format(", ".join(bugs))
    # print url
    resp = requests.get(url)
    if(resp.status_code != 200):
        print '\n*** ERROR: GET {} {}'.format(url, resp.status_code)
    resp_json = resp.json()
    bugs = []
    for b in resp_json["bugs"]:
        bugNum = str(b.get("id"))
        epic = bugData[bugNum].get("epic")
        altStatus = bugData[bugNum].get("altStatus")

        bug = Bug(bugNum, b.get("summary"), b.get("priority"), b.get("assigned_to"),
                  epic, b.get("status"), altStatus)
        if "estimate" in bugData[bugNum]:
            estimate = bugData[bugNum].get("estimate")
            bug.setEstimate(estimate)
        bugs.append(bug)

    return bugs
Example #7
0
from Bug import Bug
import numpy as np
from Viewer import draw
import cv2


if __name__ == '__main__':
    np.random.seed(60
                   )
    maze = Maze(10, 10)
    maze.reset()
    for _ in range(50):
        ant = Ant(np.random.randint(10), np.random.randint(10))
        maze.add(ant)
    for _ in range(5):
        bug = Bug(np.random.randint(10), np.random.randint(10))
        maze.add(bug)

    for step in range(100):
        print('step: ', step)
        all_agents = maze.get_all_agents()
        for agent in all_agents:
            obs = agent.get_obs(maze)
            action = agent.step(maze, obs)
        print(maze)
        all_agents = maze.get_all_agents()
        print('%d ants, %d bugs' % (sum([agent.__class__.__name__ == 'Ant' for agent in all_agents]),
                                    sum([agent.__class__.__name__ == 'Bug' for agent in all_agents])))
        img = draw(maze)
        cv2.imshow('test', img)
        cv2.waitKey()
Example #8
0
def Test():
    count = 0
    for bug in test_data:
        inp = np.array([[bug['l'], bug['w']]])
        res = W.dot(inp.transpose()) + B
        res = activation_function(res)
        if res == bug['T']:
            count += 1
    print("Accuracy: ", count * 100 / len(test_data), "%")


# Custom Tests:
def Check(bug):
    inp = np.array([[bug.length, bug.width]])
    res = W.dot(inp.transpose()) + B
    res = activation_function(res)
    if res == 1:
        print(f"L: {bug.length}, W: {bug.width} It's a ladybird")
    elif res == 0:
        print(f"L: {bug.length}, W: {bug.width} It's a caterpillar")


Test()
Check(Bug(4, 5))
Check(Bug(1, 3))
Check(Bug(3, 1))
Check(Bug(16, 5))
Check(Bug(31, 23))
Check(Bug(4.4, 5.7))
Check(Bug(4, 6.2))
Example #9
0
from Bug import Bug  #Bug(width,length)

training_data = [Bug(3, 1), Bug(1, 3)]

slope = 0.25  # Y = mX (m = 0.25)
L = 0.45  # Learning Rate

for bug in training_data:
    y = slope * bug.width
    Y = bug.length
    E = Y - y
    change_in_slope = E / bug.width
    change_in_slope *= L
    slope += change_in_slope
    print(slope)


def Test(bug):
    check = bug.length / bug.width
    if check <= slope:
        print("It's a ladybird")
    else:
        print("It's a caterpillar")


Test(Bug(4, 5))
Test(Bug(1, 3))
Test(Bug(4.4, 5.7))
Test(Bug(4, 6.2))
 def make_obstacle(self):
     return Bug()
Example #11
0
from Bug import Bug
path_to_file = 'C:/Users/johnp/Videos/dotenv.xml'
path_to_output = 'C:/Users/johnp/Videos/output.xml'
lol = Bug.Bug(path_to_file, path_to_output, 1)
lol.scrub_emails