相关疑难解决方法(0)

如何忽略Sublime Text 3 Anaconda线路的lint错误?

我正在使用带有Sublime文本3的Anaconda.我将lint设置保留为默认值,但以下覆盖除外,我已将其包含在.sublime-project文件中.

"settings": {
        "anaconda_gutter_marks": true,
        "anaconda_gutter_theme": "alpha",
        "anaconda_linting_behaviour": "always",

    }
Run Code Online (Sandbox Code Playgroud)

我希望能够忽略某些行的"行太长",特别是注释中包含url的行.我喜欢将它用于其他线路,所以我宁愿不要完全禁用它.

我只找到了关于为pylint执行此操作的信息,但是如果可能的话,我宁愿使用默认的linter,因为这似乎在这个插件中有自己的问题.

我已经包含了sublimelinter标签,因为anaconda表示它的linting是基于该插件的.

sublimelinter sublimetext3 sublime-anaconda

30
推荐指数
3
解决办法
2万
查看次数

如何在第一个文档字符串中断链接以满足pep8?

我正在使用Sphinxdoc生成api文档,并且在编写docstring时遇到了pep8一致性问题.

如下所示,OWASP站点的链接在第105列结束,远远超过pep8规定的最大行长度

def handle_csrf(...):
    """The general recommendation by people in the know [OWASP]_, is
       'to implement the Synchronizer Token Pattern (STP_)'.

       .. [OWASP] The Open Web Application Security Project
          (https://www.owasp.org/index.php/Cross-Site_Request_Forgery_(CSRF)_Prevention_Cheat_Sheet)
       .. _STP: http://www.corej2eepatterns.com/Design/PresoDesign.htm

    """
Run Code Online (Sandbox Code Playgroud)

有没有办法包装网址,同时仍然保持生成的文档中的URL?

插入反斜杠不起作用.

python restructuredtext pep8 python-sphinx

20
推荐指数
2
解决办法
3540
查看次数

如何打破PEP8合规性的长串线?

我在项目中有很多这样的长线,并且不知道如何打破它以保持PEP8的快乐.PEP8显示警告.format(me['id'])

pic_url = "http://graph.facebook.com/{0}/picture?width=100&height=100".format(me['id'])
Run Code Online (Sandbox Code Playgroud)

我怎样才能打破这条线来摆脱PEP8警告而又不破坏代码呢?

python string pep8

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

sphinx 可以忽略 python 文档字符串中的某些标签吗?

我正在使用 sphinx 记录我的项目,并使用 sphinxcontrib.napoleon 扩展,它允许我使用谷歌风格的文档字符串。

这是我的项目中的一个函数

def nn_normalized_weight(normweight_fn, qaid2_nns, qreq_):
    """
    Weights nearest neighbors using the chosen function

    Args:
        normweight_fn (func): chosen weight function e.g. lnbnn
        qaid2_nns (dict): query descriptor nearest neighbors and distances. qaid -> (qfx2_nnx, qfx2_dist)
        qreq_ (QueryRequest): hyper-parameters

    Returns:
        tuple(dict, dict) : (qaid2_weight, qaid2_selnorms)

    Example:
        >>> from ibeis.model.hots.nn_weights import *
        >>> from ibeis.model.hots import nn_weights
        >>> ibs, daid_list, qaid_list, qaid2_nns, qreq_ = nn_weights.testdata_nn_weights()
        >>> qaid = qaid_list[0]
        >>> #----
        >>> normweight_fn = lnbnn_fn
        >>> tup1 = nn_weights.nn_normalized_weight(normweight_fn, …
Run Code Online (Sandbox Code Playgroud)

python python-sphinx

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