From 9f416c9dae196f20068c40644ae860fe4e03cca6 Mon Sep 17 00:00:00 2001 From: Takafumi Arakaki Date: Wed, 30 Jan 2013 01:12:45 +0100 Subject: [PATCH] Implement import for dotted types in dcostring --- jedi/docstrings.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/jedi/docstrings.py b/jedi/docstrings.py index 39134b19..4332783c 100644 --- a/jedi/docstrings.py +++ b/jedi/docstrings.py @@ -20,9 +20,20 @@ def follow_param(param): func = param.parent_function #print func, param, param.parent_function param_str = search_param_in_docstr(func.docstr, str(param.get_name())) + user_position = (1, 0) if param_str is not None: - p = parsing.PyFuzzyParser(param_str, None, (1, 0), no_docstr=True) + + # Try to import module part in dotted name. + # (e.g., 'threading' in 'threading.Thread'). + if '.' in param_str: + param_str = 'import {0}\n{1}'.format( + param_str.rsplit('.', 1)[0], + param_str) + user_position = (2, 0) + + p = parsing.PyFuzzyParser(param_str, None, user_position, + no_docstr=True) p.user_stmt.parent = func return evaluate.follow_statement(p.user_stmt) return []