summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2010-10-14 22:00:20 (GMT)
committerBenjamin Peterson <benjamin@python.org>2010-10-14 22:00:20 (GMT)
commit73315e92009c88acf53e497a0b9fcd93cd735aed (patch)
treeae74f4374152df886075081257aedcaf62b4a25c
parent35049443dc2c3e51959700aa8c5359c5ce12663e (diff)
downloadcpython-73315e92009c88acf53e497a0b9fcd93cd735aed.zip
cpython-73315e92009c88acf53e497a0b9fcd93cd735aed.tar.gz
cpython-73315e92009c88acf53e497a0b9fcd93cd735aed.tar.bz2
revert change that was in wrong branch
-rw-r--r--Lib/lib2to3/fixes/fix_operator.py22
1 files changed, 7 insertions, 15 deletions
diff --git a/Lib/lib2to3/fixes/fix_operator.py b/Lib/lib2to3/fixes/fix_operator.py
index 3ea36f5..c393f1e 100644
--- a/Lib/lib2to3/fixes/fix_operator.py
+++ b/Lib/lib2to3/fixes/fix_operator.py
@@ -10,19 +10,11 @@ operator.irepeat(obj, n) -> operator.imul(obj, n)
"""
import collections
-from functools import wraps
# Local imports
from lib2to3 import fixer_base
from lib2to3.fixer_util import Call, Name, String, touch_import
-def useinstead(what):
- """Make sure __doc__ is assigned even under -OO."""
- def deco(f):
- f.__doc__ = what
- return f
- return deco
-
class FixOperator(fixer_base.BaseFix):
@@ -44,34 +36,34 @@ class FixOperator(fixer_base.BaseFix):
if method is not None:
return method(node, results)
- @useinstead("operator.contains(%s)")
def _sequenceIncludes(self, node, results):
+ """operator.contains(%s)"""
return self._handle_rename(node, results, "contains")
- @useinstead("hasattr(%s, '__call__')")
def _isCallable(self, node, results):
+ """hasattr(%s, '__call__')"""
obj = results["obj"]
args = [obj.clone(), String(", "), String("'__call__'")]
return Call(Name("hasattr"), args, prefix=node.prefix)
- @useinstead("operator.mul(%s)")
def _repeat(self, node, results):
+ """operator.mul(%s)"""
return self._handle_rename(node, results, "mul")
- @useinstead("operator.imul(%s)")
def _irepeat(self, node, results):
+ """operator.imul(%s)"""
return self._handle_rename(node, results, "imul")
- @useinstead("isinstance(%s, collections.Sequence)")
def _isSequenceType(self, node, results):
+ """isinstance(%s, collections.Sequence)"""
return self._handle_type2abc(node, results, "collections", "Sequence")
- @useinstead("isinstance(%s, collections.Mapping)")
def _isMappingType(self, node, results):
+ """isinstance(%s, collections.Mapping)"""
return self._handle_type2abc(node, results, "collections", "Mapping")
- @useinstead("isinstance(%s, numbers.Number)")
def _isNumberType(self, node, results):
+ """isinstance(%s, numbers.Number)"""
return self._handle_type2abc(node, results, "numbers", "Number")
def _handle_rename(self, node, results, name):