]> git.proxmox.com Git - mirror_edk2.git/blame - AppPkg/Applications/Python/Python-2.7.2/Lib/lib2to3/fixes/fix_buffer.py
AppPkg/Applications/Python: Add Python 2.7.2 sources since the release of Python...
[mirror_edk2.git] / AppPkg / Applications / Python / Python-2.7.2 / Lib / lib2to3 / fixes / fix_buffer.py
CommitLineData
4710c53d 1# Copyright 2007 Google, Inc. All Rights Reserved.\r
2# Licensed to PSF under a Contributor Agreement.\r
3\r
4"""Fixer that changes buffer(...) into memoryview(...)."""\r
5\r
6# Local imports\r
7from .. import fixer_base\r
8from ..fixer_util import Name\r
9\r
10\r
11class FixBuffer(fixer_base.BaseFix):\r
12 BM_compatible = True\r
13\r
14 explicit = True # The user must ask for this fixer\r
15\r
16 PATTERN = """\r
17 power< name='buffer' trailer< '(' [any] ')' > any* >\r
18 """\r
19\r
20 def transform(self, node, results):\r
21 name = results["name"]\r
22 name.replace(Name(u"memoryview", prefix=name.prefix))\r