1
0
mirror of https://github.com/django/django.git synced 2025-10-24 14:16:09 +00:00

More attacking E302 violators

This commit is contained in:
Alex Gaynor
2013-11-02 13:12:09 -07:00
parent 65c4ac3b24
commit 7548aa8ffd
150 changed files with 433 additions and 1 deletions

View File

@@ -8,6 +8,7 @@ aren't handled by the core weakref module).
import traceback
import weakref
def safeRef(target, onDelete = None):
"""Return a *safe* weak reference to a callable target
@@ -34,6 +35,7 @@ def safeRef(target, onDelete = None):
else:
return weakref.ref(target)
class BoundMethodWeakref(object):
"""'Safe' and reusable weak references to instance methods
@@ -186,6 +188,7 @@ class BoundMethodWeakref(object):
return function.__get__(target)
return None
class BoundNonDescriptorMethodWeakref(BoundMethodWeakref):
"""A specialized BoundMethodWeakref, for platforms where instance methods
are not descriptors.
@@ -246,6 +249,7 @@ class BoundNonDescriptorMethodWeakref(BoundMethodWeakref):
return getattr(target, function.__name__)
return None
def get_bound_method_weakref(target, onDelete):
"""Instantiates the appropiate BoundMethodWeakRef, depending on the details of
the underlying class method implementation"""