def make_libs_for_all_arches_and_variants(libs, llndk_mode):
    for product in PRODUCTS:
        if libs:
            print('making libs for product:', product)
            make_libraries(libs, product, llndk_mode)
        else:
            print('making all libs for product: ', product)
            make_tree(product)
Esempio n. 2
0
def make_libs_for_all_arches_and_variants(libs, llndk_mode):
    for product in PRODUCTS:
        if libs:
            print('making libs for product:', product)
            make_libraries(libs, product, llndk_mode)
        else:
            print('making all libs for product: ', product)
            make_tree(product)
Esempio n. 3
0
def make_libs_for_all_arches_and_variants(libs):
    for product in PRODUCTS:
        get_lsdump_paths_file(product)
        if libs:
            print('making libs for product:', product)
            make_libraries(libs, product)
        else:
            print('making all libs for product: ', product)
            make_tree(product)
Esempio n. 4
0
    def fetchTreeList(self, type_id):
        data = dict(
            treeList=[],
            user_total=0,
        )
        if type_id:
            # 文章评论
            sql = 'select * from {table} WHERE `status`=1 AND `type`=%s'.format(
                table=self.__tablename__, )
            ret = self.select(sql, type_id)
            total_sql = 'SELECT count(distinct username) as total, count(*) AS comment_total from {table} WHERE `type`=%s'\
                .format(table=self.__tablename__)
            total_ret = self.select(total_sql, type_id, one=True)

        else:
            # 留言板
            sql = 'select * from {table} WHERE `status`=1 AND `type` is NULL '.format(
                table=self.__tablename__, )
            ret = self.select(sql)
            total_sql = 'SELECT count(distinct username) as total, count(*) AS comment_total from {table} WHERE `type` is NULL '\
                .format(table=self.__tablename__)
            total_ret = self.select(total_sql, one=True)

        if ret: data['treeList'] = make_tree(ret)

        if total_ret:
            data['user_total'] = total_ret['total']
            data['comment_total'] = total_ret['comment_total']

        return self.respData(data=data)
Esempio n. 5
0
    def fetchTreeList(self):
        sql = 'select `id`, `model_id`, `pid`, `typename`,`dirs`, `icon` from {table}'.format(
            table=self.__tablename__)
        ret = self.select(sql)

        if ret:
            return self.respData(STATUS.OK, data=make_tree(ret))
        return self.respData(STATUS.DATA_NULL_ERR, error='分类数据不存在~')
Esempio n. 6
0
def make_libs_for_product(libs, llndk_mode, product):
    print('making libs for product:', product)
    if libs:
        make_libraries(libs, product, llndk_mode)
    else:
        make_tree(product)
Esempio n. 7
0
def make_libs_for_product(libs, llndk_mode, product, variant, targets):
    print('making libs for', product + '-' + variant)
    if libs:
        make_libraries(product, variant, targets, libs, llndk_mode)
    else:
        make_tree(product, variant)
Esempio n. 8
0
def make_libs_for_product(libs, product, variant, vndk_version, targets):
    print('making libs for', product + '-' + variant)
    if libs:
        make_libraries(product, variant, vndk_version, targets, libs)
    else:
        make_tree(product, variant)
Esempio n. 9
0
def init():
    global test_dict, test_done
    test_dict = make_tree({}, 0, 4, {"done": False, "good": 0, "bad": 0})
    test_done = []
Esempio n. 10
0
###########################
# CONVERT MODELS TO TREES #
###########################

# Make two trees from the model dictionaries
trees = []
for model_idx in [1, 2]:

    # Find the state, relations, and valuations for this model
    states = model_info['S' + str(model_idx)]
    relations = model_info['R' + str(model_idx)]
    valuations = model_info['V' + str(model_idx)]

    # Construct the tree
    tree = make_tree(this_state=states[0],
                     relations=relations,
                     valuations=valuations,
                     max_depth=max_depth)

    # Add the tree to the list of trees
    trees.append(tree)

# Collect all the atomic facts in the universe from the two trees
atoms = list()

for model_idx, tree in enumerate(trees):
    atoms = get_atoms(node=tree, atoms=atoms)

# Extend the trees
for model_idx, tree in enumerate(trees):

    # Add negations for all atoms that are missing
Esempio n. 11
0
def init():
    global test_dict, test_done
    test_dict = make_tree({}, 0, 4, False)
    test_done = []
                cur_max = right[1]
                if node.val >= right[0]:
                    return False

            return cur_min, cur_max

        return vali_sub_bst(root) is not False

    def isValidBST2(self, root):
        if not root:
            return True

        pre, stack = None, []
        while root or stack:
            while root:
                stack.append(root)
                root = root.left
            cur = stack.pop()
            if pre and pre.val >= cur.val:
                return False
            pre = cur
            root = cur.right
        return True


if __name__ == '__main__':
    s = Solution()
    from utils import make_tree
    root = make_tree([2, 1, 3])
    print(s.isValidBST(root))