def get_canonical_path(project, resource, offset):
 pymod = project.get_pymodule(resource)
 pyname = rope.base.evaluate.eval_location(pymod, offset)
 (defmod, lineno) = pyname.get_definition_location()
 if (not defmod):
  return None
 scope = defmod.get_scope().get_inner_scope_for_line(lineno)
 names = []
 if isinstance(pyname, pynamesdef.ParameterName):
  names = [(worder.get_name_at(pymod.get_resource(), offset), 'PARAMETER')]
 elif isinstance(pyname, pynamesdef.AssignedName):
  names = [(worder.get_name_at(pymod.get_resource(), offset), 'VARIABLE')]
 while scope.parent:
  if isinstance(scope, pyscopes.FunctionScope):
   scope_type = 'FUNCTION'
  elif isinstance(scope, pyscopes.ClassScope):
   scope_type = 'CLASS'
  else:
   scope_type = None
  names.append((scope.pyobject.get_name(), scope_type))
  scope = scope.parent
 names.append((defmod.get_resource().real_path, 'MODULE'))
 names.reverse()
 return names

def get_canonical_path ( project , resource , offset ) : pymod = project . get_pymodule ( resource ) pyname = rope . base . evaluate . eval_location ( pymod , offset ) ( defmod , lineno ) = pyname . get_definition_location ( ) if ( not defmod ) : return None scope = defmod . get_scope ( ) . get_inner_scope_for_line ( lineno ) names = [ ] if isinstance ( pyname , pynamesdef . ParameterName ) : names = [ ( worder . get_name_at ( pymod . get_resource ( ) , offset ) , 'PARAMETER' ) ] elif isinstance ( pyname , pynamesdef . AssignedName ) : names = [ ( worder . get_name_at ( pymod . get_resource ( ) , offset ) , 'VARIABLE' ) ] while scope . parent : if isinstance ( scope , pyscopes . FunctionScope ) : scope_type = 'FUNCTION' elif isinstance ( scope , pyscopes . ClassScope ) : scope_type = 'CLASS' else : scope_type = None names . append ( ( scope . pyobject . get_name ( ) , scope_type ) ) scope = scope . parent names . append ( ( defmod . get_resource ( ) . real_path , 'MODULE' ) ) names . reverse ( ) return names
get the canonical path to an object .