parameters: (self, add_import_name=False)
return_statement: return definitions, search_name
docstring: Used for goto_assignments and usages.
  
          :param add_import_name: Add the the name (if import) to the result.
docstring_summary: Used for goto_assignments and usages.
docstring_tokens: Used for goto_assignments and usages .
function: def _goto(self, add_import_name=False):
          """
          Used for goto_assignments and usages.
  
          :param add_import_name: Add the the name (if import) to the result.
          """
          def follow_inexistent_imports(defs):
              """ Imports can be generated, e.g. following
              `multiprocessing.dummy` generates an import dummy in the
              multiprocessing module. The Import doesn't exist -> follow.
              """
              definitions = set(defs)
              for d in defs:
                  if isinstance(d.parent, pr.Import) \
                          and d.start_pos == (0, 0):
                      i = imports.ImportPath(d.parent).follow(is_goto=True)
                      definitions.remove(d)
                      definitions |= follow_inexistent_imports(i)
              return definitions
  
          goto_path = self._module.get_path_under_cursor()
          context = self._module.get_context()
          user_stmt = self._user_stmt()
          if next(context) in ('class', 'def'):
              user_scope = self._parser.user_scope
              definitions = set([user_scope.name])
              search_name = unicode(user_scope.name)
          elif isinstance(user_stmt, pr.Import):
              s, name_part = self._get_on_import_stmt(user_stmt)
              try:
                  definitions = [s.follow(is_goto=True)[0]]
              except IndexError:
                  definitions = []
              search_name = unicode(name_part)
  
              if add_import_name:
                  import_name = user_stmt.get_defined_names()
                  # imports have only one name
                  if not user_stmt.star \
                          and name_part == import_name[0].names[-1]:
                      definitions.append(import_name[0])
          else:
              stmt = self._get_under_cursor_stmt(goto_path)
              defs, search_name = evaluate.goto(stmt)
              definitions = follow_inexistent_imports(defs)
              if isinstance(user_stmt, pr.Statement):
                  c = user_stmt.get_commands()
                  if c and not isinstance(c[0], (str, unicode)) \
                          and c[0].start_pos > self._pos \
                          and not re.search(r'\.\w+$', goto_path):
                      # The cursor must be after the start, otherwise the
                      # statement is just an assignee.
                      definitions = [user_stmt]
          return definitions, search_name
function_tokens: def _goto ( self , add_import_name = False ) : def follow_inexistent_imports ( defs ) : """ Imports can be generated, e.g. following
              `multiprocessing.dummy` generates an import dummy in the
              multiprocessing module. The Import doesn't exist -> follow.
              """ definitions = set ( defs ) for d in defs : if isinstance ( d . parent , pr . Import ) and d . start_pos == ( 0 , 0 ) : i = imports . ImportPath ( d . parent ) . follow ( is_goto = True ) definitions . remove ( d ) definitions |= follow_inexistent_imports ( i ) return definitions goto_path = self . _module . get_path_under_cursor ( ) context = self . _module . get_context ( ) user_stmt = self . _user_stmt ( ) if next ( context ) in ( 'class' , 'def' ) : user_scope = self . _parser . user_scope definitions = set ( [ user_scope . name ] ) search_name = unicode ( user_scope . name ) elif isinstance ( user_stmt , pr . Import ) : s , name_part = self . _get_on_import_stmt ( user_stmt ) try : definitions = [ s . follow ( is_goto = True ) [ 0 ] ] except IndexError : definitions = [ ] search_name = unicode ( name_part ) if add_import_name : import_name = user_stmt . get_defined_names ( ) # imports have only one name if not user_stmt . star and name_part == import_name [ 0 ] . names [ - 1 ] : definitions . append ( import_name [ 0 ] ) else : stmt = self . _get_under_cursor_stmt ( goto_path ) defs , search_name = evaluate . goto ( stmt ) definitions = follow_inexistent_imports ( defs ) if isinstance ( user_stmt , pr . Statement ) : c = user_stmt . get_commands ( ) if c and not isinstance ( c [ 0 ] , ( str , unicode ) ) and c [ 0 ] . start_pos > self . _pos and not re . search ( r'\.\w+$' , goto_path ) : # The cursor must be after the start, otherwise the # statement is just an assignee. definitions = [ user_stmt ] return definitions , search_name