1
0
forked from VimPlug/jedi

Document BaseDefinition.module_name

This commit is contained in:
Takafumi Arakaki
2013-03-13 21:57:00 +01:00
parent 2f7797f867
commit 125a3b1a6b

View File

@@ -138,7 +138,17 @@ class BaseDefinition(object):
@property
def module_name(self):
"""The module name."""
"""
The module name.
>>> from jedi import Script
>>> source = 'import datetime'
>>> script = Script(source, 1, len(source), 'example.py')
>>> d = script.definition()[0]
>>> print(d.module_name) # doctest: +ELLIPSIS
datetime
"""
path = self.module_path
sep = os.path.sep
p = re.sub(r'^.*?([\w\d]+)(%s__init__)?.py$' % sep, r'\1', path)