@@ -1,8 +1,8 @@
Loading
1 1
# Standard library imports
2 2
from pickle import *
3 -
import sys, new
3 +
import sys
4 4
import logging
5 -
from types import GeneratorType
5 +
from types import GeneratorType, MethodType
6 6
7 7
# Enthought library imports
8 8
from apptools.persistence.updater import __replacement_setstate__
@@ -10,6 +10,20 @@
Loading
10 10
11 11
logger = logging.getLogger(__name__)
12 12
13 +
14 +
def _unbound_method(method, klass):
15 +
    """
16 +
    Python-version-agnostic unbound_method generator.
17 +
18 +
    For Python 2, use MethodType. Python 3 doesn't have a separate
19 +
    type for unbound methods; just return the method itself.
20 +
    """
21 +
    if sys.version_info < (3,):
22 +
        return MethodType(method, None, klass)
23 +
    else:
24 +
        return method
25 +
26 +
13 27
##############################################################################
14 28
# class 'NewUnpickler'
15 29
##############################################################################
@@ -145,7 +159,7 @@
Loading
145 159
            # restore the original __setstate__ if necessary
146 160
            fn = getattr(klass, '__setstate_original__', False)
147 161
            if fn:
148 -
                m = new.instancemethod(fn, None, klass)
162 +
                m = _unbound_method(fn, klass)
149 163
                setattr(klass, '__setstate__', m)
150 164
151 165
        return klass
@@ -163,11 +177,11 @@
Loading
163 177
            self.backup_setstate(module, klass)
164 178
165 179
            # add the updater into the class
166 -
            m = new.instancemethod(fn, None, klass)
180 +
            m = _unbound_method(fn, klass)
167 181
            setattr(klass, '__updater__', m)
168 182
169 183
            # hook up our __setstate__ which updates self.__dict__
170 -
            m = new.instancemethod(__replacement_setstate__, None, klass)
184 +
            m = _unbound_method(__replacement_setstate__, klass)
171 185
            setattr(klass, '__setstate__', m)
172 186
173 187
        else:
@@ -192,7 +206,7 @@
Loading
192 206
193 207
            #logger.debug('renaming __setstate__ to %s' % name)
194 208
            method = getattr(klass, '__setstate__')
195 -
            m = new.instancemethod(method, None, klass)
209 +
            m = _unbound_method(method, klass)
196 210
            setattr(klass, name, m)
197 211
198 212
        else:

@@ -14,7 +14,6 @@
Loading
14 14
15 15
# Standard library imports.
16 16
import logging
17 -
import new
18 17
19 18
# Enthought libary imports
20 19
from envisage.api import Plugin, ExtensionPoint
@@ -235,7 +234,7 @@
Loading
235 234
                # Append the menu.
236 235
                ns.setdefault('menus', []).append(menu)
237 236
238 -
        return [new.classobj('SPLHelpActionSet', (ActionSet,), ns)]
237 +
        return [type('SPLHelpActionSet', (ActionSet,), ns)]
239 238
240 239
    preferences = List(contributes_to=PREFERENCES)
241 240
    def _preferences_default(self):
@@ -251,7 +250,7 @@
Loading
251 250
        if len(self.help_docs) > 0:
252 251
            pages.append(DocumentsPreferencesPage)
253 252
            pages.extend(
254 -
                [ new.classobj(doc.preferences_path + 'PreferencesPage',
253 +
                [ type(doc.preferences_path + 'PreferencesPage',
255 254
                              (HelpDocPreferencesPage,),
256 255
                              {'preferences_path': doc.preferences_path},
257 256
                             ) for doc in self.help_docs
@@ -259,7 +258,7 @@
Loading
259 258
        if len(self.help_demos) > 0:
260 259
            pages.append(DemosPreferencesPage)
261 260
            pages.extend(
262 -
                [ new.classobj(demo.preferences_path + 'PreferencesPage',
261 +
                [ type(demo.preferences_path + 'PreferencesPage',
263 262
                              (HelpDemoPreferencesPage,),
264 263
                              {'preferences_path': demo.preferences_path},
265 264
                             ) for demo in self.help_demos
@@ -267,7 +266,7 @@
Loading
267 266
        if len(self.help_examples) > 0:
268 267
            pages.append(ExamplesPreferencesPage)
269 268
            pages.extend(
270 -
                [ new.classobj(example.preferences_path + 'PreferencesPage',
269 +
                [ type(example.preferences_path + 'PreferencesPage',
271 270
                              (HelpExamplePreferencesPage,),
272 271
                              {'preferences_path': example.preferences_path},
273 272
                             ) for example in self.help_examples
Files Coverage
apptools 41.67%
Project Totals (240 files) 41.67%
163.5
TRAVIS_OS_NAME=osx
163.4
TRAVIS_OS_NAME=osx
163.2
TRAVIS_OS_NAME=linux
163.1
TRAVIS_OS_NAME=linux
163.3
TRAVIS_OS_NAME=linux

No yaml found.

Create your codecov.yml to customize your Codecov experience

Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading