예제 #1
0
def revise_node(content, amr_nodes_content, amr_nodes_acronym):
    '''
	In case of single '()' contains multiple nodes
	e.x. (m / moment :poss p5)

	:param str context:
	:param dict amr_nodes_content: content as key
	:param dict amr_nodes_acronym: acronym as key
	'''
    m = re.search('\w+\s/\s\S+\s+(.+)', content.replace('\n', ''))
    if m and ' / name' not in content and ':polarity -' not in content:
        arg_nodes = []
        acr = re.search('\w+\s/\s\S+', content).group().split(' / ')[0]
        nodes = re.findall('\S+\s\".+\"|\S+\s\S+', m.group(1))
        for i in nodes:
            i = re.search('(:\S+)\s(.+)', i)
            role = i.group(1)
            concept = i.group(2).strip(')')
            if concept in amr_nodes_acronym:
                node = copy.copy(amr_nodes_acronym[concept])
                node.next_nodes = []
            else:  # in case of (d / date-entity :year 2012)
                node = Node(name=concept)
                amr_nodes_acronym[concept] = node
            node.edge_label = role
            arg_nodes.append(node)
        amr_nodes_acronym[acr].next_nodes = arg_nodes
        amr_nodes_content[content].next_nodes = arg_nodes
	def generate(self, data, attributes):
		itemsPerClass = Controller.classCount(data)
		if len(itemsPerClass.keys()) == 1:
			return Node(data[0][0])

		elif len(attributes.keys()) == 0:
			decision = ''
			for key in itemsPerClass:
				decision += key
			print(decision)
			print(attributes.keys())
			return Node(decision)
		else:
			divisions = [[Controller.groupData(data, attributes[label]), label] for label in attributes]
			for pair in divisions:
				pair.append(Controller.entropy(data) - Controller.infoGain(pair[0]))
			divisions.sort(key=lambda e: e[2], reverse=True)
			choice = divisions[0]
			attributes = Controller.updateAttributes(attributes, choice[1])
			separationNode = Node(choice[1])
			if len(attributes.keys()) == 0:
				for row in data:
					separationNode.addChildren(Node(row[0]), row[1])
				return separationNode
			for value in choice[0]:
				separationNode.addChildren(self.generate(choice[0][value], deepcopy(attributes)), value)
			return separationNode
예제 #3
0
 def fit(self, X, y, min_leaf=10, max_depth=6):
     X.index = range(0, X.shape[0], 1)
     y.index = range(0, X.shape[0], 1)
     self.endi = X.index.stop
     #y_test.index=range(4320, 4320+X_test.shape[0],1)
     self.dtree = Node(X,
                       y,
                       np.array(np.arange(len(y))),
                       min_leaf,
                       max_depth=max_depth,
                       depth=0)
     return self
예제 #4
0
파일: node.py 프로젝트: Fuyingxue/luntan
def node_add():
    r = {}
    n_json = request.get_json()
    n = Node.query.filter_by(name=n_json.get('name')).first()
    if n is not None:
        r['success'] = False
        r['message'] = "节点已存在"
    else:
        node = Node(n_json)
        node.save()
        r['success'] = True
        r['data'] = node.json()
    return jsonify(r)
예제 #5
0
def generate_node_single(content, amr_nodes_content, amr_nodes_acronym):
    '''
    Generate Node object for single '()'

    :param str context:
    :param dict amr_nodes_content: content as key
    :param dict amr_nodes_acronym: acronym as key
    '''
    try:
        assert content.count('(') == 1 and content.count(')') == 1
    except AssertionError:
        raise Exception('Unmatched parenthesis')

    predict_event = re.search('(\w+)\s/\s(\S+)', content)
    if predict_event:
        acr = predict_event.group(1) # Acronym
        ful = predict_event.group(2).strip(')') # Full name
    else:
        acr, ful = '-', '-'

    # In case of :polarity -
    is_polarity = True if re.search(":polarity\s-", content) else False

    # Node is a named entity
    names = re.findall(':op\d\s\"\S+\"', content)
    if len(names) > 0:
        entity_name = ''
        for i in names:
            entity_name += re.match(':op\d\s\"(\S+)\"', i).group(1) + ' '
        entity_name = urllib.parse.unquote_plus(entity_name.strip())
        new_node = Node(name=acr, ful_name=ful,
                        entity_name=entity_name,
                        polarity=is_polarity, content=content)
        amr_nodes_content[content] = new_node
        amr_nodes_acronym[acr] = new_node
    else:
        new_node = Node(name=acr, ful_name=ful,
                        polarity=is_polarity, content=content)
        amr_nodes_content[content] = new_node
        amr_nodes_acronym[acr] = new_node
예제 #6
0
    def __init__(self, parent=None):
        super(App, self).__init__(parent)
        print "App"
        self.conn = self.db_connect()
        self.ui = MainUI()
        self.ui.show()

        entity = json2obj(
            '{"category":"groups","path":"/mnt/x19/mavisdev/projects/geotest/sequence/afg_0025","name":"afg_0025","description":"AFG_0025 sequence","fileImportPath":"","isGlobal":false,"project":"geotest","fields":{"priority":"medium","status":"idle"},"createdBy":"trevor","createdAt":"2016-09-13T20:28:04.745Z","updatedAt":"2017-05-31T21:38:19.935Z","id":"57d861546fef3a0001c87954","type":"sequence","mediaIds":[],"isTest":false}')
        entity1 = json2obj(
            '{"category":"assets","path":"/mnt/x19/mavisdev/projects/geotest/globals/assets/wood_log","name":"wood_log","description":"a log that is wooden","fileImportPath":"","isGlobal":false,"project":"geotest","fields":{"priority":"medium","status":"review","grouping":"char","comp_status":"Ready","prod_status":"HIGH"},"createdBy":"dexplorer","createdAt":"2017-06-12T20:07:21.739Z","updatedAt":"2017-06-12T20:07:21.798Z","id":"593ef47973d9f40001cf898b","type":"assets","mediaIds":[],"isTest":false}')
        entity2 = json2obj(
            '{"category":"assets","path":"/mnt/x19/mavisdev/projects/geotest/sequence/afg_0025/shots/afg_0025_0020/plates/plate_afg-0025__0020","name":"plate_afg-0025__0020","description":"plate asse for afg_0025_0020","latest":"583dc9eebc843d0001905bde","fileImportPath":"/mnt/x1/mavisdev/client_imports/geotest/afg_0025_0020/AFG_0025_0020_bg01_v001_LIN.exr","isGlobal":true,"project":"geotest","fields":{"priority":"low","status":"approved","startFrame":10,"endFrame":100,"pxAspect":1,"colorspace":"linear","fileType":"exr","width":1920,"height":1080,"lut":"","ccc":"","head":8,"tail":8,"handle":8},"createdBy":"trevor","createdAt":"2016-11-29T18:31:59.429Z","updatedAt":"2017-05-23T21:17:43.390Z","id":"583dc99fbc843d0001905bd9","type":"plates","mediaIds":[],"parentId":"57d861546fef3a0001c87960","isTest":false}')
        entity3 = json2obj(
            '{"category":"tasks","path":"/mnt/x19/mavisdev/projects/geotest/globals/assets/wood_log/texture/tex_log","name":"tex_log","description":"texture the wood log","latest":"5941b18073d9f40001cf8a6c","fileImportPath":"","isGlobal":false,"project":"geotest","fields":{"priority":"urgent","status":"revised","grouping":"mtpg","comp_status":"In-Progress","prod_status":"HIGH"},"createdBy":"dexplorer","createdAt":"2017-06-12T20:08:10.814Z","updatedAt":"2017-06-14T21:58:24.772Z","id":"593ef4aa73d9f40001cf8992","type":"texture","mediaIds":[],"isTest":false}')
        entity4 = json2obj(
            '{"category":"tasks","path":"/mnt/x19/mavisdev/projects/geotest/sequence/mdm_0202/shots/mdm_0202_0100/assets/tuktuka/model/tuktuk_model","name":"tuktuk_model","description":"published plate 6310","latest":"58c6ffe6e925cc00016a6b58","fileImportPath":"","isGlobal":false,"project":"geotest","fields":{"priority":"high","status":"revised","grouping":"vehi","comp_status":"Waiting","prod_status":"MEDIUM"},"createdBy":"trevor","createdAt":"2017-04-13T22:08:33.983Z","updatedAt":"2017-04-18T20:35:28.557Z","id":"589b4f9dc599d10001375de9","type":"model","mediaIds":[],"parentId":"589b4f10c599d10001375de2","isTest":false}')

        rootNode = Node('Hips')
        childNode0 = Node('LeftPirateleg', entity, rootNode)
        childNode1 = Node('RightLeg', entity1, rootNode)
        childNode2 = Node('RightFoot', entity2, childNode1)
        childNode3 = Node('Xxxree', entity3, childNode2)
        childNode4 = Node('kldjskfds', entity4, childNode1)

        tree = TreeModel(rootNode)
        self.ui.uiTree.setModel(tree)
        print tree
예제 #7
0
    def __init__(self, number_node, resource_per_node, application_requests):
        """
        Constructor
        :param number_node: Integer
        :param resource_per_node: Resource Object
        :param application_requests: Task Array
        """
        self._nodes = []
        for i in range(0, number_node):
            self._nodes[i] = Node(i, resource_per_node)

        self._resource_manager = ResourceManager(self._nodes,
                                                 resource_per_node)
        self._application_request = application_requests
        self._applications = []
        self._simulation_date = None
    def line_to_node(self, line, i):
        splitted_x = line.split('   ')
        if splitted_x[2] == '0' and i > 0:
            capacity = splitted_x[3]
            node_type = 'backhaul'
            self.backhaul_ids.append(i)
        elif i > 0:
            capacity = splitted_x[2]
            node_type = 'linehaul'
            self.linehaul_ids.append(i)
        else:
            capacity = splitted_x[3]
            node_type = 'deposit'

        node = Node(i, int(splitted_x[0]), int(splitted_x[1]), int(capacity),
                    node_type)
        return node
예제 #9
0
class OurDecisionTreeRegressor(object):
    def fit(self, X, y, min_leaf=10, max_depth=6):
        X.index = range(0, X.shape[0], 1)
        y.index = range(0, X.shape[0], 1)
        self.endi = X.index.stop
        #y_test.index=range(4320, 4320+X_test.shape[0],1)
        self.dtree = Node(X,
                          y,
                          np.array(np.arange(len(y))),
                          min_leaf,
                          max_depth=max_depth,
                          depth=0)
        return self

    def predict(self, X):
        X.index = range(self.endi, self.endi + X.shape[0], 1)
        return self.dtree.predict(X.values)
예제 #10
0
 def __create_root_node(self):
     return Node(self.hyper_parameters, self.training_set)
예제 #11
0
def generate_node_single(content, amr_nodes_content, amr_nodes_acronym):
    '''
	Generate Node object for single '()'

	:param str context:
	:param dict amr_nodes_content: content as key
	:param dict amr_nodes_acronym: acronym as key
	'''
    is_named_entity = False
    try:
        assert content.count('(') == 1 and content.count(')') == 1
    except AssertionError:
        raise Exception('Unmatched parenthesis')

    predict_event = re.search('(\w+)\s/\s(\S+)', content)
    if predict_event:
        acr = predict_event.group(1)  # Acronym
        ful = predict_event.group(2).strip(')')  # Full name
    else:
        acr, ful = '-', '-'

    # In case of :polarity -
    is_polarity = True if re.search(":polarity\s-", content) else False

    # :ARG ndoes
    arg_nodes = []
    nodes = re.findall(':\S+\s\S+', content)
    for i in nodes:
        i = re.search('(:\S+)\s(\S+)', i)
        role = i.group(1)
        concept = i.group(2).strip(')')
        if role == ':wiki' and is_named_entity:
            continue
        if role == ':polarity':
            continue
        if concept in amr_nodes_acronym:
            node = copy.copy(amr_nodes_acronym[concept])
            node.next_nodes = []
        # In case of (d / date-entity :year 2012)
        else:
            node = Node(name=concept, original_content=concept)
            amr_nodes_acronym[concept] = node
        node.edge_label = role
        arg_nodes.append(node)

    # Node is a named entity
    names = re.findall(':op\d\s\"\S+\"', content)
    if len(names) > 0:
        entity_name = ''
        for i in names:
            entity_name += re.match(':op\d\s\"(\S+)\"', i).group(1) + ' '
        entity_name = urllib.parse.unquote_plus(entity_name.strip())
        new_node = Node(name=acr,
                        ful_name=ful,
                        next_nodes=arg_nodes,
                        parents=set(),
                        entity_name=entity_name,
                        polarity=is_polarity,
                        content=content,
                        original_content=content)
        amr_nodes_content[content] = new_node
        amr_nodes_acronym[acr] = new_node
    else:
        new_node = Node(name=acr,
                        ful_name=ful,
                        next_nodes=arg_nodes,
                        parents=set(),
                        polarity=is_polarity,
                        content=content,
                        original_content=content)
        amr_nodes_content[content] = new_node
        amr_nodes_acronym[acr] = new_node
예제 #12
0
def generate_nodes_multiple(content, amr_nodes_content, amr_nodes_acronym):
    '''
    Generate Node object for nested '()'

    :param str context:
    :param dict amr_nodes_content: content as key
    :param dict amr_nodes_acronym: acronym as key
    '''
    try:
        assert content.count('(') > 1 and content.count(')') > 1
        assert content.count('(') == content.count(')')
    except AssertionError:
        raise Exception('Unmatched parenthesis')

    _content = content
    arg_nodes = []
    is_named_entity = False

    # Remove existing nodes from the content, and link these nodes to the root
    # of the subtree
    for i in sorted(amr_nodes_content, key=len, reverse=True):
        if i in content:
            e = content.find(i)
            s = content[:e].rfind(':')
            role = re.search(':\S+\s', content[s:e]).group() # Edge label
            content = content.replace(role+i, '', 1)
            amr_nodes_content[i].edge_label = role.strip()
            if ':name' in role:
                is_named_entity = True
                ne = amr_nodes_content[i]
            else:
                arg_nodes.append(amr_nodes_content[i])

    predict_event = re.search('\w+\s/\s\S+', content).group().split(' / ')
    if predict_event:
        acr = predict_event[0] # Acronym
        ful = predict_event[1] # Full name
    else:
        acr, ful = '-', '-'

    # In case of :polarity -
    is_polarity = True if re.search(":polarity\s-", content) else False

    nodes = re.findall(':\S+\s\S+', content)
    for i in nodes:
        i = re.search('(:\S+)\s(\S+)', i)
        role = i.group(1)
        concept = i.group(2).strip(')')
        if role == ':wiki' and is_named_entity:
            continue
        if role == ':polarity':
            continue
        if concept in amr_nodes_acronym:
            node = copy.copy(amr_nodes_acronym[concept])
            node.next_nodes = []
        # In case of (d / date-entity :year 2012)
        else:
            node = Node(name=concept)
            amr_nodes_acronym[concept] = node
        node.edge_label = role
        arg_nodes.append(node)

        # Named entity is a special node, so the subtree of a
        # named entity will be merged. For example,
        #     (p / person :wiki -
        #        :name (n / name
        #                 :op1 "Pascale"))
        # will be merged as one node.
        # According to AMR Specification, "we fill the :instance
        # slot from a special list of standard AMR named entity types".
        # Thus, for named entity node, we will use entity type
        # (p / person in the example above) instead of :instance

    if is_named_entity:
        # Get Wikipedia title:
        if re.match('.+:wiki\s-.*', content):
            wikititle = '-' # Entity is NIL, Wiki title does not exist
        else:
            m = re.search(':wiki\s\"(.+?)\"', content)
            if m:
                wikititle = urllib.parse.unquote_plus(m.group(1)) # Wiki title
            else:
                wikititle = '' # There is no Wiki title information

        new_node = Node(name=acr, ful_name=ful, next_nodes=arg_nodes,
                        edge_label=ne.ful_name, is_entity=True,
                        entity_type=ful, entity_name=ne.entity_name,
                        wiki=wikititle, polarity=is_polarity, content=content)
        amr_nodes_content[_content] = new_node
        amr_nodes_acronym[acr] = new_node

    elif len(arg_nodes) > 0:
        new_node = Node(name=acr, ful_name=ful, next_nodes=arg_nodes,
                        polarity=is_polarity, content=content)
        amr_nodes_content[_content] = new_node
        amr_nodes_acronym[acr] = new_node
예제 #13
0
def node_view():
    data = Node.user_list()
    return render_template('nodes.html', **data)
예제 #14
0
 def add_node(self, node_key, node_value):
     if self._verify_node_exist(node_key):
         print("Node already exist in the graph!")
     else:
         print("Added node {} with value {}!".format(node_key, node_value))
         self.__nodes.append(Node(node_key, node_value))
예제 #15
0
 def __init__(self, order=4):
     self.root = Node(order)
예제 #16
0
class BPlusTree(object):

    # Inicializamos, por defecto en orden 4
    def __init__(self, order=4):
        self.root = Node(order)

    def _find(self, node, key):

        for i, item in enumerate(node.keys):
            if key < item:
                return node.values[i], i

        return node.values[i + 1], i + 1

    def _balance(self, parent, child, index):
      
        parent.values.pop(index)
        pivot = child.keys[0]

        for i, item in enumerate(parent.keys):
            if pivot < item:
                parent.keys = parent.keys[:i] + [pivot] + parent.keys[i:]
                parent.values = parent.values[:i] + child.values + parent.values[i:]
                break

            elif i + 1 == len(parent.keys):
                parent.keys += [pivot]
                parent.values += child.values
                break

    def insert(self, key, value):

        parent = None
        child = self.root

        while not child.leaf:
            parent = child
            child, index = self._find(child, key)

        child.add(key, value)

        if child.is_full():
            child.split()

            if parent and not parent.is_full():
                self._balance(parent, child, index)

    def search(self, key):
 
        child = self.root

        while not child.leaf:
            child, index = self._find(child, key)

        print("-----------------------")

        for i, item in enumerate(child.keys):
            print("Pedido ", i , " -> ", child.values[i])
            if key == item:
                return child.values[i]
        
        print("-----------------------")
        print("👇  Recomendado 👇")
        print("🌎  Posicion: ")
        print("\t\tLongitud:", key.split("$",1)[0])
        print("\t\tLatitud:", key.split("$",1)[1])
        print("\t\tType:  🚀 URGENTE ")
        return child.values[0]
        # return None

    def show(self):
        self.root.show()
예제 #17
0
 def __create_node(self, text) -> Node:
     x = [float(num) for num in text.split()]
     return Node(x[0], x[1], x[2])
예제 #18
0
        else:
            print((" " * (level + 1) * 4) + "Dataset Vazio")
        return
    string = (" " * level * 4) + names[node.attribute]
    print(string)
    if node.splitter:
        for i in range(len(node.splitter.nodes)):
            _node = node.splitter.nodes[i]
            attr_value = node.splitter.possible_values[i]
            print((" " * level * 4) + attr_value)
            print_tree(_node, level + 1)


dataset = DatasetFile("test_benchmark.csv", -1).read()
print(dataset.get_attr_names())
node = Node({"n_attr_sample": 3, "max_depth": 15}, dataset)
example = copy.deepcopy(dataset.get_example_at(0))
# print(node.predict(example))
#
# test_dataset = Dataset([
#     Example([0,1,2,3,4], ["Ensolarado","Fria","Alta","Verdadeiro","Nao"]),
#     Example([0,1,2,3,4], ["Nublado","Fria","Alta","Falso","Sim"]),
#     Example([0,1,2,3,4], ["Chuvoso","Amena","Normal","Falso","Nao"]),
#     Example([0,1,2,3,4], ["Chuvoso","Quente","Normal","Verdadeiro","Sim"]),
#     Example([0,1,2,3,4], ["Nublado","Fria","Normal","Falso","Sim"]),
#     Example([0,1,2,3,4], ["Chuvoso","Amena","Alta","Verdadeiro","Sim"]),
# ])
#
# performance = ModelPerformance(node, test_dataset)
#
# matrix = performance.confusion_matrix
예제 #19
0
def generate_nodes_multiple(content, amr_nodes_content, amr_nodes_acronym):
    '''
	Generate Node object for nested '()'

	:param str context:
	:param dict amr_nodes_content: content as key
	:param dict amr_nodes_acronym: acronym as key
	'''
    try:
        assert content.count('(') > 1 and content.count(')') > 1
        assert content.count('(') == content.count(')')
    except AssertionError:
        raise Exception('Unmatched parenthesis')

    #note that if we want to get complete content, we need to complete subgraphs in amr_nodes_content, however if we really complete it, the following can't be indexed in amr_nodes_content
    _content = content  #because content will gradually move its components, so use _content to back up for amr_nodes_content
    org = content  #original_content   difference between above is It don't remove :name
    arg_nodes = []
    is_named_entity = False

    # Remove existing nodes from the content, and link these nodes to the root
    # of the subtree
    for i in sorted(amr_nodes_content, key=len, reverse=True):
        if i in content:
            e = content.find(i)
            s = content[:e].rfind(':')
            role = re.search(':\S+\s', content[s:e]).group()  # Edge label

            amr_nodes_content[i].edge_label = role.strip()
            if ':name' in role:
                is_named_entity = True
                ne = amr_nodes_content[i]
            else:
                arg_nodes.append(amr_nodes_content[i])
            if ':name' not in role:
                org = org.replace(role + i, '', 1)
            content = content.replace(role + i, '', 1)

    predict_event = re.search('\w+\s/\s\S+', content).group().split(' / ')
    if predict_event:
        acr = predict_event[0]  # Acronym
        ful = predict_event[1]  # Full name
    else:
        acr, ful = '-', '-'

    # In case of :polarity -
    is_polarity = True if re.search(":polarity\s-", content) else False

    nodes = re.findall(':\S+\s\S+', content)
    for i in nodes:
        i = re.search('(:\S+)\s(\S+)', i)
        role = i.group(1)
        concept = i.group(2).strip("()")
        if role == ':wiki' and is_named_entity:
            continue
        if role in [':polarity', ':quant', ':age', ':value']:
            continue
        if concept in amr_nodes_acronym:
            node = copy.copy(amr_nodes_acronym[concept])
            content = content.replace(i.group(0), "")
        # In case of (d / date-entity :year 2012)
        else:
            node = Node(name=concept)
            amr_nodes_acronym[concept] = node
            # if re.search("\s+"+concept+"[^\d]", content, ):
            # 	content.replace(concept, )
        node.edge_label = role
        arg_nodes.append(node)

        # Named entity is a special node, so the subtree of a
        # named entity will be merged. For example,
        #     (p / person :wiki -
        #        :name (n / name
        #                 :op1 "Pascale"))
        # will be merged as one node.
        # According to AMR Specification, "we fill the :instance
        # slot from a special list of standard AMR named entity types".
        # Thus, for named entity node, we will use entity type
        # (p / person in the example above) instead of :instance

    if is_named_entity:
        # Get Wikipedia title:
        if re.match('.+:wiki\s-.*', content):
            wikititle = '-'  # Entity is NIL, Wiki title does not exist
        else:
            m = re.search(':wiki\s\"(.+?)\"', content)
            if m:
                wikititle = urllib.parse.unquote_plus(m.group(1))  # Wiki title
            else:
                wikititle = ''  # There is no Wiki title information

        new_node = Node(name=acr,
                        ful_name=ful,
                        next_nodes=arg_nodes,
                        parents=set(),
                        edge_label=ne.ful_name,
                        is_entity=True,
                        entity_type=ful,
                        entity_name=ne.entity_name,
                        wiki=wikititle,
                        polarity=is_polarity,
                        content=content,
                        original_content=org)
        amr_nodes_content[_content] = new_node
        amr_nodes_acronym[acr] = new_node

    elif len(arg_nodes) > 0:
        new_node = Node(name=acr,
                        ful_name=ful,
                        next_nodes=arg_nodes,
                        parents=set(),
                        polarity=is_polarity,
                        content=content,
                        original_content=_content)
        amr_nodes_content[_content] = new_node
        amr_nodes_acronym[acr] = new_node
    for child in new_node.next_nodes:
        child.parents.add(new_node)
예제 #20
0
    def __init__(self, sys_argv):
        super(App, self).__init__(sys_argv)
        self.model = Model()
        # listView = QtGui.QListView()
        # listView.show
        red = QtGui.QColor(255, 0, 0)
        green = QtGui.QColor(0, 255, 0)
        blue = QtGui.QColor(0, 0, 255)
        rowCount = 4
        columnCount = 2
        tableData1 = [[QtGui.QColor("#FFFF00") for i in range(columnCount)]
                      for j in range(rowCount)]
        headers = ["Pallet0", "Colors"]

        entity = json2obj(
            '{"category":"groups","path":"/mnt/x19/mavisdev/projects/geotest/sequence/afg_0025","name":"afg_0025","description":"AFG_0025 sequence","fileImportPath":"","isGlobal":false,"project":"geotest","fields":{"priority":"medium","status":"idle"},"createdBy":"trevor","createdAt":"2016-09-13T20:28:04.745Z","updatedAt":"2017-05-31T21:38:19.935Z","id":"57d861546fef3a0001c87954","type":"sequence","mediaIds":[],"isTest":false}'
        )
        entity1 = json2obj(
            '{"category":"assets","path":"/mnt/x19/mavisdev/projects/geotest/globals/assets/wood_log","name":"wood_log","description":"a log that is wooden","fileImportPath":"","isGlobal":false,"project":"geotest","fields":{"priority":"medium","status":"review","grouping":"char","comp_status":"Ready","prod_status":"HIGH"},"createdBy":"dexplorer","createdAt":"2017-06-12T20:07:21.739Z","updatedAt":"2017-06-12T20:07:21.798Z","id":"593ef47973d9f40001cf898b","type":"assets","mediaIds":[],"isTest":false}'
        )
        entity2 = json2obj(
            '{"category":"assets","path":"/mnt/x19/mavisdev/projects/geotest/sequence/afg_0025/shots/afg_0025_0020/plates/plate_afg-0025__0020","name":"plate_afg-0025__0020","description":"plate asse for afg_0025_0020","latest":"583dc9eebc843d0001905bde","fileImportPath":"/mnt/x1/mavisdev/client_imports/geotest/afg_0025_0020/AFG_0025_0020_bg01_v001_LIN.exr","isGlobal":true,"project":"geotest","fields":{"priority":"low","status":"approved","startFrame":10,"endFrame":100,"pxAspect":1,"colorspace":"linear","fileType":"exr","width":1920,"height":1080,"lut":"","ccc":"","head":8,"tail":8,"handle":8},"createdBy":"trevor","createdAt":"2016-11-29T18:31:59.429Z","updatedAt":"2017-05-23T21:17:43.390Z","id":"583dc99fbc843d0001905bd9","type":"plates","mediaIds":[],"parentId":"57d861546fef3a0001c87960","isTest":false}'
        )
        entity3 = json2obj(
            '{"category":"tasks","path":"/mnt/x19/mavisdev/projects/geotest/globals/assets/wood_log/texture/tex_log","name":"tex_log","description":"texture the wood log","latest":"5941b18073d9f40001cf8a6c","fileImportPath":"","isGlobal":false,"project":"geotest","fields":{"priority":"urgent","status":"revised","grouping":"mtpg","comp_status":"In-Progress","prod_status":"HIGH"},"createdBy":"dexplorer","createdAt":"2017-06-12T20:08:10.814Z","updatedAt":"2017-06-14T21:58:24.772Z","id":"593ef4aa73d9f40001cf8992","type":"texture","mediaIds":[],"isTest":false}'
        )
        entity4 = json2obj(
            '{"category":"tasks","path":"/mnt/x19/mavisdev/projects/geotest/sequence/mdm_0202/shots/mdm_0202_0100/assets/tuktuka/model/tuktuk_model","name":"tuktuk_model","description":"published plate 6310","latest":"58c6ffe6e925cc00016a6b58","fileImportPath":"","isGlobal":false,"project":"geotest","fields":{"priority":"high","status":"revised","grouping":"vehi","comp_status":"Waiting","prod_status":"MEDIUM"},"createdBy":"trevor","createdAt":"2017-04-13T22:08:33.983Z","updatedAt":"2017-04-18T20:35:28.557Z","id":"589b4f9dc599d10001375de9","type":"model","mediaIds":[],"parentId":"589b4f10c599d10001375de2","isTest":false}'
        )

        rootNode = Node('Hips')
        childNode0 = TransformNode('LeftPirateleg', entity, rootNode)
        childNode1 = Node('RightLeg', entity1, rootNode)
        childNode2 = Node('RightFoot', entity2, childNode1)
        childNode3 = CameraNode('Xxxree', entity3, rootNode)
        childNode4 = LightNode('kldjskfds', entity4, childNode1)

        tree = TreeModel(rootNode)

        model2 = PaletteTableModel(tableData1, headers)
        self.main_ctrl = MainController(self.model)
        self.main_view = MainView(model=self.model, main_ctrl=self.main_ctrl)
        self.main_view.test(model2, tree=tree)
        self.main_view.show()

        # model2.insertRows(0, 5)
        # model2.insertColumns(0, 5)
        model2.removeColumns(1, 1)
        # tree.insertRows(0, 1)
        #
        #
        # self.threadClass = ThreadClass()
        # self.connect(self.threadClass, QtCore.SIGNAL('CPU_VALUE'), self.done)
        # self.threadClass.start()
        self.manager = QtNetwork.QNetworkAccessManager()
        self.manager.finished.connect(self.reply_finished)
        print(
            QtNetwork.QNetworkSession(QtNetwork.QNetworkConfigurationManager().
                                      defaultConfiguration()).State())
        self.request = QtNetwork.QNetworkRequest(
            QtCore.QUrl(
                'http://www.planwallpaper.com/static/images/1080p-HD-Wallpapers-9.jpg'
            ))
        print("Sending request")
        self.manager.get(self.request)
        self.manager2 = QtNetwork.QNetworkAccessManager()
        self.manager2.finished.connect(self.reply_finished)
        print(
            QtNetwork.QNetworkSession(QtNetwork.QNetworkConfigurationManager().
                                      defaultConfiguration()).State())
        self.request = QtNetwork.QNetworkRequest(
            QtCore.QUrl('http://lorempixel.com/1800/1400/city/'))
        print("Sending request")
        self.manager2.get(self.request)

        self.manager2 = QtNetwork.QNetworkAccessManager()
        self.manager2.finished.connect(self.reply_finished)
        print(
            QtNetwork.QNetworkSession(QtNetwork.QNetworkConfigurationManager().
                                      defaultConfiguration()).State())
        self.request = QtNetwork.QNetworkRequest(
            QtCore.QUrl('http://lorempixel.com/1800/1400/city/'))
        print("Sending request")
        self.manager2.get(self.request)

        self.manager3 = QtNetwork.QNetworkAccessManager()
        self.manager3.finished.connect(self.reply_finished)
        print(
            QtNetwork.QNetworkSession(QtNetwork.QNetworkConfigurationManager().
                                      defaultConfiguration()).State())
        self.request = QtNetwork.QNetworkRequest(
            QtCore.QUrl('http://lorempixel.com/1800/1400/city/'))
        print("Sending request")
        self.manager3.get(self.request)