summaryrefslogtreecommitdiff
path: root/custom_fixers
diff options
context:
space:
mode:
authorDasIch <dasdasich@gmail.com>2010-05-09 14:57:18 +0200
committerDasIch <dasdasich@gmail.com>2010-05-09 14:57:18 +0200
commit7e84c4a69e87a7e8b60c9b92c61f11381e8f96f6 (patch)
tree74e6fa4b8a347fa1ad77d86db4894eb5d12d6f37 /custom_fixers
parentd56bf3e26d8707a4e5a9174609c203ec34417cd1 (diff)
downloadsphinx-7e84c4a69e87a7e8b60c9b92c61f11381e8f96f6.tar.gz
Rename __unicode__ to __str__
Diffstat (limited to 'custom_fixers')
-rw-r--r--custom_fixers/__init__.py0
-rw-r--r--custom_fixers/fix_alt_unicode.py12
2 files changed, 12 insertions, 0 deletions
diff --git a/custom_fixers/__init__.py b/custom_fixers/__init__.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/custom_fixers/__init__.py
diff --git a/custom_fixers/fix_alt_unicode.py b/custom_fixers/fix_alt_unicode.py
new file mode 100644
index 00000000..55175e90
--- /dev/null
+++ b/custom_fixers/fix_alt_unicode.py
@@ -0,0 +1,12 @@
+from lib2to3.fixer_base import BaseFix
+from lib2to3.fixer_util import Name
+
+class FixAltUnicode(BaseFix):
+ PATTERN = """
+ func=funcdef< 'def' name='__unicode__'
+ parameters< '(' NAME ')' > any+ >
+ """
+
+ def transform(self, node, results):
+ name = results['name']
+ name.replace(Name('__str__', prefix=name.prefix))