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


Python history.History類代碼示例

本文整理匯總了Python中conda.history.History的典型用法代碼示例。如果您正苦於以下問題:Python History類的具體用法?Python History怎麽用?Python History使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: execute

def execute(args, parser):
    prefix = context.prefix_w_legacy_search
    regex = args.regex
    if args.full_name:
        regex = r'^%s$' % regex

    if args.revisions:
        from conda.history import History
        h = History(prefix)
        if isfile(h.path):
            if not context.json:
                h.print_log()
            else:
                stdout_json(h.object_log())
        else:
            raise CondaFileNotFoundError(h.path)
        return

    if args.explicit:
        print_explicit(prefix, args.md5)
        return

    if args.canonical:
        format = 'canonical'
    elif args.export:
        format = 'export'
    else:
        format = 'human'
    if context.json:
        format = 'canonical'

    exitcode = print_packages(prefix, regex, format, piplist=args.pip,
                              json=context.json,
                              show_channel_urls=context.show_channel_urls)
    return exitcode
開發者ID:ESSS,項目名稱:conda,代碼行數:35,代碼來源:main_list.py

示例2: execute

def execute(args, parser):
    prefix = common.get_prefix(args)

    regex = args.regex
    if args.full_name:
        regex = r'^%s$' % regex

    if args.revisions:
        from conda.history import History

        h = History(prefix)
        if isfile(h.path):
            if not args.json:
                h.print_log()
            else:
                common.stdout_json(h.object_log())
        else:
            common.error_and_exit("No revision log found: %s\n" % h.path,
                                  json=args.json,
                                  error_type="NoRevisionLog")
        return

    if args.canonical:
        format = 'canonical'
    elif args.export:
        format = 'export'
    else:
        format = 'human'

    if args.json:
        format = 'canonical'

    exitcode = print_packages(prefix, regex, format, piplist=args.pip, json=args.json)
    sys.exit(exitcode)
開發者ID:jacoblsmith,項目名稱:conda,代碼行數:34,代碼來源:main_list.py

示例3: execute

def execute(args, parser):
    prefix = common.get_prefix(args)

    if args.revisions:
        from conda.history import History

        h = History(prefix)
        if isfile(h.path):
            if not args.json:
                h.print_log()
            else:
                common.stdout_json(h.object_log())
        else:
            common.error_and_exit("No revision log found: %s\n" % h.path, json=args.json, error_type="NoRevisionLog")
        return

    if args.canonical:
        format = "canonical"
    elif args.export:
        format = "export"
    else:
        format = "human"

    if args.json:
        format = "canonical"

    print_packages(prefix, args.regex, format, piplist=args.pip, json=args.json)
開發者ID:jeanconn,項目名稱:conda,代碼行數:27,代碼來源:main_list.py

示例4: revert_actions

def revert_actions(prefix, revision=-1):
    h = History(prefix)
    h.update()
    try:
        state = h.get_state(revision)
    except IndexError:
        sys.exit("Error: no such revision: %d" % revision)

    curr = h.get_state()
    if state == curr:
        return {}

    actions = ensure_linked_actions(state, prefix)
    for dist in curr - state:
開發者ID:Studiogit,項目名稱:conda,代碼行數:14,代碼來源:plan.py

示例5: test_minimum_conda_version_error

def test_minimum_conda_version_error():
    with tempdir() as prefix:
        assert not isfile(join(prefix, 'conda-meta', 'history'))
        mkdir_p(join(prefix, 'conda-meta'))
        copy2(join(dirname(__file__), 'conda-meta', 'history'),
              join(prefix, 'conda-meta', 'history'))

        with open(join(prefix, 'conda-meta', 'history'), 'a') as fh:
            fh.write("==> 2018-07-09 11:18:09 <==\n")
            fh.write("# cmd: blarg\n")
            fh.write("# conda version: 42.42.4242\n")

        h = History(prefix)

        with pytest.raises(CondaUpgradeError) as exc:
            h.get_user_requests()
        exception_string = repr(exc.value)
        print(exception_string)
        assert "minimum conda version: 42.42" in exception_string
        assert "$ conda install -p" in exception_string
開發者ID:alanhdu,項目名稱:conda,代碼行數:20,代碼來源:test_history.py

示例6: execute

def execute(args, parser):
    prefix = common.get_prefix(args)

    if args.revisions:
        from conda.history import History

        h = History(prefix)
        if isfile(h.path):
            h.print_log()
        else:
            sys.stderr.write("No revision log found: %s\n" % h.path)
        return

    if args.canonical:
        format = 'canonical'
    elif args.export:
        format = 'export'
    else:
        format = 'human'
    sys.exit(list_packages(prefix, args.regex, format=format, piplist=args.pip))
開發者ID:cpcloud,項目名稱:conda,代碼行數:20,代碼來源:main_list.py

示例7: test_specs_line_parsing_44

 def test_specs_line_parsing_44(self):
     # New format (>=4.4)
     item = History._parse_comment_line("# update specs: [\"param[version='>=1.5.1,<2.0']\"]")
     pprint(item)
     assert item == {
         "action": "update",
         "specs": [
             "param[version='>=1.5.1,<2.0']",
         ],
         "update_specs": [
             "param[version='>=1.5.1,<2.0']",
         ],
     }
開發者ID:alanhdu,項目名稱:conda,代碼行數:13,代碼來源:test_history.py

示例8: test_conda_comment_version_parsing

 def test_conda_comment_version_parsing(self):
     assert History._parse_comment_line("# conda version: 4.5.1") == {"conda_version": "4.5.1"}
     assert History._parse_comment_line("# conda version: 4.5.1rc1") == {"conda_version": "4.5.1rc1"}
     assert History._parse_comment_line("# conda version: 4.5.1dev0") == {"conda_version": "4.5.1dev0"}
開發者ID:alanhdu,項目名稱:conda,代碼行數:4,代碼來源:test_history.py

示例9: test_specs_line_parsing_43

    def test_specs_line_parsing_43(self):
        # Old format (<4.4)
        item = History._parse_comment_line('# install specs: param >=1.5.1,<2.0')
        pprint(item)
        assert item == {
            'action': 'install',
            'specs': [
                'param >=1.5.1,<2.0',
            ],
            'update_specs': [
                'param >=1.5.1,<2.0',
            ],
        }

        item = History._parse_comment_line('# install specs: param >=1.5.1,<2.0,0packagename >=1.0.0,<2.0')
        pprint(item)
        assert item == {
            'action': 'install',
            'specs': [
                'param >=1.5.1,<2.0',
                '0packagename >=1.0.0,<2.0',
            ],
            'update_specs': [
                'param >=1.5.1,<2.0',
                '0packagename >=1.0.0,<2.0',
            ],
        }

        item = History._parse_comment_line('# install specs: python>=3.5.1,jupyter >=1.0.0,<2.0,matplotlib >=1.5.1,<2.0,numpy >=1.11.0,<2.0,pandas >=0.19.2,<1.0,psycopg2 >=2.6.1,<3.0,pyyaml >=3.12,<4.0,scipy >=0.17.0,<1.0')
        pprint(item)
        assert item == {
            'action': 'install',
            'specs': [
                'python>=3.5.1',
                'jupyter >=1.0.0,<2.0',
                'matplotlib >=1.5.1,<2.0',
                'numpy >=1.11.0,<2.0',
                'pandas >=0.19.2,<1.0',
                'psycopg2 >=2.6.1,<3.0',
                'pyyaml >=3.12,<4.0',
                'scipy >=0.17.0,<1.0',
            ],
            'update_specs': [
                'python>=3.5.1',
                'jupyter >=1.0.0,<2.0',
                'matplotlib >=1.5.1,<2.0',
                'numpy >=1.11.0,<2.0',
                'pandas >=0.19.2,<1.0',
                'psycopg2 >=2.6.1,<3.0',
                'pyyaml >=3.12,<4.0',
                'scipy >=0.17.0,<1.0',
            ],
        }

        item = History._parse_comment_line('# install specs: _license >=1.0.0,<2.0')
        pprint(item)
        assert item == {
            'action': 'install',
            'specs': [
                '_license >=1.0.0,<2.0',
            ],
            'update_specs': [
                '_license >=1.0.0,<2.0',
            ],
        }

        item = History._parse_comment_line('# install specs: pandas,_license >=1.0.0,<2.0')
        pprint(item)
        assert item == {
            'action': 'install',
            'specs': [
                'pandas', '_license >=1.0.0,<2.0',
            ],
            'update_specs': [
                'pandas', '_license >=1.0.0,<2.0',
            ],
        }
開發者ID:alanhdu,項目名稱:conda,代碼行數:77,代碼來源:test_history.py


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