comparison planemo/lib/python3.7/site-packages/libpasteurize/fixes/fix_memoryview.py @ 1:56ad4e20f292 draft

"planemo upload commit 6eee67778febed82ddd413c3ca40b3183a3898f1"
author guerler
date Fri, 31 Jul 2020 00:32:28 -0400
parents
children
comparison
equal deleted inserted replaced
0:d30785e31577 1:56ad4e20f292
1 u"""
2 Fixer for memoryview(s) -> buffer(s).
3 Explicit because some memoryview methods are invalid on buffer objects.
4 """
5
6 from lib2to3 import fixer_base
7 from lib2to3.fixer_util import Name
8
9
10 class FixMemoryview(fixer_base.BaseFix):
11
12 explicit = True # User must specify that they want this.
13
14 PATTERN = u"""
15 power< name='memoryview' trailer< '(' [any] ')' >
16 rest=any* >
17 """
18
19 def transform(self, node, results):
20 name = results[u"name"]
21 name.replace(Name(u"buffer", prefix=name.prefix))