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

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

#countcontent
1n/a# Copyright 2008 Armin Ronacher.
2n/a# Licensed to PSF under a Contributor Agreement.
3n/a
4n/a"""Fixer for reduce().
5n/a
6n/aMakes sure reduce() is imported from the functools module if reduce is
7n/aused in that module.
8n/a"""
9n/a
10n/afrom lib2to3 import fixer_base
11n/afrom lib2to3.fixer_util import touch_import
12n/a
13n/a
14n/a
15n/aclass FixReduce(fixer_base.BaseFix):
16n/a
17n/a BM_compatible = True
18n/a order = "pre"
19n/a
20n/a PATTERN = """
21n/a power< 'reduce'
22n/a trailer< '('
23n/a arglist< (
24n/a (not(argument<any '=' any>) any ','
25n/a not(argument<any '=' any>) any) |
26n/a (not(argument<any '=' any>) any ','
27n/a not(argument<any '=' any>) any ','
28n/a not(argument<any '=' any>) any)
29n/a ) >
30n/a ')' >
31n/a >
32n/a """
33n/a
34n/a def transform(self, node, results):
35n/a touch_import('functools', 'reduce', node)