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

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

#countcontent
1n/a# Copyright 2006 Google, Inc. All Rights Reserved.
2n/a# Licensed to PSF under a Contributor Agreement.
3n/a
4n/a"""Fixer that transforms `xyzzy` into repr(xyzzy)."""
5n/a
6n/a# Local imports
7n/afrom .. import fixer_base
8n/afrom ..fixer_util import Call, Name, parenthesize
9n/a
10n/a
11n/aclass FixRepr(fixer_base.BaseFix):
12n/a
13n/a BM_compatible = True
14n/a PATTERN = """
15n/a atom < '`' expr=any '`' >
16n/a """
17n/a
18n/a def transform(self, node, results):
19n/a expr = results["expr"].clone()
20n/a
21n/a if expr.type == self.syms.testlist1:
22n/a expr = parenthesize(expr)
23n/a return Call(Name("repr"), [expr], prefix=node.prefix)