ยปCore Development>Code coverage>Lib/lib2to3/fixes/fix_buffer.py

Python code coverage for Lib/lib2to3/fixes/fix_buffer.py

#countcontent
1n/a# Copyright 2007 Google, Inc. All Rights Reserved.
2n/a# Licensed to PSF under a Contributor Agreement.
3n/a
4n/a"""Fixer that changes buffer(...) into memoryview(...)."""
5n/a
6n/a# Local imports
7n/afrom .. import fixer_base
8n/afrom ..fixer_util import Name
9n/a
10n/a
11n/aclass FixBuffer(fixer_base.BaseFix):
12n/a BM_compatible = True
13n/a
14n/a explicit = True # The user must ask for this fixer
15n/a
16n/a PATTERN = """
17n/a power< name='buffer' trailer< '(' [any] ')' > any* >
18n/a """
19n/a
20n/a def transform(self, node, results):
21n/a name = results["name"]
22n/a name.replace(Name("memoryview", prefix=name.prefix))