对于以下代码:

logger.debug('message: {}'.format('test'))

Pylint产生以下警告:

logging-format-interpolation (W1202): 在日志函数中使用%格式,并将%参数传递为 当日志语句的调用形式为 “日志记录。(format_string.format (format_args…)”。这样的 调用应该使用%格式,而将插值留给 日志函数,通过将参数作为参数传递。

我知道我可以关闭这个警告,但我想了解它。我假设使用format()是Python 3中输出语句的首选方式。为什么记录器语句不是这样?

我在Windows上的Wing IDE内部运行PyLint。我有一个子目录(包)在我的项目和包内,我从顶层导入一个模块,即。

__init__.py
myapp.py
one.py
subdir\
    __init__.py
    two.py

在two.py中,我导入了一个,这在运行时工作得很好,因为顶层目录(myapp.py从其中运行)在Python路径中。然而,当我在two.py上运行PyLint时,它会给我一个错误:

F0401: Unable to import 'one'

我怎么解决这个问题?

I need to merge two Git repositories into a brand new, third repository. I've found many descriptions of how to do this using a subtree merge (for example Jakub Narębski's answer on How do you merge two Git repositories?) and following those instructions mostly works, except that when I commit the subtree merge all of the files from the old repositories are recorded as new added files. I can see the commit history from the old repositories when I do git log, but if I do git log <file> it shows only one commit for that file - the subtree merge. Judging from the comments on the above answer, I'm not alone in seeing this problem but I've found no published solutions for it.

有没有办法合并存储库,并保持单个文件历史完整?

PIL在我的系统中支持JPEG。

每当我做一个上传,我的代码失败:

File "PIL/Image.py", line 375, in _getdecoder
    raise IOError("decoder %s not available" % decoder_name)
IOError: decoder jpeg not available

我该如何解决这个问题?

我试图保存我使用matplotlib的情节;然而,图像是空白保存。

这是我的代码:

plt.subplot(121)
plt.imshow(dataStack, cmap=mpl.cm.bone)

plt.subplot(122)
y = copy.deepcopy(tumorStack)
y = np.ma.masked_where(y == 0, y)

plt.imshow(dataStack, cmap=mpl.cm.bone)
plt.imshow(y, cmap=mpl.cm.jet_r, interpolation='nearest')

if T0 is not None:
    plt.subplot(123)
    plt.imshow(T0, cmap=mpl.cm.bone)

    #plt.subplot(124)
    #Autozoom

#else:
    #plt.subplot(124)
    #Autozoom

plt.show()
plt.draw()
plt.savefig('tessstttyyy.png', dpi=100)

tessstttyyy.png是空白的(也尝试用。jpg)

我需要给一个图加上两个子图。一个副地块的宽度需要是第二个地块的三倍(高度相同)。我用GridSpec和colspan参数完成了这一点,但我想用数字来做,这样我就可以保存到PDF。我可以使用构造函数中的figsize参数调整第一个图形,但如何更改第二个图形的大小呢?

我试图在Pylint 0.21.1中禁用警告C0321(“单行中有多个语句”——我经常将具有短单行结果的if语句放在同一行上)(如果有问题:astng 0.20.1, common 0.50.3,和Python 2.6.6 (r266:84292, 2010年9月15日,16:22:56))。

我尝试在Pylint配置文件中添加disable=C0321,但Pylint坚持报告它。这一行的变体(如disable=0321或disable=C321)被标记为错误,因此Pylint能够正确地识别该选项。它只是忽略它。

这是一个Pylint错误,还是我做错了什么?有办法解决这个问题吗?

我真的很想摆脱这些噪音。

使用git子模块和子树在概念上有什么区别?

它们的典型场景是什么?

我想获得一些关于这些工具的反馈:

功能; 适应性; 易用性和学习曲线。

有时我会遇到这样的代码:

import matplotlib.pyplot as plt
x = [1, 2, 3, 4, 5]
y = [1, 4, 9, 16, 25]
fig = plt.figure()
fig.add_subplot(111)
plt.scatter(x, y)
plt.show()

生产:

我一直在疯狂地阅读文档,但我找不到111的解释。有时我看到212。

fig.add_subplot()的参数是什么意思?