history#

Tools interfacing with conda's history file.

#

函数#

write_head(fo)

is_diff(content)

pretty_diff(diff)

pretty_content(content)

属性#

h

exception CondaHistoryWarning#

Bases: Warning

警告类别的基类。

初始化 self。请参阅 help(type(self)) 以获取准确的签名。

write_head(fo)#
is_diff(content)#
pretty_diff(diff)#
pretty_content(content)#
class History(prefix)#
com_pat#
spec_pat#
conda_v_pat#
__enter__()#
__exit__(exc_type, exc_value, traceback)#
init_log_file()#
file_is_empty()#
update() None#

Update the history file (creating a new one if necessary).

parse() list[tuple[str, set[str], list[str]]]#

解析历史文件。

返回元组列表(日期时间字符串、发行版/差异集、注释)。

历史文件中第一个节标题(例如 ==> 2024-01-01 00:00:00 <==)之前出现的注释将被忽略。

static _parse_old_format_specs_string(specs_string)#

解析使用 conda<4.5 语法的规范字符串。

示例

  • "param >=1.5.1,<2.0'"

  • "python>=3.5.1,jupyter >=1.0.0,<2.0,matplotlib >=1.5.1,<2.0"

classmethod _parse_comment_line(line)#

解析历史文件中的注释行。

这些行可以是命令类型或操作类型。

示例

  • "# cmd: /scratch/mc3/bin/conda install -c conda-forge param>=1.5.1,<2.0"

  • "# install specs: python>=3.5.1,jupyter >=1.0.0,<2.0,matplotlib >=1.5.1,<2.0"

get_user_requests()#

返回用户请求项的列表。

每个项目都是一个字典,包含以下键:'date':运行命令的日期和时间 'cmd':已运行的实际命令的 argv 列表 'action':install/remove/update 'specs':正在使用的规范

get_requested_specs_map()#
construct_states()#

返回元组列表(日期时间字符串、发行版集合)。

get_state(rev=-1)#

返回给定修订的状态,即发行版集合。

默认为最新(与日志文件为最新状态时的当前状态相同)。

返回 dist_strs 列表。

print_log()#
object_log()#
write_changes(last_state, current_state)#
write_specs(remove_specs=(), update_specs=(), neutered_specs=())#
h#