我正在使用prospector来检查我的代码.Pylint返回了logging-not-lazy有关我的调试消息的警告.
Line: 31
pylint: logging-not-lazy / Specify string format arguments as logging function parameters (col 16) Line: 42
pylint: logging-not-lazy / Specify string format arguments as logging function parameters (col 12)
Run Code Online (Sandbox Code Playgroud)
我的代码是:
logging.debug("detect mimetypes faild because %s" % e )
Run Code Online (Sandbox Code Playgroud)
我如何修复logging-not-lazypylint?
我是golang的新手,他从动态类型语言转变而来.
我面临着如何编写具有许多类别/子类别的目录的问题 - 复杂的分类法.例如:
鞋带>鞋子>男士>鞋子>衣服>首页>分类
我使用mongodb作为后端.在这种情况下,我无法理解如何编写CRUD操作?
如果我像往常一样处理所有查询:
func RunFindAllQuery(document interface{}, m bson.M, mongoSession *mgo.Session, conn Conn) (err error) {
sessionCopy := mongoSession.Copy()
defer sessionCopy.Close()
collection:= sessionCopy.DB(conn.Database).C(conn.Collection)
err = collection.Find(m).All(document)
if err != nil {
log.Printf("RunQuery : ERROR : %s\n", err)
}
return err
}
Run Code Online (Sandbox Code Playgroud)
我需要定义很多类型:鞋子!=汽车.
type Shoes struct {
Id bson.ObjectId `bson:"_id"`
Name string `bson:"name"`
Description string `bson:"descriprion"`
Size float `bson:"size"`
Color float `bson:"color"`
Type float `bson:"type"`
ShoeHeight float `bson:"shoeheight"`
PlatformHeight float `bson:"platformheight"`
Country float `bson:"country"` …Run Code Online (Sandbox Code Playgroud) 我尝试使用Travis-CI在CentOS 7上测试我的ansible剧本.
我收到一个错误: 错误:文件/ usr/sbin/suexec:cpio:cap_set_file上的归档解包失败.
我还安装了docker:
curl -sSL https://get.docker.com/ | sh
Run Code Online (Sandbox Code Playgroud)
在我的Ubuntu上:
# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 14.04.3 LTS
Release: 14.04
Codename: trusty
Run Code Online (Sandbox Code Playgroud)
但是有这个错误:
#docker run --rm=true -ti centos:7 /bin/bash
[root@08bf52d53465 /]#
[root@ca03cf7a13e2 /]# yum install httpd -y
Loaded plugins: fastestmirror
base | 3.6 kB 00:00:00
extras | 3.4 kB 00:00:00
updates | 3.4 kB 00:00:00
(1/4): extras/7/x86_64/primary_db | 74 kB 00:00:00
(2/4): base/7/x86_64/group_gz | 154 kB 00:00:01
(3/4): updates/7/x86_64/primary_db …Run Code Online (Sandbox Code Playgroud) 我有一个由某人编译的 binutils 版本。我需要使用相同的选项重新编译一个新的 binutils。
我知道这会gcc -v打印出配置选项。那么也许有什么方法可以读取binutils?