<commit_before>""" Expand some builtins implementation when it is profitable."""

from pythran.analyses import Aliases
from pythran.analyses.pure_expressions import PureExpressions
from pythran.analyses.constant_expressions import ConstantExpressions
from pythran.passmanager import Transformation
from pythran.tables import MODULES
from pythran.intrinsic import FunctionIntr

import gast as ast
import sys


class InlineBuiltins(Transformation):

    """
    Replace some builtins by their bodies.

    This may trigger some extra optimizations later on!

    >>> import gast as ast
    >>> from pythran import passmanager, backend
    >>> pm = passmanager.PassManager("test")
    >>> node = ast.parse('''
    ... def foo(a):
    ...     return  a + 1
    ... def bar(b):
    ...     return __builtin__.map(bar, (1, 2))''')
    >>> _, node = pm.apply(InlineBuiltins, node)
    >>> print(pm.dump(backend.Python, node))
    def foo(a):
        return (a + 1)
    def bar(b):
        return [bar(1), bar(2)]
    """

    def __init__(self):
        Transformation.__init__(self, Aliases, ConstantExpressions,
                                PureExpressions)

    def inlineBuiltinsXMap(self, node):
        self.update = True

        elts = []<commit_msg>Remove useless dependency in InlineBuiltins<commit_after>""" Expand some builtins implementation when it is profitable."""

from pythran.analyses import Aliases
from pythran.analyses.pure_expressions import PureExpressions
from pythran.analyses.constant_expressions import ConstantExpressions
from pythran.passmanager import Transformation
from pythran.tables import MODULES
from pythran.intrinsic import FunctionIntr

import gast as ast
import sys


class InlineBuiltins(Transformation):

    """
    Replace some builtins by their bodies.

    This may trigger some extra optimizations later on!

    >>> import gast as ast
    >>> from pythran import passmanager, backend
    >>> pm = passmanager.PassManager("test")
    >>> node = ast.parse('''
    ... def foo(a):
    ...     return  a + 1
    ... def bar(b):
    ...     return __builtin__.map(bar, (1, 2))''')
    >>> _, node = pm.apply(InlineBuiltins, node)
    >>> print(pm.dump(backend.Python, node))
    def foo(a):
        return (a + 1)
    def bar(b):
        return [bar(1), bar(2)]
    """

    def __init__(self):
        Transformation.__init__(self, Aliases, PureExpressions)

    def inlineBuiltinsXMap(self, node):
        self.update = True

        elts = []
{'fraction_non_alphanumeric': 0.10985915492957747, 'fraction_numerical': 0.00482897384305835, 'mean_word_length': 3.0754098360655737, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 39, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5701744', 'n_tokens_mistral': 752, 'n_tokens_neox': 709, 'n_words': 215}