class_docstr: A Script is the base for completions, goto or whatever you want to do with
  |jedi|.
  
  You can either use the ``source`` parameter or ``path`` to read a file.
  Usually you're going to want to use both of them (in an editor).
  
  The script might be analyzed in a different ``sys.path`` than |jedi|:
  
  - if `sys_path` parameter is not ``None``, it will be used as ``sys.path``
    for the script;
  
  - if `sys_path` parameter is ``None`` and ``VIRTUAL_ENV`` environment
    variable is defined, ``sys.path`` for the specified environment will be
    guessed (see :func:`jedi.evaluate.sys_path.get_venv_path`) and used for
    the script;
  
  - otherwise ``sys.path`` will match that of |jedi|.
  
  :param source: The source code of the current file, separated by newlines.
  :type source: str
  :param line: The line to perform actions on (starting with 1).
  :type line: int
  :param column: The column of the cursor (starting with 0).
  :type column: int
  :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 encoding: The encoding of ``source``, if it is not a
      ``unicode`` object (default ``'utf-8'``).
  :type encoding: str
  :param sys_path: ``sys.path`` to use during analysis of the script
  :type sys_path: list
  :param environment: TODO
  :type sys_path: Environment
class_docstr_tok: ["A","Script","is","the","base","for","completions",",","goto","or","whatever","you","want","to","do","with","|jedi|",".","You","can","either","use","the","``","source","``","parameter","or","``","path","``","to","read","a","file",".","Usually","you","'re","going","to","want","to","use","both","of","them","(","in","an","editor",")",".","The","script","might","be","analyzed","in","a","different","``","sys.path","``","than","|jedi|",":","-","if","`","sys_path","`","parameter","is","not","``","None","``",",","it","will","be","used","as","``","sys.path","``","for","the","script",";","-","if","`","sys_path","`","parameter","is","``","None","``","and","``","VIRTUAL_ENV","``","environment","variable","is","defined",",","``","sys.path","``","for","the","specified","environment","will","be","guessed","(","see",":","func",":","`","jedi.evaluate.sys_path.get_venv_path","`",")","and","used","for","the","script",";","-","otherwise","``","sys.path","``","will","match","that","of","|jedi|",".",":","param","source",":","The","source","code","of","the","current","file",",","separated","by","newlines",".",":","type","source",":","str",":","param","line",":","The","line","to","perform","actions","on","(","starting","with","1",")",".",":","type","line",":","int",":","param","column",":","The","column","of","the","cursor","(","starting","with","0",")",".",":","type","column",":","int",":","param","path",":","The","path","of","the","file","in","the","file","system",",","or","``","``","``","if","it","has","n't","been","saved","yet",".",":","type","path",":","str","or","None",":","param","encoding",":","The","encoding","of","``","source","``",",","if","it","is","not","a","``","unicode","``","object","(","default","``","'utf-8","'","``",")",".",":","type","encoding",":","str",":","param","sys_path",":","``","sys.path","``","to","use","during","analysis","of","the","script",":","type","sys_path",":","list",":","param","environment",":","TODO",":","type","sys_path",":","Environment"]
code: def __init__(
      self,
      source=None,
      line=None,
      column=None,
      path=None,
      encoding="utf-8",
      sys_path=None,
      environment=None,
  ):
      self._orig_path = path
      # An empty path (also empty string) should always result in no path.
      self.path = os.path.abspath(path) if path else None
  
      if source is None:
          # TODO add a better warning than the traceback!
          with open(path, "rb") as f:
              source = f.read()
  
      # Load the Python grammar of the current interpreter.
      self._grammar = parso.load_grammar()
  
      if sys_path is not None and not is_py3:
          sys_path = list(map(force_unicode, sys_path))
  
      # Load the Python grammar of the current interpreter.
      project = get_default_project(
          os.path.dirname(self.path) if path else os.getcwd()
      )
      # TODO deprecate and remove sys_path from the Script API.
      if sys_path is not None:
          project._sys_path = sys_path
      self._evaluator = Evaluator(
          project, environment=environment, script_path=self.path
      )
      self._project = project
      debug.speed("init")
      self._module_node, source = self._evaluator.parse_and_get_code(
          code=source,
          path=self.path,
          encoding=encoding,
          cache=False,  # No disk cache, because the current script often changes.
          diff_cache=settings.fast_parser,
          cache_path=settings.cache_directory,
      )
      debug.speed("parsed")
      self._code_lines = parso.split_lines(source, keepends=True)
      self._code = source
      line = max(len(self._code_lines), 1) if line is None else line
      if not (0 < line <= len(self._code_lines)):
          raise ValueError("`line` parameter is not in a valid range.")
  
      line_string = self._code_lines[line - 1]
      line_len = len(line_string)
      if line_string.endswith("\r\n"):
          line_len -= 1
      if line_string.endswith("\n"):
          line_len -= 1
  
      column = line_len if column is None else column
      if not (0 <= column <= line_len):
          raise ValueError(
              "`column` parameter (%d) is not in a valid range "
              "(0-%d) for line %d (%r)."
              % (column, line_len, line, line_string)
          )
      self._pos = line, column
      self._path = path
  
      cache.clear_time_caches()
      debug.reset_time()
  
imports: import os
  import sys
  import warnings
  import parso
  from parso.python import tree
  from jedi._compatibility import force_unicode, is_py3
  from jedi.parser_utils import get_executable_nodes
  from jedi import debug
  from jedi import settings
  from jedi import cache
  from jedi.api import classes
  from jedi.api import interpreter
  from jedi.api import helpers
  from jedi.api.completion import Completion
  from jedi.api.environment import InterpreterEnvironment
  from jedi.api.project import get_default_project
  from jedi.evaluate import Evaluator
  from jedi.evaluate import imports
  from jedi.evaluate import usages
  from jedi.evaluate.arguments import try_iter_content
  from jedi.evaluate.helpers import get_module_names, evaluate_call_of_leaf
  from jedi.evaluate.sys_path import dotted_path_in_sys_path
  from jedi.evaluate.filters import TreeNameDefinition, ParamName
  from jedi.evaluate.syntax_tree import tree_name_to_contexts
  from jedi.evaluate.context import ModuleContext
  from jedi.evaluate.context.iterable import unpack_tuple_to_dict
label_desc: Use image node_id 1 to create a new Script object from inherited base classes: object with example: obj = Script(source, line, column, path, encoding, sys_path, environment)