如何使PyDev编辑器有选择地忽略错误? [英] How can I make the PyDev editor selectively ignore errors?

查看:78
本文介绍了如何使PyDev编辑器有选择地忽略错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Eclipse下使用PyDev编写一些Jython代码.我有很多实例需要执行以下操作:

I'm using PyDev under Eclipse to write some Jython code. I've got numerous instances where I need to do something like this:

import com.work.project.component.client.Interface.ISubInterface as ISubInterface

问题是PyDev总是将其标记为错误并说未解决的导入:ISubInterface".该代码运行良好,只是我不想在代码旁边放这些小的白色/红色X标记,而让我的问题"选项卡上满是这些错误.

The problem is that PyDev will always flag this as an error and say "Unresolved import: ISubInterface". The code works just fine, it's just that I'd rather not have these little white/red X-marks next to my code and have my Problems tab littered with these errors.

有没有一种方法可以在行的末尾添加魔术注释或类似的内容,以使PyDev忽略错误错误,类似于您可以将#pylint:disable-msg = E1101"这样的注释撒到使PyLint忽略错误?

Is there a way I can add a magic comment or something like that to the end of the line to make PyDev ignore the false error, similar to how you can sprinkle comments like "# pylint: disable-msg=E1101" to make PyLint ignore errors?

此外,在Jython中使用Java接口时,我可能做错了.在这种情况下,非常感谢您提供一些指导.

Also, there's a possibility I'm just doing it wrong when it comes to using Java interfaces in Jython. In which case a little bit of guidance would be very much appreciated.

推荐答案

您可以添加评论

#@UnresolvedImport
#@UnusedVariable

因此您的导入将变为:

import com.work.project.component.client.Interface.ISubInterface as ISubInterface #@UnresolvedImport

那应该消除错误/警告.您还可以添加其他注释.

That should remove the error/warning. There are other comments you can add as well.

这篇关于如何使PyDev编辑器有选择地忽略错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆