Jedi 不使用 boto3 库

Jedi Not Working With boto3 Library

我正在尝试让 jedi 与 Amazon Web Services ( https://github.com/boto/boto3 ) 的 boto3 库一起正常工作。

用一个例子可能最容易解释:

$ python
Python 3.4.3 (default, Jul 16 2015, 13:03:44) 
[GCC 5.1.1 20150618 (Red Hat 5.1.1-4)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import boto3
>>> sqs = boto3.resource("sqs", region_name="us-west-2")
>>> sqs.<TAB><TAB>
sqs.Message(            sqs.__dict__            sqs.__format__(
sqs.__hash__            sqs.__module__          sqs.__reduce_ex__(
sqs.__str__(            sqs.get_queue_by_name(
...
>>> type(sqs)
<class 'boto3.resources.factory.sqs'>
>>> 

在交互式解释器上,我正确完成了 class。输入绝地:

>>> import jedi
>>> jedi.__version__
'0.9.0'
>>> jedi.Script('import boto3; sqs = boto3.resou').completions()
[<Completion: resource>, <Completion: resources>]
>>>

还在这里工作!但是后来...

>>> code = 'import boto3; sqs = boto3.resource("sqs", region_name="us-west-2"); sqs.'
>>> jedi.Script(code).completions()
[]
>>> 

我不确定这是我的错,图书馆的错还是绝地武士的错。

编辑: 似乎 PyCharm 有同样的问题:

由 jamesls 提供(来自 PyCharm 问题 ):

This is happening because all of the methods on the boto3 clients and resource objects are generated at runtime based on a JSON file that describes what operations the service supports. Pycharm would have to have specific knowledge about this process in order to auto complete method names.