From 7632a7d1204e609703328d7ab51d5e3d081c266f Mon Sep 17 00:00:00 2001 From: Dave Halter Date: Tue, 13 May 2014 15:56:41 +0200 Subject: [PATCH] sorting the statements for analysis. we need to be able to reproduce results. --- jedi/api/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/jedi/api/__init__.py b/jedi/api/__init__.py index b85748bb..fe077969 100644 --- a/jedi/api/__init__.py +++ b/jedi/api/__init__.py @@ -588,7 +588,8 @@ class Script(object): def _analysis(self): statements = set(chain(*self._parser.module().used_names.values())) - for stmt in statements: + # Sort the statements so that the results are reproducible. + for stmt in sorted(statements, key=lambda obj: obj.start_pos): if isinstance(stmt, pr.Import): imps = imports.ImportWrapper(self._evaluator, stmt, nested_resolve=True).follow()