Commits

Anonymous committed 9c75bbe

using pyobject[name] instead of pyobject.get_attribute(name)

Comments (0)

Files changed (26)

rope/base/builtins.py

         new_dict = context.get_pynames(['self', 'd'])[1]
         if new_dict and isinstance(new_dict.get_object().get_type(), Dict):
             args = rope.base.evaluate.ObjectArguments([new_dict])
-            items = new_dict.get_object().get_attribute('popitem').\
+            items = new_dict.get_object()['popitem'].\
                     get_object().get_returned_object(args)
             context.save_per_name(items)
         else:
     seq = pyname.get_object()
     args = rope.base.evaluate.ObjectArguments([pyname])
     if '__iter__' in seq.get_attributes():
-        iter = seq.get_attribute('__iter__').get_object().\
+        iter = seq['__iter__'].get_object().\
                get_returned_object(args)
         if iter is not None and 'next' in iter.get_attributes():
-            holding = iter.get_attribute('next').get_object().\
+            holding = iter['next'].get_object().\
                       get_returned_object(args)
             return holding
 

rope/base/evaluate.py

                 class_scope = holding_scope.parent
             name = self.word_finder.get_primary_at(offset).strip()
             try:
-                return (None, class_scope.pyobject.get_attribute(name))
+                return (None, class_scope.pyobject[name])
             except rope.base.exceptions.AttributeNotFoundError:
                 return (None, None)
         # function header
                 return pyobject
             elif isinstance(pyobject, pyobjects.AbstractClass) and \
                  '__init__' in pyobject.get_attributes():
-                return pyobject.get_attribute('__init__').get_object()
+                return pyobject['__init__'].get_object()
             elif '__call__' in pyobject.get_attributes():
-                return pyobject.get_attribute('__call__').get_object()
+                return pyobject['__call__'].get_object()
         return None
 
     def _find_module(self, module_name):
         self.old_result = pyname
         if pyname.get_object() != rope.base.pyobjects.get_unknown():
             try:
-                self.result = pyname.get_object().get_attribute(node.attr)
+                self.result = pyname.get_object()[node.attr]
             except exceptions.AttributeNotFoundError:
                 self.result = None
 
         if isinstance(pyobject, rope.base.pyobjects.AbstractClass):
             result = None
             if '__new__' in pyobject.get_attributes():
-                new_function = pyobject.get_attribute('__new__').get_object()
+                new_function = pyobject['__new__'].get_object()
                 result = _get_returned(new_function)
             if result is None or \
                result == rope.base.pyobjects.get_unknown():
         if isinstance(pyobject, rope.base.pyobjects.AbstractFunction):
             pyfunction = pyobject
         elif '__call__' in pyobject.get_attributes():
-            pyfunction = pyobject.get_attribute('__call__').get_object()
+            pyfunction = pyobject['__call__'].get_object()
         if pyfunction is not None:
             self.result = rope.base.pynames.UnboundName(
                 pyobject=_get_returned(pyfunction))
         else:
             return
         if function_name in pyobject.get_attributes():
-            call_function = pyobject.get_attribute(function_name).get_object()
+            call_function = pyobject[function_name].get_object()
             args = [node]
             if other_args:
                 args += other_args

rope/base/oi/objectinfer.py

 
 def _get_attribute(pyobject, name):
     if pyobject is not None and name in pyobject.get_attributes():
-        return pyobject.get_attribute(name)
+        return pyobject[name]
 
 
 def _infer_returned(pyobject, args):

rope/base/oi/staticoi.py

         elif isinstance(pyfunction, pyobjects.PyClass):
             pyclass = pyfunction
             if '__init__' in pyfunction.get_attributes():
-                pyfunction = pyfunction.get_attribute('__init__').get_object()
+                pyfunction = pyfunction['__init__'].get_object()
             pyname = rope.base.pynames.UnboundName(pyobjects.PyObject(pyclass))
             args = self._args_with_self(primary, pyname, pyfunction, node)
         elif '__call__' in pyfunction.get_attributes():
-            pyfunction = pyfunction.get_attribute('__call__').get_object()
+            pyfunction = pyfunction['__call__'].get_object()
             args = self._args_with_self(primary, pyname, pyfunction, node)
         else:
             return
             if instance is not None and value is not None:
                 pyobject = instance.get_object()
                 if '__setitem__' in pyobject.get_attributes():
-                    pyfunction = pyobject.get_attribute('__setitem__').get_object()
+                    pyfunction = pyobject['__setitem__'].get_object()
                     args = evaluate.ObjectArguments([instance] + args_pynames)
                     self._call(pyfunction, args)
                 # IDEA: handle `__setslice__`, too

rope/base/pynames.py

 
     def _get_imported_pyname(self):
         try:
-            return self.imported_module.get_object().get_attribute(
-                self.imported_name)
+            return self.imported_module.get_object()[self.imported_name]
         except exceptions.AttributeNotFoundError:
             return UnboundName()
 

rope/base/pyobjects.py

     def get_type(self):
         return self.type
 
+    def __getitem__(self, key):
+        """The same as ``get_attribute(key)``"""
+        return self.get_attribute(key)
+
     def __eq__(self, obj):
         """Check the equality of two `PyObject`\s
 

rope/base/pyobjectsdef.py

         for name in node.names:
             if module is not None:
                 try:
-                    pyname = module.get_attribute(name)
+                    pyname = module[name]
                 except exceptions.AttributeNotFoundError:
                     pyname = pynames.AssignedName(node.lineno)
             self.names[name] = pyname

rope/base/pyscopes.py

             raise exceptions.NameNotFoundError('name %s not found' % name)
         return self.get_names()[name]
 
+    def __getitem__(self, key):
+        """The same as ``get_name(key)``"""
+        return self.get_name(key)
+
     def get_scopes(self):
         """Return the subscopes of this scope.
 
 
     def get_name(self, name):
         try:
-            return self.pyobject.get_attribute(name)
+            return self.pyobject[name]
         except exceptions.AttributeNotFoundError:
             if name in self.builtin_names:
                 return self.builtin_names[name]

rope/contrib/codeassist.py

                     pass
                 elif isinstance(pyobject, pyobjects.AbstractClass) and \
                      '__init__' in pyobject.get_attributes():
-                    pyobject = pyobject.get_attribute('__init__').get_object()
+                    pyobject = pyobject['__init__'].get_object()
                 elif '__call__' in pyobject.get_attributes():
-                    pyobject = pyobject.get_attribute('__call__').get_object()
+                    pyobject = pyobject['__call__'].get_object()
                 if isinstance(pyobject, pyobjects.AbstractFunction):
                     param_names = []
                     param_names.extend(
         doc = 'class %s(%s):\n\n' % (pyclass.get_name(), ', '.join(supers)) + contents
 
         if '__init__' in pyclass.get_attributes():
-            init = pyclass.get_attribute('__init__').get_object()
+            init = pyclass['__init__'].get_object()
             if isinstance(init, pyobjects.AbstractFunction):
                 doc += '\n\n' + self._get_single_function_docstring(init)
         return doc
         result = []
         for super_class in pyclass.get_superclasses():
             if name in super_class.get_attributes():
-                function = super_class.get_attribute(name).get_object()
+                function = super_class[name].get_object()
                 if isinstance(function, pyobjects.AbstractFunction):
                     result.append(function)
             result.extend(self._get_super_methods(super_class, name))

rope/refactor/change_signature.py

         pyobject = self.pyname.get_object()
         if isinstance(pyobject, pyobjects.PyClass) and \
            '__init__' in pyobject.get_attributes():
-            self.pyname = pyobject.get_attribute('__init__')
+            self.pyname = pyobject['__init__']
             self.name = '__init__'
         pyobject = self.pyname.get_object()
         self.others = None
            isinstance(pyobject.parent, pyobjects.PyClass):
             pyclass = pyobject.parent
             self.others = (pyclass.get_name(),
-                           pyclass.parent.get_attribute(pyclass.get_name()))
+                           pyclass.parent[pyclass.get_name()])
 
     def _change_calls(self, call_changer, in_hierarchy=False,
                       handle=taskhandle.NullTaskHandle()):

rope/refactor/importutils/__init__.py

 from rope.refactor.importutils import module_imports
 from rope.refactor.importutils.importinfo import \
      (NormalImport, FromImport, get_module_name)
-
-
 class ImportTools(object):
 
     def __init__(self, pycore):
             if alias is not None:
                 imported = alias
             occurrence_finder = occurrences.FilteredFinder(
-                self.pycore, imported, [pymodule.get_attribute(imported)],
+                self.pycore, imported, [pymodule[imported]],
                 imports=False)
             source = rename.rename_in_module(
                 occurrence_finder, module_name + '.' + name,

rope/refactor/importutils/actions.py

         new_pairs = []
         for name, alias in import_info.names_and_aliases:
             try:
-                result = pymodule.get_attribute(name).get_object()
+                result = pymodule[name].get_object()
                 if isinstance(result, pyobjects.PyModule) and \
                    result.get_resource() == self.resource:
                     imported = name

rope/refactor/inline.py

         source = header + self.body
         for name in to_be_inlined:
             pymodule = self.pycore.get_string_module(source, self.resource)
-            pyname = pymodule.get_attribute(name)
+            pyname = pymodule[name]
             source = _inline_variable(self.pycore, pymodule, pyname, name)
         return self._replace_returns_with(source, returns)
 

rope/refactor/method_object.py

         for param in self._get_parameter_names():
             body = param + ' = None\n' + body
             pymod = self.pycore.get_string_module(body, self.resource)
-            pyname = pymod.get_attribute(param)
+            pyname = pymod[param]
             finder = occurrences.FilteredFinder(
                 self.pycore, param, [pyname])
             result = rename.rename_in_module(finder, 'self.' + param,

rope/refactor/move.py

         if dest_attr not in old_pyclass.get_attributes():
             raise exceptions.RefactoringError(
                 'Destination attribute <%s> not found' % dest_attr)
-        pyclass = old_pyclass.get_attribute(dest_attr).get_object().get_type()
+        pyclass = old_pyclass[dest_attr].get_object().get_type()
         if not isinstance(pyclass, pyobjects.PyClass):
             raise exceptions.RefactoringError(
                 'Unknown class type for attribute <%s>' % dest_attr)
         body = self_name + ' = None\n' + self._get_unchanged_body()
         pymodule = self.pycore.get_string_module(body)
         finder = occurrences.FilteredFinder(
-            self.pycore, self_name, [pymodule.get_attribute(self_name)])
+            self.pycore, self_name, [pymodule[self_name]])
         result = rename.rename_in_module(finder, host, pymodule=pymodule)
         if result is None:
             result = body
             def __call__(self, name):
                 try:
                     if name == self.old_name and \
-                       pymodule.get_attribute(name).get_object() == \
+                       pymodule[name].get_object() == \
                        self.old_pyname.get_object():
                         self.changed = True
                         return False

rope/refactor/rename.py

         if isinstance(self.instance, pynames.ParameterName):
             for pyobject in self.instance.get_objects():
                 try:
-                    result.add(pyobject.get_attribute(self.name))
+                    result.add(pyobject[self.name])
                 except exceptions.AttributeNotFoundError:
                     pass
         if self.in_hierarchy:
         return result
 
     def _get_all_methods_in_subclasses(self, pyclass, attr_name):
-        result = set([pyclass.get_attribute(attr_name)])
+        result = set([pyclass[attr_name]])
         for subclass in pyclass.pycore.get_subclasses(pyclass, self.handle):
             result.update(self._get_all_methods_in_subclasses(subclass, attr_name))
         return result

rope/refactor/restructure.py

         else:
             pyobject = self.pycore.get_module(attributes[0])
         for attribute in attributes[1:]:
-            pyname = pyobject.get_attribute(attribute)
+            pyname = pyobject[attribute]
             if pyname is None:
                 return None
             pyobject = pyname.get_object()

rope/refactor/wildcards.py

         else:
             pyobject = self.project.pycore.get_module(attributes[0])
         for attribute in attributes[1:]:
-            pyname = pyobject.get_attribute(attribute)
+            pyname = pyobject[attribute]
             if pyname is None:
                 return None
             pyobject = pyname.get_object()

ropetest/advanced_oi_test.py

         mod.write(code)
         self.pycore.run_module(mod).wait_process()
         pymod = self.pycore.resource_to_pyobject(mod)
-        self.assertEquals(pymod.get_attribute('a_func').get_object(),
-                          pymod.get_attribute('a_var').get_object())
+        self.assertEquals(pymod['a_func'].get_object(),
+                          pymod['a_var'].get_object())
 
     def test_module_dti(self):
         mod1 = testutils.create_module(self.project, 'mod1')
         self.pycore.run_module(mod2).wait_process()
         pymod2 = self.pycore.resource_to_pyobject(mod2)
         self.assertEquals(self.pycore.resource_to_pyobject(mod1),
-                          pymod2.get_attribute('a_var').get_object())
+                          pymod2['a_var'].get_object())
 
     def test_class_from_another_module_dti(self):
         mod1 = testutils.create_module(self.project, 'mod1')
         self.pycore.run_module(mod2).wait_process()
         pymod1 = self.pycore.resource_to_pyobject(mod1)
         pymod2 = self.pycore.resource_to_pyobject(mod2)
-        self.assertEquals(pymod2.get_attribute('AClass').get_object(),
-                          pymod2.get_attribute('a_var').get_object())
+        self.assertEquals(pymod2['AClass'].get_object(),
+                          pymod2['a_var'].get_object())
 
 
     def test_class_dti(self):
         mod.write(code)
         self.pycore.run_module(mod).wait_process()
         pymod = self.pycore.resource_to_pyobject(mod)
-        self.assertEquals(pymod.get_attribute('AClass').get_object(),
-                          pymod.get_attribute('a_var').get_object())
+        self.assertEquals(pymod['AClass'].get_object(),
+                          pymod['a_var'].get_object())
 
     def test_instance_dti(self):
         mod = testutils.create_module(self.project, 'mod')
         mod.write(code)
         self.pycore.run_module(mod).wait_process()
         pymod = self.pycore.resource_to_pyobject(mod)
-        self.assertEquals(pymod.get_attribute('AClass').get_object(),
-                          pymod.get_attribute('a_var').get_object().get_type())
+        self.assertEquals(pymod['AClass'].get_object(),
+                          pymod['a_var'].get_object().get_type())
 
     def test_method_dti(self):
         mod = testutils.create_module(self.project, 'mod')
         mod.write(code)
         self.pycore.run_module(mod).wait_process()
         pymod = self.pycore.resource_to_pyobject(mod)
-        self.assertEquals(pymod.get_attribute('AClass').get_object(),
-                          pymod.get_attribute('a_var').get_object().get_type())
+        self.assertEquals(pymod['AClass'].get_object(),
+                          pymod['a_var'].get_object().get_type())
 
     def test_function_argument_dti(self):
         mod = testutils.create_module(self.project, 'mod')
         mod.write(code)
         self.pycore.run_module(mod).wait_process()
         pymod = self.pycore.resource_to_pyobject(mod)
-        self.assertEquals(pymod.get_attribute('AClass').get_object(),
-                          pymod.get_attribute('a_var').get_object())
+        self.assertEquals(pymod['AClass'].get_object(),
+                          pymod['a_var'].get_object())
 
     def test_nested_classes(self):
         mod = testutils.create_module(self.project, 'mod')
                'a_var = a_func(a_func)\n'
         mod.write(code)
         pymod = self.pycore.resource_to_pyobject(mod)
-        pymod.get_attribute('a_var').get_object()
+        pymod['a_var'].get_object()
         self.pycore.run_module(mod).wait_process()
-        self.assertEquals(pymod.get_attribute('a_func').get_object(),
-                          pymod.get_attribute('a_var').get_object())
+        self.assertEquals(pymod['a_func'].get_object(),
+                          pymod['a_var'].get_object())
 
     def test_list_objects_and_dynamicoi(self):
         mod = testutils.create_module(self.project, 'mod')
         mod.write(code)
         self.pycore.run_module(mod).wait_process()
         pymod = self.pycore.resource_to_pyobject(mod)
-        c_class = pymod.get_attribute('C').get_object()
-        a_var = pymod.get_attribute('a_var').get_object()
+        c_class = pymod['C'].get_object()
+        a_var = pymod['a_var'].get_object()
         self.assertEquals(c_class, a_var.get_type())
 
     def test_for_loops_and_dynamicoi(self):
         mod.write(code)
         self.pycore.run_module(mod).wait_process()
         pymod = self.pycore.resource_to_pyobject(mod)
-        c_class = pymod.get_attribute('C').get_object()
-        a_var = pymod.get_attribute('a_var').get_object()
+        c_class = pymod['C'].get_object()
+        a_var = pymod['a_var'].get_object()
         self.assertEquals(c_class, a_var.get_type())
 
     def test_dict_objects_and_dynamicoi(self):
         mod.write(code)
         self.pycore.run_module(mod).wait_process()
         pymod = self.pycore.resource_to_pyobject(mod)
-        c_class = pymod.get_attribute('C').get_object()
-        a_var = pymod.get_attribute('a_var').get_object()
+        c_class = pymod['C'].get_object()
+        a_var = pymod['a_var'].get_object()
         self.assertEquals(c_class, a_var.get_type())
 
     def test_dict_keys_and_dynamicoi(self):
         mod.write(code)
         self.pycore.run_module(mod).wait_process()
         pymod = self.pycore.resource_to_pyobject(mod)
-        c_class = pymod.get_attribute('C').get_object()
-        a_var = pymod.get_attribute('a_var').get_object()
+        c_class = pymod['C'].get_object()
+        a_var = pymod['a_var'].get_object()
         self.assertEquals(c_class, a_var.get_type())
 
     def test_dict_keys_and_dynamicoi2(self):
         mod.write(code)
         self.pycore.run_module(mod).wait_process()
         pymod = self.pycore.resource_to_pyobject(mod)
-        c1_class = pymod.get_attribute('C1').get_object()
-        c2_class = pymod.get_attribute('C2').get_object()
-        a_var = pymod.get_attribute('a').get_object()
-        b_var = pymod.get_attribute('b').get_object()
+        c1_class = pymod['C1'].get_object()
+        c2_class = pymod['C2'].get_object()
+        a_var = pymod['a'].get_object()
+        b_var = pymod['b'].get_object()
         self.assertEquals(c1_class, a_var.get_type())
         self.assertEquals(c2_class, b_var.get_type())
 
         mod.write(code)
         self.pycore.run_module(mod).wait_process()
         pymod = self.pycore.resource_to_pyobject(mod)
-        a_var = pymod.get_attribute('a_var').get_object()
+        a_var = pymod['a_var'].get_object()
         self.assertTrue(isinstance(a_var.get_type(), rope.base.builtins.Str))
 
     def test_textual_transformations(self):
             return to_textual.transform(
                 to_pyobject.transform(to_textual.transform(pyobject)))
         for name in ('C', 'f', 'a_var', 'a_list', 'a_str', 'a_file'):
-            var = pymod.get_attribute(name).get_object()
+            var = pymod[name].get_object()
             self.assertEquals(to_textual.transform(var), complex_to_textual(var))
         self.assertEquals(to_textual.transform(pymod), complex_to_textual(pymod))
         enumerate_func = rope.base.builtins.builtins['enumerate'].get_object()
         mod.write(code)
         self.pycore.run_module(mod).wait_process()
         pymod = self.pycore.resource_to_pyobject(mod)
-        c1_class = pymod.get_attribute('C1').get_object()
-        c2_class = pymod.get_attribute('C2').get_object()
-        a_var = pymod.get_attribute('a').get_object()
-        b_var = pymod.get_attribute('b').get_object()
+        c1_class = pymod['C1'].get_object()
+        c2_class = pymod['C2'].get_object()
+        a_var = pymod['a'].get_object()
+        b_var = pymod['b'].get_object()
         self.assertEquals(c1_class, a_var.get_type())
         self.assertEquals(c2_class, b_var.get_type())
 
         mod.write(code)
         self.pycore.run_module(mod).wait_process()
         pymod = self.pycore.resource_to_pyobject(mod)
-        c1_class = pymod.get_attribute('C1').get_object()
-        c2_class = pymod.get_attribute('C2').get_object()
-        a_var = pymod.get_attribute('a').get_object()
-        b_var = pymod.get_attribute('b').get_object()
+        c1_class = pymod['C1'].get_object()
+        c2_class = pymod['C2'].get_object()
+        a_var = pymod['a'].get_object()
+        b_var = pymod['b'].get_object()
         self.assertEquals(c1_class, a_var.get_type())
         self.assertEquals(c2_class, b_var.get_type())
 
         mod.write(code)
         self.pycore.run_module(mod).wait_process()
         pymod = self.pycore.resource_to_pyobject(mod)
-        c1_class = pymod.get_attribute('C1').get_object()
-        c2_class = pymod.get_attribute('C2').get_object()
-        a_var = pymod.get_attribute('a').get_object()
-        b_var = pymod.get_attribute('b').get_object()
+        c1_class = pymod['C1'].get_object()
+        c2_class = pymod['C2'].get_object()
+        a_var = pymod['a'].get_object()
+        b_var = pymod['b'].get_object()
         self.assertEquals(c1_class, a_var.get_type())
         self.assertEquals(c2_class, b_var.get_type())
 
         mod.write(code)
         self.pycore.run_module(mod).wait_process()
         pymod = self.pycore.resource_to_pyobject(mod)
-        c1_class = pymod.get_attribute('C1').get_object()
-        c2_class = pymod.get_attribute('C2').get_object()
-        a_var = pymod.get_attribute('a').get_object()
-        b_var = pymod.get_attribute('b').get_object()
+        c1_class = pymod['C1'].get_object()
+        c2_class = pymod['C2'].get_object()
+        a_var = pymod['a'].get_object()
+        b_var = pymod['b'].get_object()
         self.assertEquals(c1_class, a_var.get_type())
         self.assertEquals(c2_class, b_var.get_type())
 
         mod.write(code)
         self.pycore.run_module(mod).wait_process()
         pymod = self.pycore.resource_to_pyobject(mod)
-        c1_class = pymod.get_attribute('C1').get_object()
-        c2_class = pymod.get_attribute('C2').get_object()
-        a_var = pymod.get_attribute('a').get_object()
-        b_var = pymod.get_attribute('b').get_object()
+        c1_class = pymod['C1'].get_object()
+        c2_class = pymod['C2'].get_object()
+        a_var = pymod['a'].get_object()
+        b_var = pymod['b'].get_object()
         self.assertEquals(c1_class, a_var.get_type())
         self.assertEquals(c2_class, b_var.get_type())
 
         mod.write(code.replace('a_func', 'newfunc'))
         mod.write(code)
         pymod = self.pycore.resource_to_pyobject(mod)
-        self.assertNotEquals(pymod.get_attribute('a_func').get_object(),
-                             pymod.get_attribute('a_var').get_object())
+        self.assertNotEquals(pymod['a_func'].get_object(),
+                             pymod['a_var'].get_object())
 
     def test_invalidating_data_after_moving(self):
         mod2 = testutils.create_module(self.project, 'mod2')
         mod.move('newmod.py')
         pymod = self.pycore.get_module('newmod')
         pymod2 = self.pycore.resource_to_pyobject(mod2)
-        self.assertEquals(pymod2.get_attribute('C').get_object(),
-                          pymod.get_attribute('a_var').get_object())
+        self.assertEquals(pymod2['C'].get_object(),
+                          pymod['a_var'].get_object())
 
 
 class NewStaticOITest(unittest.TestCase):
         self.mod.write(code)
         self.pycore.analyze_module(self.mod)
         pymod = self.pycore.resource_to_pyobject(self.mod)
-        c_class = pymod.get_attribute('C').get_object()
-        f_scope = pymod.get_attribute('f').get_object().get_scope()
+        c_class = pymod['C'].get_object()
+        f_scope = pymod['f'].get_object().get_scope()
         p_type = f_scope.get_name('p').get_object().get_type()
         self.assertEquals(c_class, p_type)
 
         self.mod.write(code)
         self.pycore.analyze_module(self.mod)
         pymod = self.pycore.resource_to_pyobject(self.mod)
-        c_class = pymod.get_attribute('C').get_object()
-        f_scope = pymod.get_attribute('f').get_object().get_scope()
+        c_class = pymod['C'].get_object()
+        f_scope = pymod['f'].get_object().get_scope()
         p_type = f_scope.get_name('p').get_object().get_type()
         self.assertEquals(c_class, p_type)
 
         self.mod.write(code)
         self.pycore.analyze_module(self.mod)
         pymod = self.pycore.resource_to_pyobject(self.mod)
-        c_class = pymod.get_attribute('C').get_object()
-        f_scope = c_class.get_attribute('f').get_object().get_scope()
+        c_class = pymod['C'].get_object()
+        f_scope = c_class['f'].get_object().get_scope()
         p_type = f_scope.get_name('p').get_object().get_type()
         self.assertEquals(c_class, p_type)
 
                'a_var = func(C())\n'
         self.mod.write(code)
         pymod = self.pycore.resource_to_pyobject(self.mod)
-        c_class = pymod.get_attribute('C').get_object()
-        a_var = pymod.get_attribute('a_var').get_object()
+        c_class = pymod['C'].get_object()
+        a_var = pymod['a_var'].get_object()
         self.assertEquals(c_class, a_var.get_type())
 
     def test_a_function_with_different_returns(self):
                'a = a_func(C1())\nb = a_func(C2())\n'
         self.mod.write(code)
         pymod = self.pycore.resource_to_pyobject(self.mod)
-        c1_class = pymod.get_attribute('C1').get_object()
-        c2_class = pymod.get_attribute('C2').get_object()
-        a_var = pymod.get_attribute('a').get_object()
-        b_var = pymod.get_attribute('b').get_object()
+        c1_class = pymod['C1'].get_object()
+        c2_class = pymod['C2'].get_object()
+        a_var = pymod['a'].get_object()
+        b_var = pymod['b'].get_object()
         self.assertEquals(c1_class, a_var.get_type())
         self.assertEquals(c2_class, b_var.get_type())
 
                'def f(arg):\n    return C1()\na_var = f('')\n'
         self.mod.write(code)
         pymod = self.pycore.resource_to_pyobject(self.mod)
-        c1_class = pymod.get_attribute('C1').get_object()
-        a_var = pymod.get_attribute('a_var').get_object()
+        c1_class = pymod['C1'].get_object()
+        a_var = pymod['a_var'].get_object()
         self.assertEquals(c1_class, a_var.get_type())
 
         self.mod.write(code.replace('C1', 'C2'))
         pymod = self.pycore.resource_to_pyobject(self.mod)
-        c2_class = pymod.get_attribute('C2').get_object()
-        a_var = pymod.get_attribute('a_var').get_object()
+        c2_class = pymod['C2'].get_object()
+        a_var = pymod['a_var'].get_object()
         self.assertEquals(c2_class, a_var.get_type())
 
     def test_invalidating_concluded_data_in_a_function(self):
                    'class C2(object):\n    pass\n'
                    'a_var = mod1.func(C1())\n')
         pymod2 = self.pycore.resource_to_pyobject(mod2)
-        c1_class = pymod2.get_attribute('C1').get_object()
-        a_var = pymod2.get_attribute('a_var').get_object()
+        c1_class = pymod2['C1'].get_object()
+        a_var = pymod2['a_var'].get_object()
         self.assertEquals(c1_class, a_var.get_type())
 
         mod2.write(mod2.read()[:mod2.read().rfind('C1()')] + 'C2())\n')
         pymod2 = self.pycore.resource_to_pyobject(mod2)
-        c2_class = pymod2.get_attribute('C2').get_object()
-        a_var = pymod2.get_attribute('a_var').get_object()
+        c2_class = pymod2['C2'].get_object()
+        a_var = pymod2['a_var'].get_object()
         self.assertEquals(c2_class, a_var.get_type())
 
     def test_handling_generator_functions_for_strs(self):
         self.mod.write('class C(object):\n    pass\ndef f(p):\n    yield p()\n'
                        'for c in f(C):\n    a_var = c\n')
         pymod = self.pycore.resource_to_pyobject(self.mod)
-        c_class = pymod.get_attribute('C').get_object()
-        a_var = pymod.get_attribute('a_var').get_object()
+        c_class = pymod['C'].get_object()
+        a_var = pymod['a_var'].get_object()
         self.assertEquals(c_class, a_var.get_type())
 
     # TODO: Returning a generator for functions that yield unknowns
         self.mod.write('class C(object):\n    pass\ndef f():\n    yield eval("C()")\n'
                        'a_var = f()\n')
         pymod = self.pycore.resource_to_pyobject(self.mod)
-        a_var = pymod.get_attribute('a_var').get_object()
+        a_var = pymod['a_var'].get_object()
         self.assertTrue(isinstance(a_var.get_type(),
                                    rope.base.builtins.Generator))
 
         self.mod.write(code)
         self.pycore.analyze_module(self.mod)
         pymod = self.pycore.resource_to_pyobject(self.mod)
-        c_class = pymod.get_attribute('C').get_object()
-        a_var = pymod.get_attribute('a_var').get_object()
+        c_class = pymod['C'].get_object()
+        a_var = pymod['a_var'].get_object()
         self.assertEquals(c_class, a_var.get_type())
 
     def test_static_oi_for_lists_per_object_for_get_item(self):
         self.mod.write(code)
         self.pycore.analyze_module(self.mod)
         pymod = self.pycore.resource_to_pyobject(self.mod)
-        c_class = pymod.get_attribute('C').get_object()
-        a_var = pymod.get_attribute('a_var').get_object()
+        c_class = pymod['C'].get_object()
+        a_var = pymod['a_var'].get_object()
         self.assertEquals(c_class, a_var.get_type())
 
     def test_static_oi_for_lists_per_object_for_fields(self):
         self.mod.write(code)
         self.pycore.analyze_module(self.mod)
         pymod = self.pycore.resource_to_pyobject(self.mod)
-        c_class = pymod.get_attribute('C').get_object()
-        a_var = pymod.get_attribute('a_var').get_object()
+        c_class = pymod['C'].get_object()
+        a_var = pymod['a_var'].get_object()
         self.assertEquals(c_class, a_var.get_type())
 
     def test_static_oi_for_lists_per_object_for_set_item(self):
         self.mod.write(code)
         self.pycore.analyze_module(self.mod)
         pymod = self.pycore.resource_to_pyobject(self.mod)
-        c_class = pymod.get_attribute('C').get_object()
-        a_var = pymod.get_attribute('a_var').get_object()
+        c_class = pymod['C'].get_object()
+        a_var = pymod['a_var'].get_object()
         self.assertEquals(c_class, a_var.get_type())
 
     def test_static_oi_for_lists_per_object_for_extending_lists(self):
         self.mod.write(code)
         self.pycore.analyze_module(self.mod)
         pymod = self.pycore.resource_to_pyobject(self.mod)
-        c_class = pymod.get_attribute('C').get_object()
-        a_var = pymod.get_attribute('a_var').get_object()
+        c_class = pymod['C'].get_object()
+        a_var = pymod['a_var'].get_object()
         self.assertEquals(c_class, a_var.get_type())
 
     def test_static_oi_for_lists_per_object_for_iters(self):
         self.mod.write(code)
         self.pycore.analyze_module(self.mod)
         pymod = self.pycore.resource_to_pyobject(self.mod)
-        c_class = pymod.get_attribute('C').get_object()
-        a_var = pymod.get_attribute('a_var').get_object()
+        c_class = pymod['C'].get_object()
+        a_var = pymod['a_var'].get_object()
         self.assertEquals(c_class, a_var.get_type())
 
     def test_static_oi_for_dicts_depending_on_append_function(self):
         self.mod.write(code)
         self.pycore.analyze_module(self.mod)
         pymod = self.pycore.resource_to_pyobject(self.mod)
-        c1_class = pymod.get_attribute('C1').get_object()
-        c2_class = pymod.get_attribute('C2').get_object()
-        a_var = pymod.get_attribute('a').get_object()
-        b_var = pymod.get_attribute('b').get_object()
+        c1_class = pymod['C1'].get_object()
+        c2_class = pymod['C2'].get_object()
+        a_var = pymod['a'].get_object()
+        b_var = pymod['b'].get_object()
         self.assertEquals(c1_class, a_var.get_type())
         self.assertEquals(c2_class, b_var.get_type())
 
         self.mod.write(code)
         self.pycore.analyze_module(self.mod)
         pymod = self.pycore.resource_to_pyobject(self.mod)
-        c1_class = pymod.get_attribute('C1').get_object()
-        c2_class = pymod.get_attribute('C2').get_object()
-        a_var = pymod.get_attribute('a').get_object()
-        b_var = pymod.get_attribute('b').get_object()
+        c1_class = pymod['C1'].get_object()
+        c2_class = pymod['C2'].get_object()
+        a_var = pymod['a'].get_object()
+        b_var = pymod['b'].get_object()
         self.assertEquals(c1_class, a_var.get_type())
         self.assertEquals(c2_class, b_var.get_type())
 
         self.mod.write(code)
         self.pycore.analyze_module(self.mod)
         pymod = self.pycore.resource_to_pyobject(self.mod)
-        c1_class = pymod.get_attribute('C1').get_object()
-        c2_class = pymod.get_attribute('C2').get_object()
-        a_var = pymod.get_attribute('a').get_object()
-        b_var = pymod.get_attribute('b').get_object()
+        c1_class = pymod['C1'].get_object()
+        c2_class = pymod['C2'].get_object()
+        a_var = pymod['a'].get_object()
+        b_var = pymod['b'].get_object()
         self.assertEquals(c1_class, a_var.get_type())
         self.assertEquals(c2_class, b_var.get_type())
 
         self.mod.write(code)
         self.pycore.analyze_module(self.mod)
         pymod = self.pycore.resource_to_pyobject(self.mod)
-        c1_class = pymod.get_attribute('C1').get_object()
-        c2_class = pymod.get_attribute('C2').get_object()
-        a_var = pymod.get_attribute('a').get_object()
-        b_var = pymod.get_attribute('b').get_object()
+        c1_class = pymod['C1'].get_object()
+        c2_class = pymod['C2'].get_object()
+        a_var = pymod['a'].get_object()
+        b_var = pymod['b'].get_object()
         self.assertEquals(c1_class, a_var.get_type())
         self.assertEquals(c2_class, b_var.get_type())
 
         self.mod.write(code)
         self.pycore.analyze_module(self.mod)
         pymod = self.pycore.resource_to_pyobject(self.mod)
-        c_class = pymod.get_attribute('C').get_object()
-        a_var = pymod.get_attribute('a_var').get_object()
+        c_class = pymod['C'].get_object()
+        a_var = pymod['a_var'].get_object()
         self.assertEquals(c_class, a_var.get_type())
 
     def test_properties_and_calling_get_property(self):
                '    p = property(get_c1)\nc2 = C2()\na_var = c2.p\n'
         self.mod.write(code)
         pymod = self.pycore.resource_to_pyobject(self.mod)
-        c1_class = pymod.get_attribute('C1').get_object()
-        a_var = pymod.get_attribute('a_var').get_object()
+        c1_class = pymod['C1'].get_object()
+        a_var = pymod['a_var'].get_object()
         self.assertEquals(c1_class, a_var.get_type())
 
     def test_soi_on_constructors(self):
         self.mod.write(code)
         self.pycore.analyze_module(self.mod)
         pymod = self.pycore.resource_to_pyobject(self.mod)
-        c1_class = pymod.get_attribute('C1').get_object()
-        a_var = pymod.get_attribute('a_var').get_object()
+        c1_class = pymod['C1'].get_object()
+        a_var = pymod['a_var'].get_object()
         self.assertEquals(c1_class, a_var.get_type())
 
     def test_not_saving_unknown_function_returns(self):
         mod2.write('import mod\ndef f():\n    return mod.l.pop()\na_var = f()\n')
         pymod = self.pycore.resource_to_pyobject(self.mod)
         pymod2 = self.pycore.resource_to_pyobject(mod2)
-        c_class = pymod.get_attribute('C').get_object()
-        a_var = pymod2.get_attribute('a_var')
+        c_class = pymod['C'].get_object()
+        a_var = pymod2['a_var']
 
         self.pycore.analyze_module(mod2)
         self.assertNotEquals(c_class, a_var.get_object().get_type())
         self.mod.write(code)
         self.pycore.analyze_module(self.mod)
         pymod = self.pycore.resource_to_pyobject(self.mod)
-        c1_class = pymod.get_attribute('C1').get_object()
-        f_scope = pymod.get_attribute('f').get_object().get_scope()
+        c1_class = pymod['C1'].get_object()
+        f_scope = pymod['f'].get_object().get_scope()
         arg2 = f_scope.get_name('arg2').get_object()
         self.assertEquals(c1_class, arg2.get_type())
 
         mod_file.close()
         rope.base.libutils.report_change(self.project, self.mod.real_path, '')
         pymod = self.pycore.resource_to_pyobject(self.mod)
-        c_class = pymod.get_attribute('C').get_object()
-        f_scope = pymod.get_attribute('f').get_object().get_scope()
+        c_class = pymod['C'].get_object()
+        f_scope = pymod['f'].get_object().get_scope()
         p_type = f_scope.get_name('p').get_object().get_type()
         self.assertEquals(c_class, p_type)
 
         self.pycore.analyze_module(mod2)
 
         pymod2 = self.pycore.resource_to_pyobject(mod2)
-        c_class = pymod2.get_attribute('C').get_object()
+        c_class = pymod2['C'].get_object()
         pymod1 = self.pycore.resource_to_pyobject(mod1)
-        var_pyname = pymod1.get_attribute('var')
+        var_pyname = pymod1['var']
         self.assertEquals(c_class, var_pyname.get_object().get_type())
         mod2.write('import mod1\n\nmod1.l.append("")\n')
         # Either `pymod1` should be invalid or should not reference to `pymod2`
         self.mod.write(code)
         self.pycore.analyze_module(self.mod)
         pymod = self.pycore.resource_to_pyobject(self.mod)
-        a_class = pymod.get_attribute('A').get_object()
+        a_class = pymod['A'].get_object()
         f_scope = a_class.get_scope().get_scopes()[0]
         p_type = f_scope.get_name('p').get_object().get_type()
         self.assertEquals(a_class, p_type)

ropetest/builtinstest.py

     def test_simple_case(self):
         self.mod.write('l = []\n')
         pymod = self.pycore.resource_to_pyobject(self.mod)
-        self.assertTrue('append' in pymod.get_attribute('l').get_object().get_attributes())
+        self.assertTrue('append' in pymod['l'].get_object().get_attributes())
 
     def test_holding_type_information(self):
         self.mod.write('class C(object):\n    pass\nl = [C()]\na_var = l.pop()\n')
         pymod = self.pycore.resource_to_pyobject(self.mod)
-        c_class = pymod.get_attribute('C').get_object()
-        a_var = pymod.get_attribute('a_var').get_object()
+        c_class = pymod['C'].get_object()
+        a_var = pymod['a_var'].get_object()
         self.assertEquals(c_class, a_var.get_type())
 
     def test_get_items(self):
         self.mod.write('class C(object):\n    def __getitem__(self, i):\n        return C()\n'
                        'c = C()\na_var = c[0]')
         pymod = self.pycore.resource_to_pyobject(self.mod)
-        c_class = pymod.get_attribute('C').get_object()
-        a_var = pymod.get_attribute('a_var').get_object()
+        c_class = pymod['C'].get_object()
+        a_var = pymod['a_var'].get_object()
         self.assertEquals(c_class, a_var.get_type())
 
     def test_get_items_for_lists(self):
         self.mod.write('class C(object):\n    pass\nl = [C()]\na_var = l[0]\n')
         pymod = self.pycore.resource_to_pyobject(self.mod)
-        c_class = pymod.get_attribute('C').get_object()
-        a_var = pymod.get_attribute('a_var').get_object()
+        c_class = pymod['C'].get_object()
+        a_var = pymod['a_var'].get_object()
         self.assertEquals(c_class, a_var.get_type())
 
     def test_get_items_from_slices(self):
         self.mod.write('class C(object):\n    pass\nl = [C()]\na_var = l[:].pop()\n')
         pymod = self.pycore.resource_to_pyobject(self.mod)
-        c_class = pymod.get_attribute('C').get_object()
-        a_var = pymod.get_attribute('a_var').get_object()
+        c_class = pymod['C'].get_object()
+        a_var = pymod['a_var'].get_object()
         self.assertEquals(c_class, a_var.get_type())
 
     def test_simple_for_loops(self):
         self.mod.write('class C(object):\n    pass\nl = [C()]\n'
                        'for c in l:\n    a_var = c\n')
         pymod = self.pycore.resource_to_pyobject(self.mod)
-        c_class = pymod.get_attribute('C').get_object()
-        a_var = pymod.get_attribute('a_var').get_object()
+        c_class = pymod['C'].get_object()
+        a_var = pymod['a_var'].get_object()
         self.assertEquals(c_class, a_var.get_type())
 
     def test_definition_location_for_loop_variables(self):
         self.mod.write('class C(object):\n    pass\nl = [C()]\n'
                        'for c in l:\n    pass\n')
         pymod = self.pycore.resource_to_pyobject(self.mod)
-        c_var = pymod.get_attribute('c')
+        c_var = pymod['c']
         self.assertEquals((pymod, 4), c_var.get_definition_location())
 
     def test_simple_case_for_dicts(self):
         self.mod.write('d = {}\n')
         pymod = self.pycore.resource_to_pyobject(self.mod)
-        self.assertTrue('get' in pymod.get_attribute('d').get_object().get_attributes())
+        self.assertTrue('get' in pymod['d'].get_object().get_attributes())
 
     def test_get_item_for_dicts(self):
         self.mod.write('class C(object):\n    pass\nd = {1: C()}\na_var = d[1]\n')
         pymod = self.pycore.resource_to_pyobject(self.mod)
-        c_class = pymod.get_attribute('C').get_object()
-        a_var = pymod.get_attribute('a_var').get_object()
+        c_class = pymod['C'].get_object()
+        a_var = pymod['a_var'].get_object()
         self.assertEquals(c_class, a_var.get_type())
 
     def test_popping_dicts(self):
         self.mod.write('class C(object):\n    pass\nd = {1: C()}\na_var = d.pop(1)\n')
         pymod = self.pycore.resource_to_pyobject(self.mod)
-        c_class = pymod.get_attribute('C').get_object()
-        a_var = pymod.get_attribute('a_var').get_object()
+        c_class = pymod['C'].get_object()
+        a_var = pymod['a_var'].get_object()
         self.assertEquals(c_class, a_var.get_type())
 
     def test_getting_keys_from_dicts(self):
         self.mod.write('class C1(object):\n    pass\nclass C2(object):\n    pass\n'
                        'd = {C1(): C2()}\nfor c in d.keys():\n    a_var = c\n')
         pymod = self.pycore.resource_to_pyobject(self.mod)
-        c_class = pymod.get_attribute('C1').get_object()
-        a_var = pymod.get_attribute('a_var').get_object()
+        c_class = pymod['C1'].get_object()
+        a_var = pymod['a_var'].get_object()
         self.assertEquals(c_class, a_var.get_type())
 
     def test_getting_values_from_dicts(self):
         self.mod.write('class C1(object):\n    pass\nclass C2(object):\n    pass\n'
                        'd = {C1(): C2()}\nfor c in d.values():\n    a_var = c\n')
         pymod = self.pycore.resource_to_pyobject(self.mod)
-        c_class = pymod.get_attribute('C2').get_object()
-        a_var = pymod.get_attribute('a_var').get_object()
+        c_class = pymod['C2'].get_object()
+        a_var = pymod['a_var'].get_object()
         self.assertEquals(c_class, a_var.get_type())
 
     def test_getting_iterkeys_from_dicts(self):
         self.mod.write('class C1(object):\n    pass\nclass C2(object):\n    pass\n'
                        'd = {C1(): C2()}\nfor c in d.keys():\n    a_var = c\n')
         pymod = self.pycore.resource_to_pyobject(self.mod)
-        c_class = pymod.get_attribute('C1').get_object()
-        a_var = pymod.get_attribute('a_var').get_object()
+        c_class = pymod['C1'].get_object()
+        a_var = pymod['a_var'].get_object()
         self.assertEquals(c_class, a_var.get_type())
 
     def test_getting_itervalues_from_dicts(self):
         self.mod.write('class C1(object):\n    pass\nclass C2(object):\n    pass\n'
                        'd = {C1(): C2()}\nfor c in d.values():\n    a_var = c\n')
         pymod = self.pycore.resource_to_pyobject(self.mod)
-        c_class = pymod.get_attribute('C2').get_object()
-        a_var = pymod.get_attribute('a_var').get_object()
+        c_class = pymod['C2'].get_object()
+        a_var = pymod['a_var'].get_object()
         self.assertEquals(c_class, a_var.get_type())
 
     def test_using_copy_for_dicts(self):
         self.mod.write('class C1(object):\n    pass\nclass C2(object):\n    pass\n'
                        'd = {C1(): C2()}\nfor c in d.copy():\n    a_var = c\n')
         pymod = self.pycore.resource_to_pyobject(self.mod)
-        c_class = pymod.get_attribute('C1').get_object()
-        a_var = pymod.get_attribute('a_var').get_object()
+        c_class = pymod['C1'].get_object()
+        a_var = pymod['a_var'].get_object()
         self.assertEquals(c_class, a_var.get_type())
 
     def test_tuple_assignments_for_items(self):
         self.mod.write('class C1(object):\n    pass\nclass C2(object):\n    pass\n'
                        'd = {C1(): C2()}\nkey, value = d.items()[0]\n')
         pymod = self.pycore.resource_to_pyobject(self.mod)
-        c1_class = pymod.get_attribute('C1').get_object()
-        c2_class = pymod.get_attribute('C2').get_object()
-        key = pymod.get_attribute('key').get_object()
-        value = pymod.get_attribute('value').get_object()
+        c1_class = pymod['C1'].get_object()
+        c2_class = pymod['C2'].get_object()
+        key = pymod['key'].get_object()
+        value = pymod['value'].get_object()
         self.assertEquals(c1_class, key.get_type())
         self.assertEquals(c2_class, value.get_type())
 
     def test_tuple_assignment_for_lists(self):
         self.mod.write('class C(object):\n    pass\nl = [C(), C()]\na, b = l\n')
         pymod = self.pycore.resource_to_pyobject(self.mod)
-        c_class = pymod.get_attribute('C').get_object()
-        a_var = pymod.get_attribute('a').get_object()
-        b_var = pymod.get_attribute('b').get_object()
+        c_class = pymod['C'].get_object()
+        a_var = pymod['a'].get_object()
+        b_var = pymod['b'].get_object()
         self.assertEquals(c_class, a_var.get_type())
         self.assertEquals(c_class, b_var.get_type())
 
         self.mod.write('class C1(object):\n    pass\nclass C2(object):\n    pass\n'
                        'd = {C1(): C2()}\nfor x, y in d.items():\n    a = x;\n    b = y\n')
         pymod = self.pycore.resource_to_pyobject(self.mod)
-        c1_class = pymod.get_attribute('C1').get_object()
-        c2_class = pymod.get_attribute('C2').get_object()
-        a_var = pymod.get_attribute('a').get_object()
-        b_var = pymod.get_attribute('b').get_object()
+        c1_class = pymod['C1'].get_object()
+        c2_class = pymod['C2'].get_object()
+        a_var = pymod['a'].get_object()
+        b_var = pymod['b'].get_object()
         self.assertEquals(c1_class, a_var.get_type())
         self.assertEquals(c2_class, b_var.get_type())
 
         self.mod.write('class C1(object):\n    pass\nclass C2(object):\n    pass\n'
                        'a, b = C1(), C2()\n')
         pymod = self.pycore.resource_to_pyobject(self.mod)
-        c1_class = pymod.get_attribute('C1').get_object()
-        c2_class = pymod.get_attribute('C2').get_object()
-        a_var = pymod.get_attribute('a').get_object()
-        b_var = pymod.get_attribute('b').get_object()
+        c1_class = pymod['C1'].get_object()
+        c2_class = pymod['C2'].get_object()
+        a_var = pymod['a'].get_object()
+        b_var = pymod['b'].get_object()
         self.assertEquals(c1_class, a_var.get_type())
         self.assertEquals(c2_class, b_var.get_type())
 
     def test_overriding_builtin_names(self):
         self.mod.write('class C(object):\n    pass\nlist = C\n')
         pymod = self.pycore.resource_to_pyobject(self.mod)
-        c_class = pymod.get_attribute('C').get_object()
-        list_var = pymod.get_attribute('list').get_object()
+        c_class = pymod['C'].get_object()
+        list_var = pymod['list'].get_object()
         self.assertEquals(c_class, list_var)
 
     def test_simple_builtin_scope_test(self):
         self.mod.write('l = list()\n')
         pymod = self.pycore.resource_to_pyobject(self.mod)
-        self.assertTrue('append' in pymod.get_attribute('l').get_object().get_attributes())
+        self.assertTrue('append' in pymod['l'].get_object().get_attributes())
 
     def test_simple_sets(self):
         self.mod.write('s = set()\n')
         pymod = self.pycore.resource_to_pyobject(self.mod)
-        self.assertTrue('add' in pymod.get_attribute('s').get_object().get_attributes())
+        self.assertTrue('add' in pymod['s'].get_object().get_attributes())
 
     def test_making_lists_using_the_passed_argument_to_init(self):
         self.mod.write('class C(object):\n    pass\nl1 = [C()]\n'
                        'l2 = list(l1)\na_var = l2.pop()')
         pymod = self.pycore.resource_to_pyobject(self.mod)
-        c_class = pymod.get_attribute('C').get_object()
-        a_var = pymod.get_attribute('a_var').get_object()
+        c_class = pymod['C'].get_object()
+        a_var = pymod['a_var'].get_object()
         self.assertEquals(c_class, a_var.get_type())
 
     def test_making_tuples_using_the_passed_argument_to_init(self):
         self.mod.write('class C(object):\n    pass\nl1 = [C()]\n'
                        'l2 = tuple(l1)\na_var = l2[0]')
         pymod = self.pycore.resource_to_pyobject(self.mod)
-        c_class = pymod.get_attribute('C').get_object()
-        a_var = pymod.get_attribute('a_var').get_object()
+        c_class = pymod['C'].get_object()
+        a_var = pymod['a_var'].get_object()
         self.assertEquals(c_class, a_var.get_type())
 
     def test_making_sets_using_the_passed_argument_to_init(self):
         self.mod.write('class C(object):\n    pass\nl1 = [C()]\n'
                        'l2 = set(l1)\na_var = l2.pop()')
         pymod = self.pycore.resource_to_pyobject(self.mod)
-        c_class = pymod.get_attribute('C').get_object()
-        a_var = pymod.get_attribute('a_var').get_object()
+        c_class = pymod['C'].get_object()
+        a_var = pymod['a_var'].get_object()
         self.assertEquals(c_class, a_var.get_type())
 
     def test_making_dicts_using_the_passed_argument_to_init(self):
                        'l1 = [(C1(), C2())]\n'
                        'l2 = dict(l1)\na, b = l2.items()[0]')
         pymod = self.pycore.resource_to_pyobject(self.mod)
-        c1_class = pymod.get_attribute('C1').get_object()
-        c2_class = pymod.get_attribute('C2').get_object()
-        a_var = pymod.get_attribute('a').get_object()
-        b_var = pymod.get_attribute('b').get_object()
+        c1_class = pymod['C1'].get_object()
+        c2_class = pymod['C2'].get_object()
+        a_var = pymod['a'].get_object()
+        b_var = pymod['b'].get_object()
         self.assertEquals(c1_class, a_var.get_type())
         self.assertEquals(c2_class, b_var.get_type())
 
     def test_range_builtin_function(self):
         self.mod.write('l = range(1)\n')
         pymod = self.pycore.resource_to_pyobject(self.mod)
-        l = pymod.get_attribute('l').get_object()
+        l = pymod['l'].get_object()
         self.assertTrue('append' in l.get_attributes())
 
     def test_reversed_builtin_function(self):
         self.mod.write('class C(object):\n    pass\nl = [C()]\n'
                        'for x in reversed(l):\n    a_var = x\n')
         pymod = self.pycore.resource_to_pyobject(self.mod)
-        c_class = pymod.get_attribute('C').get_object()
-        a_var = pymod.get_attribute('a_var').get_object()
+        c_class = pymod['C'].get_object()
+        a_var = pymod['a_var'].get_object()
         self.assertEquals(c_class, a_var.get_type())
 
     def test_sorted_builtin_function(self):
         self.mod.write('class C(object):\n    pass\nl = [C()]\n'
                        'a_var = sorted(l).pop()\n')
         pymod = self.pycore.resource_to_pyobject(self.mod)
-        c_class = pymod.get_attribute('C').get_object()
-        a_var = pymod.get_attribute('a_var').get_object()
+        c_class = pymod['C'].get_object()
+        a_var = pymod['a_var'].get_object()
         self.assertEquals(c_class, a_var.get_type())
 
     def test_super_builtin_function(self):
             'class B(A):\n    def b_f(self):\n        return super(B, self).a_f()\n'
             'a_var = B.b_f()\n')
         pymod = self.pycore.resource_to_pyobject(self.mod)
-        c_class = pymod.get_attribute('C').get_object()
-        a_var = pymod.get_attribute('a_var').get_object()
+        c_class = pymod['C'].get_object()
+        a_var = pymod['a_var'].get_object()
         self.assertEquals(c_class, a_var.get_type())
 
     def test_file_builtin_type(self):
         self.mod.write('for line in open("file.txt"):\n    a_var = line\n')
         pymod = self.pycore.resource_to_pyobject(self.mod)
-        a_var = pymod.get_attribute('a_var').get_object()
+        a_var = pymod['a_var'].get_object()
         self.assertTrue(isinstance(a_var.get_type(), builtins.Str))
 
     def test_property_builtin_type(self):
         self.mod.write('p = property()\n')
         pymod = self.pycore.resource_to_pyobject(self.mod)
-        p_var = pymod.get_attribute('p').get_object()
+        p_var = pymod['p'].get_object()
         self.assertTrue('fget' in p_var.get_attributes())
 
     def test_lambda_functions(self):
         self.mod.write('l = lambda: 1\n')
         pymod = self.pycore.resource_to_pyobject(self.mod)
-        l_var = pymod.get_attribute('l').get_object()
+        l_var = pymod['l'].get_object()
         self.assertEquals(pyobjects.get_base_type('Function'),
                           l_var.get_type())
 
     def test_lambdas_that_return_unknown(self):
         self.mod.write('a_var = (lambda: None)()\n')
         pymod = self.pycore.resource_to_pyobject(self.mod)
-        a_var = pymod.get_attribute('a_var').get_object()
+        a_var = pymod['a_var'].get_object()
         self.assertTrue(a_var is not None)
 
     def test_builtin_zip_function(self):
             'c1_list = [C1()]\nc2_list = [C2()]\n'
             'a, b = zip(c1_list, c2_list)[0]')
         pymod = self.pycore.resource_to_pyobject(self.mod)
-        c1_class = pymod.get_attribute('C1').get_object()
-        c2_class = pymod.get_attribute('C2').get_object()
-        a_var = pymod.get_attribute('a').get_object()
-        b_var = pymod.get_attribute('b').get_object()
+        c1_class = pymod['C1'].get_object()
+        c2_class = pymod['C2'].get_object()
+        a_var = pymod['a'].get_object()
+        b_var = pymod['b'].get_object()
         self.assertEquals(c1_class, a_var.get_type())
         self.assertEquals(c2_class, b_var.get_type())
 
             'c1_list = [C1()]\nc2_list = [C2()]\n'
             'a, b, c = zip(c1_list, c2_list, c1_list)[0]')
         pymod = self.pycore.resource_to_pyobject(self.mod)
-        c1_class = pymod.get_attribute('C1').get_object()
-        c2_class = pymod.get_attribute('C2').get_object()
-        a_var = pymod.get_attribute('a').get_object()
-        b_var = pymod.get_attribute('b').get_object()
-        c_var = pymod.get_attribute('c').get_object()
+        c1_class = pymod['C1'].get_object()
+        c2_class = pymod['C2'].get_object()
+        a_var = pymod['a'].get_object()
+        b_var = pymod['b'].get_object()
+        c_var = pymod['c'].get_object()
         self.assertEquals(c1_class, a_var.get_type())
         self.assertEquals(c2_class, b_var.get_type())
         self.assertEquals(c1_class, c_var.get_type())
             'class C1(object):\n    pass\nc1_list = [C1()]\n'
             'a, b = zip(c1_list, 1)[0]')
         pymod = self.pycore.resource_to_pyobject(self.mod)
-        c1_class = pymod.get_attribute('C1').get_object()
-        a_var = pymod.get_attribute('a').get_object()
-        b_var = pymod.get_attribute('b').get_object()
+        c1_class = pymod['C1'].get_object()
+        a_var = pymod['a'].get_object()
+        b_var = pymod['b'].get_object()
         self.assertEquals(c1_class, a_var.get_type())
 
     def test_enumerate_builtin_function(self):
         self.mod.write('class C(object):\n    pass\nl = [C()]\n'
                        'for i, x in enumerate(l):\n    a_var = x\n')
         pymod = self.pycore.resource_to_pyobject(self.mod)
-        c_class = pymod.get_attribute('C').get_object()
-        a_var = pymod.get_attribute('a_var').get_object()
+        c_class = pymod['C'].get_object()
+        a_var = pymod['a_var'].get_object()
         self.assertEquals(c_class, a_var.get_type())
 
     def test_builtin_class_get_name(self):
     def test_star_args_and_double_star_args(self):
         self.mod.write('def func(p, *args, **kwds):\n    pass\n')
         pymod = self.pycore.resource_to_pyobject(self.mod)
-        func_scope = pymod.get_attribute('func').get_object().get_scope()
+        func_scope = pymod['func'].get_object().get_scope()
         args = func_scope.get_name('args').get_object()
         kwds = func_scope.get_name('kwds').get_object()
         self.assertTrue(isinstance(args.get_type(), builtins.List))
     def test_simple_list_comprehension_test(self):
         self.mod.write('a_var = [i for i in range(10)]\n')
         pymod = self.pycore.resource_to_pyobject(self.mod)
-        a_var = pymod.get_attribute('a_var').get_object()
+        a_var = pymod['a_var'].get_object()
         self.assertTrue(isinstance(a_var.get_type(), builtins.List))
 
     def test_simple_list_generator_expression(self):
         self.mod.write('a_var = (i for i in range(10))\n')
         pymod = self.pycore.resource_to_pyobject(self.mod)
-        a_var = pymod.get_attribute('a_var').get_object()
+        a_var = pymod['a_var'].get_object()
         self.assertTrue(isinstance(a_var.get_type(), builtins.Iterator))
 
     def test_iter_builtin_function(self):
         self.mod.write('class C(object):\n    pass\nl = [C()]\n'
                        'for c in iter(l):\n    a_var = c\n')
         pymod = self.pycore.resource_to_pyobject(self.mod)
-        c_class = pymod.get_attribute('C').get_object()
-        a_var = pymod.get_attribute('a_var').get_object()
+        c_class = pymod['C'].get_object()
+        a_var = pymod['a_var'].get_object()
         self.assertEquals(c_class, a_var.get_type())
 
     def test_simple_int_type(self):
         self.mod.write('l = 1\n')
         pymod = self.pycore.resource_to_pyobject(self.mod)
         self.assertEquals(builtins.builtins['int'].get_object(),
-                          pymod.get_attribute('l').get_object().get_type())
+                          pymod['l'].get_object().get_type())
 
     def test_simple_float_type(self):
         self.mod.write('l = 1.0\n')
         pymod = self.pycore.resource_to_pyobject(self.mod)
         self.assertEquals(builtins.builtins['float'].get_object(),
-                          pymod.get_attribute('l').get_object().get_type())
+                          pymod['l'].get_object().get_type())
 
     def test_simple_float_type2(self):
         self.mod.write('l = 1e1\n')
         pymod = self.pycore.resource_to_pyobject(self.mod)
         self.assertEquals(builtins.builtins['float'].get_object(),
-                          pymod.get_attribute('l').get_object().get_type())
+                          pymod['l'].get_object().get_type())
 
     def test_simple_complex_type(self):
         self.mod.write('l = 1.0j\n')
         pymod = self.pycore.resource_to_pyobject(self.mod)
         self.assertEquals(builtins.builtins['complex'].get_object(),
-                          pymod.get_attribute('l').get_object().get_type())
+                          pymod['l'].get_object().get_type())
 
     def test_handling_unaryop_on_ints(self):
         self.mod.write('l = -(1)\n')
         pymod = self.pycore.resource_to_pyobject(self.mod)
         self.assertEquals(builtins.builtins['int'].get_object(),
-                          pymod.get_attribute('l').get_object().get_type())
+                          pymod['l'].get_object().get_type())
 
     def test_handling_binop_on_ints(self):
         self.mod.write('l = 1 + 1\n')
         pymod = self.pycore.resource_to_pyobject(self.mod)
         self.assertEquals(builtins.builtins['int'].get_object(),
-                          pymod.get_attribute('l').get_object().get_type())
+                          pymod['l'].get_object().get_type())
 
     def test_handling_compares(self):
         self.mod.write('l = 1 == 1\n')
         pymod = self.pycore.resource_to_pyobject(self.mod)
         self.assertEquals(builtins.builtins['bool'].get_object(),
-                          pymod.get_attribute('l').get_object().get_type())
+                          pymod['l'].get_object().get_type())
 
     def test_handling_boolops(self):
         self.mod.write('l = 1 and 2\n')
         pymod = self.pycore.resource_to_pyobject(self.mod)
         self.assertEquals(builtins.builtins['int'].get_object(),
-                          pymod.get_attribute('l').get_object().get_type())
+                          pymod['l'].get_object().get_type())
 
 
 if __name__ == '__main__':

ropetest/codeanalyzetest.py

         scope = self.pycore.get_string_scope(code)
         name_finder = rope.base.evaluate.ScopeNameFinder(scope.pyobject)
         a_var_pyname = scope.get_name('C').\
-                       get_object().get_attribute('a_var')
+                               get_object()['a_var']
         result = name_finder.get_pyname_at(len(code) - 12)
         self.assertEquals(a_var_pyname, result)
 
         scope = self.pycore.get_string_scope(code)
         name_finder = rope.base.evaluate.ScopeNameFinder(scope.pyobject)
         a_var_pyname = scope.get_name('C').\
-                       get_object().get_attribute('a_var')
+                               get_object()['a_var']
         result = name_finder.get_pyname_at(len(code) - 12)
         self.assertEquals(a_var_pyname, result)
 
         scope = self.pycore.get_string_scope(code)
         name_finder = rope.base.evaluate.ScopeNameFinder(scope.pyobject)
         a_method_pyname = scope.get_name('C').\
-                          get_object().get_attribute('a_method')
+                                  get_object()['a_method']
         result = name_finder.get_pyname_at(code.index('a_method') + 2)
         self.assertEquals(a_method_pyname, result)
 
         code = 'class C(object):\n    class CC(object):\n        pass\n'
         scope = self.pycore.get_string_scope(code)
         name_finder = rope.base.evaluate.ScopeNameFinder(scope.pyobject)
-        a_class_pyname = scope.get_name('C').get_object().get_attribute('CC')
+        a_class_pyname = scope.get_name('C').get_object()['CC']
         result = name_finder.get_pyname_at(code.index('CC') + 2)
         self.assertEquals(a_class_pyname, result)
 
         scope = self.pycore.get_string_scope(code)
         name_finder = rope.base.evaluate.ScopeNameFinder(scope.pyobject)
         mod_pyobject = self.pycore.resource_to_pyobject(mod1)
-        afunc = mod_pyobject.get_attribute('afunc')
+        afunc = mod_pyobject['afunc']
         found_pyname = name_finder.get_pyname_at(code.index('afunc') + 1)
         self.assertEquals(afunc.get_object(), found_pyname.get_object())
 
         pymod = self.pycore.get_string_module(code)
         name_finder = rope.base.evaluate.ScopeNameFinder(pymod)
         pyname = name_finder.get_pyname_at(code.rindex('var'))
-        self.assertEquals(pymod.get_attribute('var'), pyname)
+        self.assertEquals(pymod['var'], pyname)
 
     def test_one_liners_with_line_breaks(self):
         code = 'var = 1\ndef f(\n): var = 2\nprint var\n'
         pymod = self.pycore.get_string_module(code)
         name_finder = rope.base.evaluate.ScopeNameFinder(pymod)
         pyname = name_finder.get_pyname_at(code.rindex('var'))
-        self.assertEquals(pymod.get_attribute('var'), pyname)
+        self.assertEquals(pymod['var'], pyname)
 
 
 class LogicalLineFinderTest(unittest.TestCase):

ropetest/objectinfertest.py

         scope = self.pycore.get_string_scope(code)
         sample_class = scope.get_name('Sample').get_object()
         another_class = scope.get_name('Another').get_object()
-        a_var = another_class.get_attribute('a_method').\
+        a_var = another_class['a_method'].\
                 get_object().get_scope().get_name('a_var').get_object()
         self.assertEquals(sample_class, a_var.get_type())
 
         scope = self.pycore.get_string_scope(code)
         sample_class = scope.get_name('Sample').get_object()
         another_class = scope.get_name('Another').get_object()
-        a_var = another_class.get_attribute('a_var').get_object()
+        a_var = another_class['a_var'].get_object()
         self.assertEquals(sample_class, a_var.get_type())
 
     def test_simple_type_inferencing_for_in_class_assignments(self):
                                              'class Another(object):\n    an_attr = Sample()\n')
         sample_class = scope.get_name('Sample').get_object()
         another_class = scope.get_name('Another').get_object()
-        an_attr = another_class.get_attribute('an_attr').get_object()
+        an_attr = another_class['an_attr'].get_object()
         self.assertEquals(sample_class, an_attr.get_type())
 
     def test_simple_type_inferencing_for_chained_assignments(self):
               '    def set(self):\n        self.a_var = Sample()\n'
         scope = self.pycore.get_string_scope(src)
         sample_class = scope.get_name('Sample').get_object()
-        a_var = sample_class.get_attribute('a_var').get_object()
+        a_var = sample_class['a_var'].get_object()
         self.assertEquals(sample_class, a_var.get_type())
 
     def test_getting_property_attributes(self):
               'class B(object):\n    p = property(f)\n' \
               'a_var = B().p\n'
         pymod = self.pycore.get_string_module(src)
-        a_class = pymod.get_attribute('A').get_object()
-        a_var = pymod.get_attribute('a_var').get_object()
+        a_class = pymod['A'].get_object()
+        a_var = pymod['a_var'].get_object()
         self.assertEquals(a_class, a_var.get_type())
 
     def test_getting_property_attributes_with_method_getters(self):
               '    p = property(p_get)\n' \
               'a_var = B().p\n'
         pymod = self.pycore.get_string_module(src)
-        a_class = pymod.get_attribute('A').get_object()
-        a_var = pymod.get_attribute('a_var').get_object()
+        a_class = pymod['A'].get_object()
+        a_var = pymod['a_var'].get_object()
         self.assertEquals(a_class, a_var.get_type())
 
     def test_lambda_functions(self):
         mod = self.pycore.get_string_module(
             'class C(object):\n    pass\n'
             'l = lambda: C()\na_var = l()')
-        c_class = mod.get_attribute('C').get_object()
-        a_var = mod.get_attribute('a_var').get_object()
+        c_class = mod['C'].get_object()
+        a_var = mod['a_var'].get_object()
         self.assertEquals(c_class, a_var.get_type())
 
     def test_mixing_subscript_with_tuple_assigns(self):
         mod = self.pycore.get_string_module(
             'class C(object):\n    attr = 0\n'
             'd = {}\nd[0], b = (0, C())\n')
-        c_class = mod.get_attribute('C').get_object()
-        a_var = mod.get_attribute('b').get_object()
+        c_class = mod['C'].get_object()
+        a_var = mod['b'].get_object()
         self.assertEquals(c_class, a_var.get_type())
 
     def test_mixing_ass_attr_with_tuple_assignment(self):
         mod = self.pycore.get_string_module(
             'class C(object):\n    attr = 0\n'
             'c = C()\nc.attr, b = (0, C())\n')
-        c_class = mod.get_attribute('C').get_object()
-        a_var = mod.get_attribute('b').get_object()
+        c_class = mod['C'].get_object()
+        a_var = mod['b'].get_object()
         self.assertEquals(c_class, a_var.get_type())
 
     def test_mixing_slice_with_tuple_assigns(self):
         mod = self.pycore.get_string_module(
             'class C(object):\n    attr = 0\n'
             'd = [None] * 3\nd[0:2], b = ((0,), C())\n')
-        c_class = mod.get_attribute('C').get_object()
-        a_var = mod.get_attribute('b').get_object()
+        c_class = mod['C'].get_object()
+        a_var = mod['b'].get_object()
         self.assertEquals(c_class, a_var.get_type())
 
     def test_nested_tuple_assignments(self):
         mod = self.pycore.get_string_module(
             'class C1(object):\n    pass\nclass C2(object):\n    pass\n'
             'a, (b, c) = (C1(), (C2(), C1()))\n')
-        c1_class = mod.get_attribute('C1').get_object()
-        c2_class = mod.get_attribute('C2').get_object()
-        a_var = mod.get_attribute('a').get_object()
-        b_var = mod.get_attribute('b').get_object()
-        c_var = mod.get_attribute('c').get_object()
+        c1_class = mod['C1'].get_object()
+        c2_class = mod['C2'].get_object()
+        a_var = mod['a'].get_object()
+        b_var = mod['b'].get_object()
+        c_var = mod['c'].get_object()
         self.assertEquals(c1_class, a_var.get_type())
         self.assertEquals(c2_class, b_var.get_type())
         self.assertEquals(c1_class, c_var.get_type())
         mod = self.pycore.get_string_module(
             'class C(object):\n    pass\ndef f():\n    yield C()\n'
             'for c in f():\n    a_var = c\n')
-        c_class = mod.get_attribute('C').get_object()
-        a_var = mod.get_attribute('a_var').get_object()
+        c_class = mod['C'].get_object()
+        a_var = mod['a_var'].get_object()
         self.assertEquals(c_class, a_var.get_type())
 
     def test_handling_generator_functions_for_strs(self):
         mod.write('def f():\n    yield ""\n'
                   'for s in f():\n    a_var = s\n')
         pymod = self.pycore.resource_to_pyobject(mod)
-        a_var = pymod.get_attribute('a_var').get_object()
+        a_var = pymod['a_var'].get_object()
         self.assertTrue(isinstance(a_var.get_type(), rope.base.builtins.Str))
 
     def test_considering_nones_to_be_unknowns(self):
         mod = self.pycore.get_string_module(
             'class C(object):\n    pass\n'
             'a_var = None\na_var = C()\na_var = None\n')
-        c_class = mod.get_attribute('C').get_object()
-        a_var = mod.get_attribute('a_var').get_object()
+        c_class = mod['C'].get_object()
+        a_var = mod['a_var'].get_object()
         self.assertEquals(c_class, a_var.get_type())
 
     def test_basic_list_comprehensions(self):
         mod = self.pycore.get_string_module(
             'class C(object):\n    pass\n'
             'l = [C() for i in range(1)]\na_var = l[0]\n')
-        c_class = mod.get_attribute('C').get_object()
-        a_var = mod.get_attribute('a_var').get_object()
+        c_class = mod['C'].get_object()
+        a_var = mod['a_var'].get_object()
         self.assertEquals(c_class, a_var.get_type())
 
     def test_basic_generator_expressions(self):
         mod = self.pycore.get_string_module(
             'class C(object):\n    pass\n'
             'l = (C() for i in range(1))\na_var = list(l)[0]\n')
-        c_class = mod.get_attribute('C').get_object()
-        a_var = mod.get_attribute('a_var').get_object()
+        c_class = mod['C'].get_object()
+        a_var = mod['a_var'].get_object()
         self.assertEquals(c_class, a_var.get_type())
 
     def test_list_comprehensions_and_loop_var(self):
             'class C(object):\n    pass\n'
             'c_objects = [C(), C()]\n'
             'l = [c for c in c_objects]\na_var = l[0]\n')
-        c_class = mod.get_attribute('C').get_object()
-        a_var = mod.get_attribute('a_var').get_object()
+        c_class = mod['C'].get_object()
+        a_var = mod['a_var'].get_object()
         self.assertEquals(c_class, a_var.get_type())
 
     def test_list_comprehensions_and_multiple_loop_var(self):
             'class C1(object):\n    pass\nclass C2(object):\n    pass\n'
             'l = [(c1, c2) for c1 in [C1()] for c2 in [C2()]]\n'
             'a, b = l[0]\n')
-        c1_class = mod.get_attribute('C1').get_object()
-        c2_class = mod.get_attribute('C2').get_object()
-        a_var = mod.get_attribute('a').get_object()
-        b_var = mod.get_attribute('b').get_object()
+        c1_class = mod['C1'].get_object()
+        c2_class = mod['C2'].get_object()
+        a_var = mod['a'].get_object()
+        b_var = mod['b'].get_object()
         self.assertEquals(c1_class, a_var.get_type())
         self.assertEquals(c2_class, b_var.get_type())
 
             'class C1(object):\n    pass\nclass C2(object):\n    pass\n'
             'l = [(c1, c2) for c1, c2 in [(C1(), C2())]]\n'
             'a, b = l[0]\n')
-        c1_class = mod.get_attribute('C1').get_object()
-        c2_class = mod.get_attribute('C2').get_object()
-        a_var = mod.get_attribute('a').get_object()
-        b_var = mod.get_attribute('b').get_object()
+        c1_class = mod['C1'].get_object()
+        c2_class = mod['C2'].get_object()
+        a_var = mod['a'].get_object()
+        b_var = mod['b'].get_object()
         self.assertEquals(c1_class, a_var.get_type())
         self.assertEquals(c2_class, b_var.get_type())
 

ropetest/pycoretest.py

         package = self.pycore.get_module('pkg')
         self.assertEquals(get_base_type('Module'), package.get_type())
         self.assertEquals(1, len(package.get_attributes()))
-        module = package.get_attribute('mod').get_object()
+        module = package['mod'].get_object()
         self.assertEquals(get_base_type('Module'), module.get_type())
 
     def test_package(self):
         mod = testutils.create_module(self.project, 'mod')
         mod.write('class SampleClass(object):\n    pass\n')
         mod_element = self.pycore.get_module('mod')
-        result = mod_element.get_attribute('SampleClass').get_object()
+        result = mod_element['SampleClass'].get_object()
         self.assertEquals(get_base_type('Type'), result.get_type())
 
     def test_simple_function(self):
         mod = testutils.create_module(self.project, 'mod')
         mod.write('def sample_function():\n    pass\n')
         mod_element = self.pycore.get_module('mod')
-        result = mod_element.get_attribute('sample_function').get_object()
+        result = mod_element['sample_function'].get_object()
         self.assertEquals(get_base_type('Function'), result.get_type())
 
     def test_class_methods(self):
         mod = testutils.create_module(self.project, 'mod')
         mod.write('class SampleClass(object):\n    def sample_method(self):\n        pass\n')
         mod_element = self.pycore.get_module('mod')
-        sample_class = mod_element.get_attribute('SampleClass').get_object()
+        sample_class = mod_element['SampleClass'].get_object()
         self.assertEquals(1, len(sample_class.get_attributes()))
-        method = sample_class.get_attribute('sample_method').get_object()
+        method = sample_class['sample_method'].get_object()
         self.assertEquals(get_base_type('Function'), method.get_type())
 
     def test_global_variables(self):
         mod = testutils.create_module(self.project, 'mod')
         mod.write('var = 10')
         mod_element = self.pycore.get_module('mod')
-        result = mod_element.get_attribute('var')
+        result = mod_element['var']
 
     def test_class_variables(self):
         mod = testutils.create_module(self.project, 'mod')
         mod.write('class SampleClass(object):\n    var = 10\n')
         mod_element = self.pycore.get_module('mod')
-        sample_class = mod_element.get_attribute('SampleClass').get_object()
-        var = sample_class.get_attribute('var')
+        sample_class = mod_element['SampleClass'].get_object()
+        var = sample_class['var']
 
     def test_class_attributes_set_in_init(self):
         mod = testutils.create_module(self.project, 'mod')
         mod.write('class SampleClass(object):\n    def __init__(self):\n        self.var = 20\n')
         mod_element = self.pycore.get_module('mod')
-        sample_class = mod_element.get_attribute('SampleClass').get_object()
-        var = sample_class.get_attribute('var')
+        sample_class = mod_element['SampleClass'].get_object()
+        var = sample_class['var']
 
     def test_classes_inside_other_classes(self):
         mod = testutils.create_module(self.project, 'mod')
         mod.write('class SampleClass(object):\n    class InnerClass(object):\n        pass\n\n')
         mod_element = self.pycore.get_module('mod')
-        sample_class = mod_element.get_attribute('SampleClass').get_object()
-        var = sample_class.get_attribute('InnerClass').get_object()
+        sample_class = mod_element['SampleClass'].get_object()
+        var = sample_class['InnerClass'].get_object()
         self.assertEquals(get_base_type('Type'), var.get_type())
 
     @testutils.assert_raises(exceptions.ModuleNotFoundError)
         mod = testutils.create_module(self.project, 'mod2')
         mod.write('import mod1\n')
         module = self.pycore.get_module('mod2')
-        imported_sys = module.get_attribute('mod1').get_object()
+        imported_sys = module['mod1'].get_object()
         self.assertEquals(get_base_type('Module'), imported_sys.get_type())
 
     def test_imported_as_names(self):
         mod = testutils.create_module(self.project, 'mod2')
         mod.write('import mod1 as my_import\n')
         module = self.pycore.get_module('mod2')
-        imported_mod = module.get_attribute('my_import').get_object()
+        imported_mod = module['my_import'].get_object()
         self.assertEquals(get_base_type('Module'), imported_mod.get_type())
 
     def test_get_string_module(self):
         mod = self.pycore.get_string_module('class Sample(object):\n    pass\n')
-        sample_class = mod.get_attribute('Sample').get_object()
+        sample_class = mod['Sample'].get_object()
         self.assertEquals(get_base_type('Type'), sample_class.get_type())
 
     def test_get_string_module_with_extra_spaces(self):
     def test_parameter_info_for_functions(self):
         mod = self.pycore.get_string_module('def sample_function(param1, param2=10,' +
                                             ' *param3, **param4):\n    pass')
-        sample_function = mod.get_attribute('sample_function')
+        sample_function = mod['sample_function']
         self.assertEquals(['param1', 'param2', 'param3', 'param4'],
                           sample_function.get_object().get_param_names())
 
     def xxx_test_not_found_module_is_module(self):
         mod = self.pycore.get_string_module('import doesnotexist\n')
         self.assertEquals(get_base_type('Module'),
-                          mod.get_attribute('doesnotexist').
+                          mod['doesnotexist'].
                           get_object().get_type())
 
     def test_mixing_scopes_and_objects_hierarchy(self):
     def test_inheriting_base_class_attributes(self):
         mod = self.pycore.get_string_module('class Base(object):\n    def method(self):\n        pass\n' +
                                              'class Derived(Base):\n    pass\n')
-        derived = mod.get_attribute('Derived').get_object()
+        derived = mod['Derived'].get_object()
         self.assertTrue('method' in derived.get_attributes())
         self.assertEquals(get_base_type('Function'),
-                          derived.get_attribute('method').get_object().get_type())
+                          derived['method'].get_object().get_type())
 
     def test_inheriting_multiple_base_class_attributes(self):
         code = 'class Base1(object):\n    def method1(self):\n        pass\n' \
                'class Base2(object):\n    def method2(self):\n        pass\n' \
                'class Derived(Base1, Base2):\n    pass\n'
         mod = self.pycore.get_string_module(code)
-        derived = mod.get_attribute('Derived').get_object()
+        derived = mod['Derived'].get_object()
         self.assertTrue('method1' in derived.get_attributes())
         self.assertTrue('method2' in derived.get_attributes())
 
                'class Base2(object):\n    def method(self):\n        pass\n' \
                'class Derived(Base1, Base2):\n    pass\n'
         mod = self.pycore.get_string_module(code)
-        base1 = mod.get_attribute('Base1').get_object()
-        derived = mod.get_attribute('Derived').get_object()
-        self.assertEquals(base1.get_attribute('method').get_object(),
-                          derived.get_attribute('method').get_object())
+        base1 = mod['Base1'].get_object()
+        derived = mod['Derived'].get_object()
+        self.assertEquals(base1['method'].get_object(),
+                          derived['method'].get_object())
 
     def test_inheriting_unknown_base_class(self):
         mod = self.pycore.get_string_module('class Derived(NotFound):\n' \
                                             '    def f(self):\n        pass\n')
-        derived = mod.get_attribute('Derived').get_object()
+        derived = mod['Derived'].get_object()
         self.assertTrue('f' in derived.get_attributes())
 
     def test_module_creation(self):
 
     def test_get_pyname_definition_location(self):
         mod = self.pycore.get_string_module('a_var = 20\n')
-        a_var = mod.get_attribute('a_var')
+        a_var = mod['a_var']
         self.assertEquals((mod, 1), a_var.get_definition_location())
 
     def test_get_pyname_definition_location_functions(self):
         mod = self.pycore.get_string_module('def a_func():\n    pass\n')
-        a_func = mod.get_attribute('a_func')
+        a_func = mod['a_func']
         self.assertEquals((mod, 1), a_func.get_definition_location())
 
     def test_get_pyname_definition_location_class(self):
         mod = self.pycore.get_string_module('class AClass(object):\n    pass\n\n')
-        a_class = mod.get_attribute('AClass')
+        a_class = mod['AClass']
         self.assertEquals((mod, 1), a_class.get_definition_location())
 
     def test_get_pyname_definition_location_local_variables(self):
 
     def test_get_pyname_definition_location_reassigning(self):
         mod = self.pycore.get_string_module('a_var = 20\na_var=30\n')
-        a_var = mod.get_attribute('a_var')
+        a_var = mod['a_var']
         self.assertEquals((mod, 1), a_var.get_definition_location())
 
     def test_get_pyname_definition_location_importes(self):
         module = testutils.create_module(self.project, 'mod')
         mod = self.pycore.get_string_module('import mod\n')
         imported_module = self.pycore.get_module('mod')
-        module_pyname = mod.get_attribute('mod')
+        module_pyname = mod['mod']
         self.assertEquals((imported_module, 1),
                           module_pyname.get_definition_location())
 
         module_resource.write('\ndef a_func():\n    pass\n')
         imported_module = self.pycore.get_module('mod')
         mod = self.pycore.get_string_module('from mod import a_func\n')
-        a_func = mod.get_attribute('a_func')
+        a_func = mod['a_func']
         self.assertEquals((imported_module, 2), a_func.get_definition_location())
 
     def test_get_pyname_definition_location_parameters(self):
     def test_get_pyname_definition_location_class2(self):
         mod = self.pycore.get_string_module('class AClass(object):\n    def __init__(self):\n' + \
                                             '        self.an_attr = 10\n')
-        a_class = mod.get_attribute('AClass').get_object()
-        an_attr = a_class.get_attribute('an_attr')
+        a_class = mod['AClass'].get_object()
+        an_attr = a_class['an_attr']
         self.assertEquals((mod, 3), an_attr.get_definition_location())
 
     def test_import_not_found_module_get_definition_location(self):
         mod = self.pycore.get_string_module('import doesnotexist\n')
-        does_not_exist = mod.get_attribute('doesnotexist')
+        does_not_exist = mod['doesnotexist']
         self.assertEquals((None, None), does_not_exist.get_definition_location())
 
     def test_from_not_found_module_get_definition_location(self):
         mod = self.pycore.get_string_module('from doesnotexist import Sample\n')
-        sample = mod.get_attribute('Sample')
+        sample = mod['Sample']
         self.assertEquals((None, None), sample.get_definition_location())
 
     def test_from_package_import_module_get_definition_location(self):
         testutils.create_module(self.project, 'mod', pkg)
         pkg_mod = self.pycore.get_module('pkg.mod')
         mod = self.pycore.get_string_module('from pkg import mod\n')
-        imported_mod = mod.get_attribute('mod')
+        imported_mod = mod['mod']
         self.assertEquals((pkg_mod, 1),
                           imported_mod.get_definition_location())
 
     def test_get_module_for_defined_pyobjects(self):
         mod = self.pycore.get_string_module('class AClass(object):\n    pass\n')
-        a_class = mod.get_attribute('AClass').get_object()
+        a_class = mod['AClass'].get_object()
         self.assertEquals(mod, a_class.get_module())
 
     def test_get_definition_location_for_packages(self):
         pkg = testutils.create_package(self.project, 'pkg')
         init_module = self.pycore.get_module('pkg.__init__')
         mod = self.pycore.get_string_module('import pkg\n')
-        pkg_pyname = mod.get_attribute('pkg')
+        pkg_pyname = mod['pkg']
         self.assertEquals((init_module, 1), pkg_pyname.get_definition_location())
 
     def test_get_definition_location_for_filtered_packages(self):
         testutils.create_module(self.project, 'mod', pkg)
         init_module = self.pycore.get_module('pkg.__init__')
         mod = self.pycore.get_string_module('import pkg.mod')
-        pkg_pyname = mod.get_attribute('pkg')
+        pkg_pyname = mod['pkg']
         self.assertEquals((init_module, 1), pkg_pyname.get_definition_location())
 
     def test_out_of_project_modules(self):
     def test_global_keyword(self):
         contents = 'a_var = 1\ndef a_func():\n    global a_var\n'
         mod = self.pycore.get_string_module(contents)
-        global_var = mod.get_attribute('a_var')
-        func_scope = mod.get_attribute('a_func').get_object().get_scope()
+        global_var = mod['a_var']
+        func_scope = mod['a_func'].get_object().get_scope()
         local_var = func_scope.get_name('a_var')
         self.assertEquals(global_var, local_var)
 
         mod.write('class C(object):\n    def f(self):\n'
                   '        for my_var1, my_var2 in []:\n            pass\n')
         pymod = self.pycore.resource_to_pyobject(mod)
-        c_class = pymod.get_attribute('C').get_object()
+        c_class = pymod['C'].get_object()
         self.assertFalse('my_var1' in c_class.get_attributes())
         self.assertFalse('my_var2' in c_class.get_attributes())
 
         mod.write('class C(object):\n    def f(self):\n'
                   '        for my_var in []:\n            pass\n')
         pymod = self.pycore.resource_to_pyobject(mod)
-        c_class = pymod.get_attribute('C').get_object()
+        c_class = pymod['C'].get_object()
         self.assertFalse('my_var' in c_class.get_attributes())
 
     def test_not_leaking_tuple_assigned_names_inside_parent_scope(self):
         mod.write('class C(object):\n    def f(self):\n'
                   '        var1, var2 = range(2)\n')
         pymod = self.pycore.resource_to_pyobject(mod)
-        c_class = pymod.get_attribute('C').get_object()
+        c_class = pymod['C'].get_object()
         self.assertFalse('var1' in c_class.get_attributes())
 
     @testutils.run_only_for_25
         if sys.version_info < (2, 6, 0):
             code = 'from __future__ import with_statement\n' + code
         pymod = self.pycore.get_string_module(code)
-        a_class = pymod.get_attribute('A').get_object()
-        var = pymod.get_attribute('var').get_object()
+        a_class = pymod['A'].get_object()
+        var = pymod['var'].get_object()
         self.assertEquals(a_class, var.get_type())
 
     def test_check_for_else_block(self):
         mod = self.pycore.get_string_module('for i in range(10):\n    pass\n'
                                             'else:\n    myvar = 1\n')
-        a_var = mod.get_attribute('myvar')
+        a_var = mod['myvar']
         self.assertEquals((mod, 4), a_var.get_definition_location())
 
     def test_check_names_defined_in_whiles(self):
         mod = self.pycore.get_string_module('while False:\n    myvar = 1\n')
-        a_var = mod.get_attribute('myvar')
+        a_var = mod['myvar']
         self.assertEquals((mod, 2), a_var.get_definition_location())
 
     @testutils.assert_raises(exceptions.ModuleSyntaxError)
 
     def test_simple_import(self):