1
0
forked from VimPlug/jedi

use encoding instead of source_encoding as a param in the API. I really hope this doesn't break anything, but I doubt it.

This commit is contained in:
David Halter
2013-10-07 23:52:51 +04:30
parent 4ea5f370eb
commit ee181ea098

View File

@@ -53,12 +53,12 @@ class Script(object):
:param path: The path of the file in the file system, or ``''`` if
it hasn't been saved yet.
:type path: str or None
:param source_encoding: The encoding of ``source``, if it is not a
:param encoding: The encoding of ``source``, if it is not a
``unicode`` object (default ``'utf-8'``).
:type source_encoding: str
:type encoding: str
"""
def __init__(self, source=None, line=None, column=None, path=None,
source_encoding='utf-8', source_path=None):
encoding='utf-8', source_path=None):
if source_path is not None:
warnings.warn("Use path instead of source_path.", DeprecationWarning)
path = source_path
@@ -82,7 +82,7 @@ class Script(object):
api_classes._clear_caches()
debug.reset_time()
self.source = modules.source_to_unicode(source, source_encoding)
self.source = modules.source_to_unicode(source, encoding)
self._pos = self._line, self._column
self._module = modules.ModuleWithCursor(
path, source=self.source, position=self._pos)
@@ -658,7 +658,7 @@ class Interpreter(Script):
def defined_names(source, path=None, source_encoding='utf-8'):
def defined_names(source, path=None, encoding='utf-8'):
"""
Get all definitions in `source` sorted by its position.
@@ -671,7 +671,7 @@ def defined_names(source, path=None, source_encoding='utf-8'):
:rtype: list of api_classes.Definition
"""
parser = Parser(
modules.source_to_unicode(source, source_encoding),
modules.source_to_unicode(source, encoding),
module_path=path,
)
return api_classes._defined_names(parser.module)