Anonymous avatar Anonymous committed 59111cd

project: preferring Project.pycore to get_pycore()

Comments (0)

Files changed (22)

   # Alternatively you can use `generate` module.
   # Creating modules and packages using `generate` module
   >>> from rope.contrib import generate
-  >>> pycore = project.get_pycore()
+  >>> pycore = project.pycore
   >>> pkg = generate.create_package(project, 'pkg')
   >>> mod2 = generate.create_module(project, 'mod2', pkg)
   >>> mod2.write('import mod1\nprint mod1.a_var\n')

rope/base/oi/transform.py

     def _get_pymodule(self, path):
         resource = self.path_to_resource(path)
         if resource is not None:
-            return self.project.get_pycore().resource_to_pyobject(resource)
+            return self.project.pycore.resource_to_pyobject(resource)
 
     def path_to_resource(self, path):
         try:

rope/contrib/codeassist.py

     def __init__(self, project, source_code, offset, resource=None,
                  maxfixes=1, later_locals=True):
         self.project = project
-        self.pycore = self.project.get_pycore()
+        self.pycore = self.project.pycore
         self.code = source_code
         self.resource = resource
         self.maxfixes = maxfixes

rope/contrib/generate.py

                 'Module <%s> already exists' % new_resource.path)
         changes.add_change(change.CreateResource(new_resource))
         changes.add_change(_add_import_to_module(
-                           self.project.get_pycore(), self.resource, new_resource))
+                           self.project.pycore, self.resource, new_resource))
         return changes
 
     def get_location(self):
                 'Package <%s> already exists' % new_resource.path)
         changes.add_change(change.CreateResource(new_resource))
         changes.add_change(_add_import_to_module(
-                           self.project.get_pycore(), self.resource, new_resource))
+                           self.project.pycore, self.resource, new_resource))
         child = self.project.get_folder(package.path + '/' + self.name)
         changes.add_change(change.CreateFile(child, '__init__.py'))
         return changes

ropetest/advanced_oi_test.py

     def setUp(self):
         super(DynamicOITest, self).setUp()
         self.project = testutils.sample_project(validate_objectdb=True)
-        self.pycore = self.project.get_pycore()
+        self.pycore = self.project.pycore
 
     def tearDown(self):
         testutils.remove_project(self.project)
     def setUp(self):
         super(NewStaticOITest, self).setUp()
         self.project = testutils.sample_project(validate_objectdb=True)
-        self.pycore = self.project.get_pycore()
+        self.pycore = self.project.pycore
         self.mod = testutils.create_module(self.project, 'mod')
 
     def tearDown(self):

ropetest/builtinstest.py

     def setUp(self):
         super(BuiltinTypesTest, self).setUp()
         self.project = testutils.sample_project()
-        self.pycore = self.project.get_pycore()
+        self.pycore = self.project.pycore
         self.mod = testutils.create_module(self.project, 'mod')
 
     def tearDown(self):
         super(BuiltinModulesTest, self).setUp()
         self.project = testutils.sample_project(
             extension_modules=['time', 'invalid_module'])
-        self.pycore = self.project.get_pycore()
+        self.pycore = self.project.pycore
         self.mod = testutils.create_module(self.project, 'mod')
 
     def tearDown(self):

ropetest/codeanalyzetest.py

     def setUp(self):
         super(ScopeNameFinderTest, self).setUp()
         self.project = testutils.sample_project()
-        self.pycore = self.project.get_pycore()
+        self.pycore = self.project.pycore
 
     def tearDown(self):
         testutils.remove_project(self.project)

ropetest/contrib/codeassisttest.py

         self.assertEquals((module_resource, 1), result)
 
     def test_get_definition_location_for_nested_packages(self):
-        pycore = self.project.get_pycore()
+        pycore = self.project.pycore
         mod1 = testutils.create_module(self.project, 'mod1')
         pkg1 = testutils.create_package(self.project, 'pkg1')
         pkg2 = testutils.create_package(self.project, 'pkg2', pkg1)
         get_doc(self.project, src, src.index('AClass') + 1).index('AClass')
 
     def test_get_pydoc_for_modules(self):
-        pycore = self.project.get_pycore()
+        pycore = self.project.pycore
         mod = testutils.create_module(self.project, 'mod')
         mod.write('"""a module"""\n')
         src = 'import mod\nmod'
     def setUp(self):
         super(CodeAssistInProjectsTest, self).setUp()
         self.project = testutils.sample_project()
-        self.pycore = self.project.get_pycore()
+        self.pycore = self.project.pycore
         samplemod = testutils.create_module(self.project, 'samplemod')
         code = 'class SampleClass(object):\n' \
                '    def sample_method():\n        pass\n\n' \

ropetest/contrib/generatetest.py

     def setUp(self):
         super(GenerateTest, self).setUp()
         self.project = testutils.sample_project()
-        self.pycore = self.project.get_pycore()
+        self.pycore = self.project.pycore
         self.mod = testutils.create_module(self.project, 'mod1')
         self.mod2 = testutils.create_module(self.project, 'mod2')
         self.pkg = testutils.create_package(self.project, 'pkg')

ropetest/objectinfertest.py

     def setUp(self):
         super(ObjectInferTest, self).setUp()
         self.project = testutils.sample_project()
-        self.pycore = self.project.get_pycore()
+        self.pycore = self.project.pycore
 
     def tearDown(self):
         testutils.remove_project(self.project)
     def test_simple_type_inferencing_for_chained_assignments(self):
         mod = 'class Sample(object):\n    pass\n' \
               'copied_sample = Sample'
-        mod_scope = self.project.get_pycore().get_string_scope(mod)
+        mod_scope = self.project.pycore.get_string_scope(mod)
         sample_class = mod_scope['Sample']
         copied_sample = mod_scope['copied_sample']
         self.assertEquals(sample_class.get_object(),
         mod = 'class Sample(object):\n    pass\n' \
               'sample_class = Sample\n' \
               'sample_class = sample_class\n'
-        mod_scope = self.project.get_pycore().get_string_scope(mod)
+        mod_scope = self.project.pycore.get_string_scope(mod)
         sample_class = mod_scope['Sample']
         sample_class_var = mod_scope['sample_class']
         self.assertEquals(sample_class.get_object(),
         src = 'class Sample(object):\n    pass\n' \
               'def a_func():\n    return Sample\n' \
               'a_var = a_func()\n'
-        scope = self.project.get_pycore().get_string_scope(src)
+        scope = self.project.pycore.get_string_scope(src)
         sample_class = scope['Sample']
         a_var = scope['a_var']
         self.assertEquals(sample_class.get_object(), a_var.get_object())
         src = 'class Sample(object):\n    pass\n' \
               'def a_func():\n    return Sample()\n' \
               'a_var = a_func()\n'
-        scope = self.project.get_pycore().get_string_scope(src)
+        scope = self.project.pycore.get_string_scope(src)
         sample_class = scope['Sample'].get_object()
         a_var = scope['a_var'].get_object()
         self.assertEquals(sample_class, a_var.get_type())
               '    if True:\n        return Sample()\n' \
               '    else:\n        return a_func()\n' \
               'a_var = a_func()\n'
-        scope = self.project.get_pycore().get_string_scope(src)
+        scope = self.project.pycore.get_string_scope(src)
         sample_class = scope['Sample'].get_object()
         a_var = scope['a_var'].get_object()
         self.assertEquals(sample_class, a_var.get_type())
         src = 'class Sample(object):\n' \
               '    def __call__(self):\n        return Sample\n' \
               'sample = Sample()\na_var = sample()'
-        scope = self.project.get_pycore().get_string_scope(src)
+        scope = self.project.pycore.get_string_scope(src)
         sample_class = scope['Sample']
         a_var = scope['a_var']
         self.assertEquals(sample_class.get_object(), a_var.get_object())

ropetest/pycoretest.py

     def setUp(self):
         super(PyCoreTest, self).setUp()
         self.project = testutils.sample_project()
-        self.pycore = self.project.get_pycore()
+        self.pycore = self.project.pycore
 
     def tearDown(self):
         testutils.remove_project(self.project)
     def setUp(self):
         super(self.__class__, self).setUp()
         self.project = testutils.sample_project()
-        self.pycore = self.project.get_pycore()
+        self.pycore = self.project.pycore
         samplemod = testutils.create_module(self.project, 'samplemod')
         samplemod.write(
             'class SampleClass(object):\n    def sample_method():\n        pass'

ropetest/pyscopestest.py

     def setUp(self):
         super(PyCoreScopesTest, self).setUp()
         self.project = testutils.sample_project()
-        self.pycore = self.project.get_pycore()
+        self.pycore = self.project.pycore
 
     def tearDown(self):
         testutils.remove_project(self.project)

ropetest/refactor/__init__.py

     def setUp(self):
         super(MethodObjectTest, self).setUp()
         self.project = testutils.sample_project()
-        self.pycore = self.project.get_pycore()
+        self.pycore = self.project.pycore
         self.mod = testutils.create_module(self.project, 'mod')
 
     def tearDown(self):
     def setUp(self):
         super(IntroduceFactoryTest, self).setUp()
         self.project = testutils.sample_project()
-        self.pycore = self.project.get_pycore()
+        self.pycore = self.project.pycore
 
     def tearDown(self):
         testutils.remove_project(self.project)
     def setUp(self):
         super(EncapsulateFieldTest, self).setUp()
         self.project = testutils.sample_project()
-        self.pycore = self.project.get_pycore()
+        self.pycore = self.project.pycore
         self.mod = testutils.create_module(self.project, 'mod')
         self.mod1 = testutils.create_module(self.project, 'mod1')
         self.a_class = 'class A(object):\n' \
     def setUp(self):
         super(LocalToFieldTest, self).setUp()
         self.project = testutils.sample_project()
-        self.pycore = self.project.get_pycore()
+        self.pycore = self.project.pycore
         self.mod = testutils.create_module(self.project, 'mod')
 
     def tearDown(self):
     def setUp(self):
         super(IntroduceParameterTest, self).setUp()
         self.project = testutils.sample_project()
-        self.pycore = self.project.get_pycore()
+        self.pycore = self.project.pycore
         self.mod = testutils.create_module(self.project, 'mod')
 
     def tearDown(self):

ropetest/refactor/change_signature_test.py

     def setUp(self):
         super(ChangeSignatureTest, self).setUp()
         self.project = testutils.sample_project()
-        self.pycore = self.project.get_pycore()
+        self.pycore = self.project.pycore
         self.mod = testutils.create_module(self.project, 'mod')
 
     def tearDown(self):

ropetest/refactor/extracttest.py

     def setUp(self):
         super(ExtractMethodTest, self).setUp()
         self.project = testutils.sample_project()
-        self.pycore = self.project.get_pycore()
+        self.pycore = self.project.pycore
 
     def tearDown(self):
         testutils.remove_project(self.project)

ropetest/refactor/importutilstest.py

     def setUp(self):
         super(ImportUtilsTest, self).setUp()
         self.project = testutils.sample_project()
-        self.pycore = self.project.get_pycore()
+        self.pycore = self.project.pycore
         self.import_tools = ImportTools(self.pycore)
 
         self.mod = testutils.create_module(self.project, 'mod')
     def setUp(self):
         super(AddImportTest, self).setUp()
         self.project = testutils.sample_project()
-        self.pycore = self.project.get_pycore()
+        self.pycore = self.project.pycore
 
         self.mod1 = testutils.create_module(self.project, 'mod1')
         self.mod2 = testutils.create_module(self.project, 'mod2')

ropetest/refactor/inlinetest.py

     def setUp(self):
         super(InlineTest, self).setUp()
         self.project = testutils.sample_project()
-        self.pycore = self.project.get_pycore()
+        self.pycore = self.project.pycore
         self.mod = testutils.create_module(self.project, 'mod')
         self.mod2 = testutils.create_module(self.project, 'mod2')
 

ropetest/refactor/movetest.py

     def setUp(self):
         super(MoveRefactoringTest, self).setUp()
         self.project = testutils.sample_project()
-        self.pycore = self.project.get_pycore()
+        self.pycore = self.project.pycore
         self.mod1 = testutils.create_module(self.project, 'mod1')
         self.mod2 = testutils.create_module(self.project, 'mod2')
         self.mod3 = testutils.create_module(self.project, 'mod3')

ropetest/refactor/renametest.py

     def setUp(self):
         super(RenameRefactoringTest, self).setUp()
         self.project = testutils.sample_project()
-        self.pycore = self.project.get_pycore()
+        self.pycore = self.project.pycore
 
     def tearDown(self):
         testutils.remove_project(self.project)
     def setUp(self):
         super(ImplicitInterfacesTest, self).setUp()
         self.project = testutils.sample_project(validate_objectdb=True)
-        self.pycore = self.project.get_pycore()
+        self.pycore = self.project.pycore
         self.mod1 = testutils.create_module(self.project, 'mod1')
         self.mod2 = testutils.create_module(self.project, 'mod2')
 

ropetest/refactor/restructuretest.py

     def setUp(self):
         super(RestructureTest, self).setUp()
         self.project = testutils.sample_project()
-        self.pycore = self.project.get_pycore()
+        self.pycore = self.project.pycore
         self.mod = testutils.create_module(self.project, 'mod')
 
     def tearDown(self):

ropetest/refactor/similarfindertest.py

     def setUp(self):
         super(CheckingFinderTest, self).setUp()
         self.project = testutils.sample_project()
-        self.pycore = self.project.get_pycore()
+        self.pycore = self.project.pycore
         self.mod1 = testutils.create_module(self.project, 'mod1')
 
     def tearDown(self):

ropetest/runmodtest.py

     def setUp(self):
         super(PythonFileRunnerTest, self).setUp()
         self.project = testutils.sample_project()
-        self.pycore = self.project.get_pycore()
+        self.pycore = self.project.pycore
 
     def tearDown(self):
         testutils.remove_project(self.project)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.