1
0
forked from VimPlug/jedi

Few docstring fixes.

This commit is contained in:
Dave Halter
2014-12-11 15:32:45 +01:00
parent 003d1249c5
commit 6afc5ccca5
4 changed files with 11 additions and 10 deletions

View File

@@ -236,7 +236,7 @@ class BaseDefinition(object):
>>> script = Script(source, 1, len('def f'), 'example.py') >>> script = Script(source, 1, len('def f'), 'example.py')
>>> doc = script.goto_definitions()[0].docstring() >>> doc = script.goto_definitions()[0].docstring()
>>> print(doc) >>> print(doc)
f(a, b = 1) f(a, b=1)
<BLANKLINE> <BLANKLINE>
Document for function f. Document for function f.

View File

@@ -502,7 +502,7 @@ def get_names_of_scope(evaluator, scope, position=None, star_search=True, includ
>>> from jedi._compatibility import u >>> from jedi._compatibility import u
>>> from jedi.parser import Parser, load_grammar >>> from jedi.parser import Parser, load_grammar
>>> parser = Parser(load_grammar('python3.4'), u(''' >>> parser = Parser(load_grammar(), u('''
... x = ['a', 'b', 'c'] ... x = ['a', 'b', 'c']
... def func(): ... def func():
... y = None ... y = None
@@ -515,7 +515,7 @@ def get_names_of_scope(evaluator, scope, position=None, star_search=True, includ
scope. scope.
>>> from jedi.evaluate import Evaluator >>> from jedi.evaluate import Evaluator
>>> pairs = list(get_names_of_scope(Evaluator(), scope)) >>> pairs = list(get_names_of_scope(Evaluator(load_grammar()), scope))
>>> pairs[0] >>> pairs[0]
(<Function: func@3-5>, [<Name: y@4,4>]) (<Function: func@3-5>, [<Name: y@4,4>])

View File

@@ -748,6 +748,7 @@ class ModuleWrapper(use_metaclass(CachedMetaClass, pr.Module, Wrapper)):
yield self, self._module_attributes() yield self, self._module_attributes()
for star_module in self.star_imports(): for star_module in self.star_imports():
yield self, star_module.get_defined_names() yield self, star_module.get_defined_names()
if self.base.global_names:
yield self, self.base.global_names yield self, self.base.global_names
sub_modules = self._sub_modules() sub_modules = self._sub_modules()
if sub_modules: if sub_modules:

View File

@@ -19,18 +19,18 @@ The easiest way to play with this module is to use :class:`parsing.Parser`.
:attr:`parsing.Parser.module` holds an instance of :class:`SubModule`: :attr:`parsing.Parser.module` holds an instance of :class:`SubModule`:
>>> from jedi._compatibility import u >>> from jedi._compatibility import u
>>> from jedi.parser import Parser >>> from jedi.parser import Parser, load_grammar
>>> parser = Parser(u('import os'), 'example.py') >>> parser = Parser(load_grammar(), u('import os'), 'example.py')
>>> submodule = parser.module >>> submodule = parser.module
>>> submodule >>> submodule
<SubModule: example.py@1-1> <SubModule: example.py@1-2>
Any subclasses of :class:`Scope`, including :class:`SubModule` has Any subclasses of :class:`Scope`, including :class:`SubModule` has
attribute :attr:`imports <Scope.imports>`. This attribute has import attribute :attr:`imports <Scope.imports>`. This attribute has import
statements in this scope. Check this out: statements in this scope. Check this out:
>>> submodule.imports >>> submodule.imports
[<Import: import os @1,0>] [<ImportName: import os@1,0>]
See also :attr:`Scope.subscopes` and :attr:`Scope.statements`. See also :attr:`Scope.subscopes` and :attr:`Scope.statements`.
@@ -557,8 +557,8 @@ class Scope(Simple, DocstringMixin):
Get all defined names in this scope. Useful for autocompletion. Get all defined names in this scope. Useful for autocompletion.
>>> from jedi._compatibility import u >>> from jedi._compatibility import u
>>> from jedi.parser import Parser >>> from jedi.parser import Parser, load_grammar
>>> parser = Parser(u(''' >>> parser = Parser(load_grammar(), u('''
... a = x ... a = x
... b = y ... b = y
... b.c = z ... b.c = z