code: def evaluate_call_of_leaf(context, leaf, cut_own_trailer=False):
      """
      Creates a "call" node that consist of all ``trailer`` and ``power``
      objects.  E.g. if you call it with ``append``::
  
          list([]).append(3) or None
  
      You would get a node with the content ``list([]).append`` back.
  
      This generates a copy of the original ast node.
  
      If you're using the leaf, e.g. the bracket `)` it will return ``list([])``.
  
      We use this function for two purposes. Given an expression ``bar.foo``,
      we may want to
        - infer the type of ``foo`` to offer completions after foo
        - infer the type of ``bar`` to be able to jump to the definition of foo
      The option ``cut_own_trailer`` must be set to true for the second purpose.
      """
      trailer = leaf.parent
      if trailer.type == "fstring":
          from jedi.evaluate import compiled
  
          return compiled.get_string_context_set(context.evaluator)
  
      # The leaf may not be the last or first child, because there exist three
      # different trailers: `( x )`, `[ x ]` and `.x`. In the first two examples
      # we should not match anything more than x.
      if trailer.type != "trailer" or leaf not in (
          trailer.children[0],
          trailer.children[-1],
      ):
          if trailer.type == "atom":
              return context.eval_node(trailer)
          return context.eval_node(leaf)
  
      power = trailer.parent
      index = power.children.index(trailer)
      if cut_own_trailer:
          cut = index
      else:
          cut = index + 1
  
      if power.type == "error_node":
          start = index
          while True:
              start -= 1
              base = power.children[start]
              if base.type != "trailer":
                  break
          trailers = power.children[start + 1 : index + 1]
      else:
          base = power.children[0]
          trailers = power.children[1:cut]
  
      if base == "await":
          base = trailers[0]
          trailers = trailers[1:]
  
      values = context.eval_node(base)
      from jedi.evaluate.syntax_tree import eval_trailer
  
      for trailer in trailers:
          values = eval_trailer(context, values, trailer)
      return values
  
imports: import copy
  import sys
  import re
  import os
  from itertools import chain
  from contextlib import contextmanager
  from parso.python import tree
  from jedi._compatibility import unicode
  from jedi.parser_utils import get_parent_scope
label_desc: Use image node_id 3 for calling a global function with example usage: evaluate_call_of_leaf(context, leaf, cut_own_trailer) and returns: values, compiled, context, context