Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(22)  |  Call(14)  |  Derive(0)  |  Import(8)

        def makeSequenceCreationOrConstant(sequence_kind, elements, source_ref):
    # Sequence creation. Tries to avoid creations with only constant
    # elements. Would be caught by optimization, but would be useless churn. For
    # mutable constants we cannot do it though.
    for element in elements:
        if not element.isExpressionConstantRef():
            constant = False
            break
    else:
        constant = True

    sequence_kind = sequence_kind.upper()

    # Note: This would happen in optimization instead, but lets just do it
    # immediately to save some time.
    if constant:
        if sequence_kind == "TUPLE":
            const_type = tuple
        elif sequence_kind == "LIST":
            const_type = list
        elif sequence_kind == "SET":
            const_type = set
        else:
            assert False, sequence_kind

        return ExpressionConstantRef(
            constant      = const_type(
                element.getConstant()
                for element in
                elements
            ),
            source_ref    = source_ref,
            user_provided = True
        )
    else:
        if sequence_kind == "TUPLE":
            return ExpressionMakeTuple(
                elements   = elements,
                source_ref = source_ref
            )
        elif sequence_kind == "LIST":
            return ExpressionMakeList(
                elements   = elements,
                source_ref = source_ref
            )
        elif sequence_kind == "SET":
            return ExpressionMakeSet(
                elements   = elements,
                source_ref = source_ref
            )
        else:
            assert False, sequence_kind
        


src/n/u/Nuitka-HEAD/nuitka/tree/Building.py   Nuitka(Download)
 
# Some helpers.
from .Helpers import (
    makeStatementsSequenceOrStatement,
    makeSequenceCreationOrConstant,
def buildSequenceCreationNode(provider, node, source_ref):
    return makeSequenceCreationOrConstant(
        sequence_kind = getKind(node).upper(),
        elements      = buildNodeList(provider, node.elts, source_ref),
        source_ref    = source_ref

src/n/u/Nuitka-HEAD/nuitka/tree/ReformulationClasses.py   Nuitka(Download)
from nuitka.nodes.ParameterSpecs import ParameterSpec
 
from .Helpers import (
    makeStatementsSequenceFromStatement,
    makeSequenceCreationOrConstant,
                ),
                args       = makeSequenceCreationOrConstant(
                    sequence_kind = "tuple",
                    elements      = (
                        ExpressionConstantRef(
            ),
            source       = makeSequenceCreationOrConstant(
                sequence_kind = "tuple",
                elements      = buildNodeList(
                    provider, node.bases, source_ref
            ),
            source       = makeSequenceCreationOrConstant(
                sequence_kind = "tuple",
                elements      = buildNodeList(
                    provider, node.bases, source_ref

src/n/u/Nuitka-0.5.1.5/nuitka/tree/Building.py   Nuitka(Download)
 
# Some helpers.
from .Helpers import (
    makeStatementsSequenceOrStatement,
    makeSequenceCreationOrConstant,
def buildSequenceCreationNode(provider, node, source_ref):
    return makeSequenceCreationOrConstant(
        sequence_kind = getKind( node ).upper(),
        elements      = buildNodeList( provider, node.elts, source_ref ),
        source_ref    = source_ref

src/n/u/Nuitka-0.5.1.5/nuitka/tree/ReformulationClasses.py   Nuitka(Download)
from nuitka.nodes.ParameterSpecs import ParameterSpec
 
from .Helpers import (
    makeStatementsSequenceFromStatement,
    makeSequenceCreationOrConstant,
                ),
                args       = makeSequenceCreationOrConstant(
                    sequence_kind = "tuple",
                    elements      = (
                        ExpressionConstantRef(
            ),
            source       = makeSequenceCreationOrConstant(
                sequence_kind = "tuple",
                elements      = buildNodeList(
                    provider, node.bases, source_ref
            ),
            source       = makeSequenceCreationOrConstant(
                sequence_kind = "tuple",
                elements      = buildNodeList(
                    provider, node.bases, source_ref

src/n/u/Nuitka-HEAD/nuitka/tree/ReformulationCallExpressions.py   Nuitka(Download)
    ExpressionFunctionRef
)
from .Helpers import (
    makeSequenceCreationOrConstant,
    makeDictCreationOrConstant,
            called  = called,
            args    = makeSequenceCreationOrConstant(
                sequence_kind = "tuple",
                elements      = positional_args,
                source_ref    = source_ref
            helper_args.append(
                makeSequenceCreationOrConstant(
                    sequence_kind = "tuple",
                    elements      = positional_args,
                    source_ref    = source_ref

src/n/u/Nuitka-0.5.1.5/nuitka/tree/ReformulationCallExpressions.py   Nuitka(Download)
    ExpressionFunctionRef
)
from .Helpers import (
    makeSequenceCreationOrConstant,
    makeDictCreationOrConstant,
            called  = called,
            args    = makeSequenceCreationOrConstant(
                sequence_kind = "tuple",
                elements      = positional_args,
                source_ref    = source_ref
            helper_args.append(
                makeSequenceCreationOrConstant(
                    sequence_kind = "tuple",
                    elements      = positional_args,
                    source_ref    = source_ref

src/n/u/Nuitka-HEAD/nuitka/tree/ReformulationAssignmentStatements.py   Nuitka(Download)
from nuitka.nodes.SliceNodes import ExpressionSliceLookup
 
from .Helpers import (
    makeStatementsSequenceFromStatement,
    makeStatementsSequenceOrStatement,
 
    return makeSequenceCreationOrConstant(
        sequence_kind = "tuple",
        elements      = elements,
        source_ref    = source_ref

src/n/u/Nuitka-0.5.1.5/nuitka/tree/ReformulationAssignmentStatements.py   Nuitka(Download)
from nuitka.nodes.SliceNodes import ExpressionSliceLookup
 
from .Helpers import (
    makeStatementsSequenceFromStatement,
    makeStatementsSequenceOrStatement,
 
    return makeSequenceCreationOrConstant(
        sequence_kind = "tuple",
        elements      = elements,
        source_ref    = source_ref