trade是一个可迭代的list/generator
9868
def import_trade(self, trade):
        
        for item in trade:
            self.make_deal(item.code, item.datetime, item.amount,
                           item.towards, item.price.item.order_model, item.amount_model)
756482
def concat(cls, iterables):
    

    def generator():
      for it in iterables:
        for element in it:
          yield element
    return cls(generator())
240371
def list_of(*generators):
    

    class ListOfGenerators(ArbitraryInterface):
        """
        A closure class around the generators specified above, which
        generates a list of the generators.
        """

        @classmethod
        def arbitrary(cls):
            """
            Generate a list of the enclosed generators.
            """
            arbitrary_list = []
            for generator in generators:
                arbitrary_list += [
                    arbitrary(generator)
                    # max_length / len(generators):
                    for _ in range(arbitrary(int) % 100)
                ]
            return arbitrary_list

    ListOfGenerators.__name__ = ''.join([
        'list_of(', ', '.join(generator.__name__ for generator in generators),
        ')'
    ])
    return ListOfGenerators
45605
def _encode_list(name, value, check_keys, opts):
    """"""
    lname = gen_list_name()
    data = b"".join([_name_value_to_bson(next(lname), item,
                                         check_keys, opts)
                     for item in value])
    return b"\x04" + name + _PACK_INT(len(data) + 5) + data + b"\x00"
212593
def get(self, rate_type, role, session, fields=[], **kwargs):
        ''''''
        request = TOPRequest('taobao.traderates.get')
        request['rate_type'] = rate_type
        request['role'] = role
        if not fields:
            tradeRate = TradeRate()
            fields = tradeRate.fields
        request['fields'] = fields
        for k, v in kwargs.iteritems():
            if k not in ('result', 'page_no', 'page_size', 'start_date', 'end_date', 'tid') and v==None: continue
            request[k] = v
        self.create(self.execute(request, session))
        return self.trade_rates
526953
def _comparison_generator(old_list, new_list, compare_fn):
    
    old_index = 0
    new_index = 0
    while old_index < len(old_list) and new_index < len(new_list):
        old_value = old_list[old_index]
        new_value = new_list[new_index]

        status = compare_fn(old_value, new_value)
        if status == 0:
            yield (old_value, new_value,)
            old_index += 1
            new_index += 1
        elif status == -1:
            yield (old_value, None,)
            old_index += 1
        else:
            yield (None, new_value,)
            new_index += 1

    # Catch leftovers. Only one of these while statements should run.
    while old_index < len(old_list):
        yield (old_list[old_index], None,)
        old_index += 1
    while new_index < len(new_list):
        yield (None, new_list[new_index],)
        new_index += 1
872539
def _sublist(items, starting_value, ending_value=None):
        
        have_started = starting_value is None

        for x in items:
            have_started = have_started or x == starting_value
            if have_started:
                yield x

            if ending_value is not None and x == ending_value:
                break
678858
def get_all(symbol):
    
    ids = \
        'ydb2r1b3qpoc1d1cd2c6t1k2p2c8m5c3m6gm7hm8k1m3lm4l1t8w1g1w4g3p' \
        '1g4mg5m2g6kvjj1j5j3k4f6j6nk5n4ws1xj2va5b6k3t7a2t615l2el3e7v1' \
        'e8v7e9s6b4j4p5p6rr2r5r6r7s7'
    values = _request(symbol, ids).split(',')
    return dict(
        dividend_yield=values[0],
        dividend_per_share=values[1],
        ask_realtime=values[2],
        dividend_pay_date=values[3],
        bid_realtime=values[4],
        ex_dividend_date=values[5],
        previous_close=values[6],
        today_open=values[7],
        change=values[8],
        last_trade_date=values[9],
        change_percent_change=values[10],
        trade_date=values[11],
        change_realtime=values[12],
        last_trade_time=values[13],
        change_percent_realtime=values[14],
        change_percent=values[15],
        after_hours_change_realtime=values[16],
        change_200_sma=values[17],
        todays_low=values[18],
        change_50_sma=values[19],
        todays_high=values[20],
        percent_change_50_sma=values[21],
        last_trade_realtime_time=values[22],
        fifty_sma=values[23],
        last_trade_time_plus=values[24],
        twohundred_sma=values[25],
        last_trade_price=values[26],
        one_year_target=values[27],
        todays_value_change=values[28],
        holdings_gain_percent=values[29],
        todays_value_change_realtime=values[30],
        annualized_gain=values[31],
        price_paid=values[32],
        holdings_gain=values[33],
        todays_range=values[34],
        holdings_gain_percent_realtime=values[35],
        todays_range_realtime=values[36],
        holdings_gain_realtime=values[37],
        fiftytwo_week_high=values[38],
        more_info=values[39],
        fiftytwo_week_low=values[40],
        market_cap=values[41],
        change_from_52_week_low=values[42],
        market_cap_realtime=values[43],
        change_from_52_week_high=values[44],
        float_shares=values[45],
        percent_change_from_52_week_low=values[46],
        company_name=values[47],
        percent_change_from_52_week_high=values[48],
        notes=values[49],
        fiftytwo_week_range=values[50],
        shares_owned=values[51],
        stock_exchange=values[52],
        shares_outstanding=values[53],
        volume=values[54],
        ask_size=values[55],
        bid_size=values[56],
        last_trade_size=values[57],
        ticker_trend=values[58],
        average_daily_volume=values[59],
        trade_links=values[60],
        order_book_realtime=values[61],
        high_limit=values[62],
        eps=values[63],
        low_limit=values[64],
        eps_estimate_current_year=values[65],
        holdings_value=values[66],
        eps_estimate_next_year=values[67],
        holdings_value_realtime=values[68],
        eps_estimate_next_quarter=values[69],
        revenue=values[70],
        book_value=values[71],
        ebitda=values[72],
        price_sales=values[73],
        price_book=values[74],
        pe=values[75],
        pe_realtime=values[76],
        peg=values[77],
        price_eps_estimate_current_year=values[78],
        price_eps_estimate_next_year=values[79],
        short_ratio=values[80],
    )
1273465
def list(self, search_from=None, search_to=None, limit=None):
        
        l = []
        for i in self._list():
            l.append(i['data']['data'])
        return l[0:limit]
173453
def mget_list(item, index):
    ''
    if isinstance(index, (int, slice)):
        return item[index]
    else:
        return map(item.__getitem__, index)
903757
def item_lister(command, _connection, page_size, page_number, sort_by,
    sort_order, item_class, result_set, **kwargs):
    
    # pylint: disable=R0913
    page = page_number
    while True:
        item_collection = _connection.get_list(command,
                                             page_size=page_size,
                                             page_number=page,
                                             sort_by=sort_by,
                                             sort_order=sort_order,
                                             item_class=item_class,
                                             **kwargs)
        result_set.total_count = item_collection.total_count
        result_set.page_number = page
        for item in item_collection.items:
            yield item
        if item_collection.total_count < 0 or item_collection.page_size == 0:
            break
        if len(item_collection.items) > 0:
            page += 1
        else:
            break
649956
def orders(self) -> List[Order]:
        
        return list(
            trade.order for trade in self.wrapper.trades.values())
1156881
function getList(getList, list, cb) {
			
			/* set route from config and run middleware */
			debug.sockets('run list', getList.key);
			
			if(globalOnlyRoutes && globalOnlyRoutes.indexOf(getList.key) < 0) {
				return cb({
					path: getList.path, 
					success: false, 
					error: 'Not Allowed'
				});
			}
			
			if(globalExcludeRoutes && globalExcludeRoutes.indexOf(getList.key) > -1) {
				return cb({
					path: getList.path, 
					success: false, 
					error: 'Not Allowed'
				});
			}
			
			var listConfig = opts.lists[getList.key];
			
			if(_.isObject(listConfig)) {
				var excludes = listConfig.exclude ? listConfig.exclude.split(/[\s,]+/) : [];
				if(excludes.indexOf('list') > -1) {
					return cb({
						path: getList.path, 
						success: false, 
						error: 'Not Allowed'
					});
				}
			}
			
			var me = configMe(opts, getList.key, 'list', false,  live);
			
			debug.sockets('runAction for me', me);
											
			list.list = getList;
			// add opts
			list.list.apiOptions = opts;
			
			runAction.call(live, me, list, socket, function(err) {
				debug.sockets('## runAction callback for ' + list.list.key);
				if(err) {
					debug.sockets( '#### Err  ', err);
					cb({
						path: getList.path, 
						success: false, 
						error: err.message
					});
				} else {
					me.route.call(live, list, req, socket, function(err, docs) {
						debug.sockets('got docs from list... run postware',list.list.key, err);
						if(docs) {
							runPostware.call(live, list.list.path, docs, socket, me.postware, function(err, a, manipulatedDocs, b) {
								debug.sockets('done.. send docs',list.list.key, err);
								// send data to listeners
								cb({
									path: getList.path, 
									data: manipulatedDocs || docs, 
									success: true
								});
							});
						} else {
							// fail
							debug.sockets('## FAIL ## in route call');
							cb({
								path: getList.path, 
								success: false, 
								error: err.message
							});
						}
					});
				}
			});
		}
223695
def items(self):
		

		L = []
		def aux(node, s):
			s = s + node.char
			if node.output is not nil:
				L.append((s, node.output))

			for child in node.children.values():
				if child is not node:
					aux(child, s)

		aux(self.root, '')
		return iter(L)
1105139
def items(self):
        ''' 
        '''
        if type(self.transaction['items']['item']) == list:
            return self.transaction['items']['item']
        else:
            return [self.transaction['items']['item'],]
1033143
def items(self):
        
        for c in self._all_combos():
            _, value = _getitem(self.cube, c)
            yield c, value
1263515
def flat_list(lst):
    
    if isinstance(lst, list):
        for item in lst:
            for i in flat_list(item):
                yield i
    else:
        yield lst