當前位置: 首頁>>代碼示例>>Python>>正文


Python Pool.set_repository_order方法代碼示例

本文整理匯總了Python中depsolver.pool.Pool.set_repository_order方法的典型用法代碼示例。如果您正苦於以下問題:Python Pool.set_repository_order方法的具體用法?Python Pool.set_repository_order怎麽用?Python Pool.set_repository_order使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在depsolver.pool.Pool的用法示例。


在下文中一共展示了Pool.set_repository_order方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_priority_simple

# 需要導入模塊: from depsolver.pool import Pool [as 別名]
# 或者: from depsolver.pool.Pool import set_repository_order [as 別名]
    def test_priority_simple(self):
        paid_repo = Repository([
            self.mkl_10_1_0,
            self.mkl_10_2_0,
            self.mkl_10_3_0,
            self.mkl_11_0_0,
            self.numpy_1_6_0,
            self.numpy_1_7_0,
        ], name="paid")
        free_repo = Repository([self.nomkl_numpy_1_7_0], "free")
        pool = Pool([paid_repo, free_repo])
        pool.set_repository_order("free", before="paid")

        self.assertEqual(pool.repository_priority(paid_repo), 0)
        self.assertEqual(pool.repository_priority(free_repo), -1)
開發者ID:awwad,項目名稱:depsolver,代碼行數:17,代碼來源:test_pool.py

示例2: test_priority_no_name

# 需要導入模塊: from depsolver.pool import Pool [as 別名]
# 或者: from depsolver.pool.Pool import set_repository_order [as 別名]
    def test_priority_no_name(self):
        paid_repo = Repository([
            self.mkl_10_1_0,
            self.mkl_10_2_0,
            self.mkl_10_3_0,
            self.mkl_11_0_0,
            self.numpy_1_7_0,
        ], name="paid")
        free_repo = Repository([self.nomkl_numpy_1_7_0], "free")
        another_repo = Repository([self.numpy_1_6_1], "another_repo")
        another_repo_wo_name = Repository([self.numpy_1_6_0])
        pool = Pool([paid_repo, free_repo, another_repo, another_repo_wo_name])
        pool.set_repository_order("free", before="paid")

        self.assertEqual(pool.repository_priority(paid_repo), 0)
        self.assertEqual(pool.repository_priority(free_repo), -1)
        self.assertEqual(pool.repository_priority(another_repo), -1)
        self.assertEqual(pool.repository_priority(another_repo_wo_name), -1)
開發者ID:awwad,項目名稱:depsolver,代碼行數:20,代碼來源:test_pool.py

示例3: test_simple_fulfilled_installed

# 需要導入模塊: from depsolver.pool import Pool [as 別名]
# 或者: from depsolver.pool.Pool import set_repository_order [as 別名]
    def test_simple_fulfilled_installed(self):
        """Ensure the policy returns the installed version first if it fulfills
        the requirement, even if higher versions are available."""
        mkl_10_4_0 = P("mkl-10.4.0")
        remote_repository = Repository([self.mkl_10_3_0, self.mkl_11_0_0], "remote")
        installed_repository = Repository([mkl_10_4_0], "installed")

        pool = Pool([installed_repository, remote_repository])
        pool.set_repository_order("installed", "remote")
        policy = DefaultPolicy()

        queue = [p.id for p in [mkl_10_4_0, self.mkl_10_3_0, self.mkl_11_0_0]]

        candidates = policy.select_preferred_packages(pool, {}, queue)
        self.assertEqual(list(candidates), [self.mkl_11_0_0.id])

        candidates = policy.select_preferred_packages(pool, {mkl_10_4_0.id: True}, queue)
        self.assertEqual(list(candidates), [mkl_10_4_0.id, self.mkl_11_0_0.id])
開發者ID:awwad,項目名稱:depsolver,代碼行數:20,代碼來源:test_policy.py

示例4: test_cmp_by_priority_prefer_installed_multi_repositories

# 需要導入模塊: from depsolver.pool import Pool [as 別名]
# 或者: from depsolver.pool.Pool import set_repository_order [as 別名]
    def test_cmp_by_priority_prefer_installed_multi_repositories(self):
        """
        Check packages from multiple repositories are sorted accordingt to
        repository priority.
        """
        numpy_1_6_0 = P("numpy-1.6.0")
        numpy_1_6_1 = P("numpy-1.6.1")
        numpy_1_7_0 = P("numpy-1.7.0")
        i_numpy_1_6_0 = P("numpy-1.6.0")

        remote_repository = Repository([numpy_1_7_0, numpy_1_6_1, numpy_1_6_0], "remote")
        installed_repository = Repository([i_numpy_1_6_0], "installed")

        r_sorted_packages = [i_numpy_1_6_0, numpy_1_7_0, numpy_1_6_1, numpy_1_6_0]

        pool = Pool([installed_repository, remote_repository])
        pool.set_repository_order("installed", "remote")
        policy = DefaultPolicy()

        queue = [numpy_1_7_0, i_numpy_1_6_0, numpy_1_6_0, numpy_1_6_1]
        def _cmp(a, b):
            return policy.cmp_by_priority_prefer_installed(pool, {}, a, b)

        self.assertEqual(r_sorted_packages, sorted_with_cmp(queue, cmp=_cmp))
開發者ID:awwad,項目名稱:depsolver,代碼行數:26,代碼來源:test_policy.py

示例5: test_priority_not_registered

# 需要導入模塊: from depsolver.pool import Pool [as 別名]
# 或者: from depsolver.pool.Pool import set_repository_order [as 別名]
    def test_priority_not_registered(self):
        repo = Repository()
        pool = Pool()

        self.assertRaises(DepSolverError, lambda: pool.repository_priority(repo))
        self.assertRaises(DepSolverError, lambda: pool.set_repository_order(repo, "dummy"))
開發者ID:awwad,項目名稱:depsolver,代碼行數:8,代碼來源:test_pool.py


注:本文中的depsolver.pool.Pool.set_repository_order方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。