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

All Samples(5)  |  Call(4)  |  Derive(0)  |  Import(1)

        def sort_set_elts(elts):
    elts = list(elts)
    try:
        # sort elements for astoptimizer unit tests
        elts.sort()
    except TypeError:
        # elements may be unsortable
        pass
    return elts
        


src/a/s/astoptimizer-0.6/astoptimizer/optimizer.py   astoptimizer(Download)
 
from astoptimizer import UNSET
from astoptimizer.ast_tools import (
    copy_lineno,
    new_constant, new_literal, new_call, new_pass,
                use_literal_set = (qualname == 'set' and PYTHON27)
                if (len(elts) != len(constant)) or use_literal_set:
                    elts = sort_set_elts(elts)
                    if len(elts) <= self.config.max_tuple_length:
                        if use_literal_set:
        if literal is UNSET:
            return
        literal = sort_set_elts(literal)
        if PYTHON27:
            return new_set(node, literal)
                if literal is UNSET:
                    return
                literal = sort_set_elts(literal)
                if to_type == tuple:
                    # {3, 1, 2} => (1, 2, 3)
 
        if isinstance(literal, (frozenset, set)):
            literal = sort_set_elts(literal)
        if to_type == list:
            # "abc" => ["a", "b", "c"]