小编sen*_*nto的帖子

将时间转换为秒字符串问题

我正在阅读" 真实世界OCaml"一书,并且从该书的代码中得到了错误.既然,我没有在GitHub看到任何关于图书问题的活动,我想在这里问你.这是问题cobe:

let log_entry maybe_time message =
    let time = match maybe_time with
        | Some x -> x
        | None -> Time.now ()
    in
    Time.to_sec_string time ^ " -- " ^ message
;;
Run Code Online (Sandbox Code Playgroud)

错误是下一个错误:

Error: This expression has type zone:Core.Zone.t -> string but an expression was expected of type string
Run Code Online (Sandbox Code Playgroud)

据我所知,这是关于打电话

Time.to_sec_string时间

ocaml

7
推荐指数
2
解决办法
532
查看次数

设置pyflake和mypy忽略同一行

我为Salt编写了一个模块。根据文档,它将__salt__对象添加到中builtins。因此,pyflake警告我__salt__在运行探矿器时未定义,而mypy表示相同,即__salt__未定义!我可以忽略无论是pyflake# noqa: F821mypy# type: ignore该行上。

问题是!如何为他们两者忽略?

python pyflakes mypy

1
推荐指数
1
解决办法
542
查看次数

Python 2.7 tempfile.NamedTemporaryFile返回类型'instance'而不是'file'的对象.为什么?

一些库检查输入f的类型是否为文件.而Python 2.7库tempfile返回类型文件中的对象

type(tempfile.TemporaryFile())  # type is file
Run Code Online (Sandbox Code Playgroud)

并为

type(tempfile.NamedTemporaryFile())  # type is instance
Run Code Online (Sandbox Code Playgroud)

有什么理由还是只是一个bug?

python types temporary-files python-2.7

-1
推荐指数
1
解决办法
617
查看次数

标签 统计

python ×2

mypy ×1

ocaml ×1

pyflakes ×1

python-2.7 ×1

temporary-files ×1

types ×1