1
0
forked from VimPlug/jedi

Create the basics to work with TypedDict in the future

This commit is contained in:
Dave Halter
2020-01-26 19:25:23 +01:00
parent 18f84d3af7
commit 8eb980db73
6 changed files with 156 additions and 3 deletions

View File

@@ -293,6 +293,25 @@ def cut_value_at_position(leaf, position):
return ''.join(lines)
def expr_is_dotted(node):
"""
Checks if a path looks like `name` or `name.foo.bar` and not `name()`.
"""
if node.type == 'atom':
if len(node.children) == 3 and node.children[0] == '(':
return expr_is_dotted(node.children[1])
return False
if node.type == 'atom_expr':
children = node.children
if children[0] == 'await':
return False
if not expr_is_dotted(children[0]):
return False
# Check trailers
return all(c.children[0] == '.' for c in children[1:])
return node.type == 'name'
def _function_is_x_method(method_name):
def wrapper(function_node):
"""