diff options
author | DasIch <dasdasich@gmail.com> | 2010-05-09 14:57:18 +0200 |
---|---|---|
committer | DasIch <dasdasich@gmail.com> | 2010-05-09 14:57:18 +0200 |
commit | 7e84c4a69e87a7e8b60c9b92c61f11381e8f96f6 (patch) | |
tree | 74e6fa4b8a347fa1ad77d86db4894eb5d12d6f37 /custom_fixers | |
parent | d56bf3e26d8707a4e5a9174609c203ec34417cd1 (diff) | |
download | sphinx-7e84c4a69e87a7e8b60c9b92c61f11381e8f96f6.tar.gz |
Rename __unicode__ to __str__
Diffstat (limited to 'custom_fixers')
-rw-r--r-- | custom_fixers/__init__.py | 0 | ||||
-rw-r--r-- | custom_fixers/fix_alt_unicode.py | 12 |
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)) |