add __repr__ to api.Script

This commit is contained in:
David Halter
2013-01-07 01:07:49 +01:00
parent 5796496baf
commit 54ac9b3292
2 changed files with 5 additions and 2 deletions
+2 -2
View File
@@ -8,9 +8,9 @@ example for the autocompletion feature:
>>> import jedi >>> import jedi
>>> source = '''import json; json.l''' >>> source = '''import json; json.l'''
>>> script = jedi.Script(source, 1, 19, '') >>> script = jedi.Script(source, 1, 19, 'example.py')
>>> script >>> script
<jedi.api.Script at 0x7f6d40f3db90> <Script: 'example.py'>
>>> completions = script.complete() >>> completions = script.complete()
>>> completions >>> completions
[<Completion: load>, <Completion: loads>] [<Completion: load>, <Completion: loads>]
+3
View File
@@ -62,6 +62,9 @@ class Script(object):
self.source_path = source_path self.source_path = source_path
debug.speed('init') debug.speed('init')
def __repr__(self):
return '<%s: %s>' % (self.__class__.__name__, repr(self.source_path))
@property @property
def _parser(self): def _parser(self):
""" lazy parser.""" """ lazy parser."""