当前位置: 首页>>代码示例>>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;未经允许,请勿转载。