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

All Samples(7646)  |  Call(7646)  |  Derive(0)  |  Import(0)
L.sort(cmp=None, key=None, reverse=False) -- stable sort *IN PLACE*;
cmp(x, y) -> -1, 0, 1

src/s/o/socorro-HEAD/webapp-django/vendor/lib/python/django/contrib/gis/geos/mutable_list.py   socorro(Download)
    def sort(self, cmp=None, key=None, reverse=False):
        "Standard list sort method"
        if key:
            temp = [(key(v),v) for v in self]
            temp.sort(key=lambda x: x[0], reverse=reverse)
            self[:] = [v[1] for v in temp]
        else:
            temp = list(self)
            if cmp is not None:
                temp.sort(cmp=cmp, reverse=reverse)
                temp.sort(cmp=cmp, reverse=reverse)
            else:
                temp.sort(reverse=reverse)
            self[:] = temp
 

src/o/h/oh-mainline-HEAD/mysite/base/views.py   oh-mainline(Download)
    feed_items.extend(
        mysite.search.models.WannaHelperNote.objects.order_by('-modified_date')[:5])
    feed_items.sort(key=lambda x: x.modified_date, reverse=True)
    data['recent_feed_items'] = feed_items[:5]
    return data

src/o/h/oh-mainline-HEAD/mysite/base/feeds.py   oh-mainline(Download)
    def items(self):
        feed_items = list(Answer.objects.order_by('-modified_date')[:15])
        feed_items.extend(
            WannaHelperNote.objects.order_by('-modified_date')[:15])
        feed_items.sort(key=lambda x: x.modified_date, reverse=True)

src/s/p/spring-replay-site-HEAD/srs/models.py   spring-replay-site(Download)
        for game in Game.objects.all():
            games.append((game.id, Replay.objects.filter(gametype__in=game.gamerelease_set.values_list("name", flat=True)).count()))
        games.sort(key=operator.itemgetter(1), reverse=True)
        timer.stop("games")
 
            nummatches =  Player.objects.filter(account=pa, spectator=False, replay__unixTime__range=(start_date, now)).count()
            active_players.append((nummatches, pa))
        active_players.sort(key=operator.itemgetter(0), reverse=True)
        timer.stop("active_players")
 

src/u/n/unknown-horizons-HEAD/horizons/world/units/collectors/collector.py   unknown-horizons(Download)
	def _sort_jobs_amount(self):
		"""Sorts the jobs by the amount of resources available"""
		self.sort(key=operator.attrgetter('amount_sum'), reverse=True)
 
	def _sort_jobs_fewest_available(self, shuffle_first=True):
			self.collector.session.random.shuffle(self)
		inventory = self.collector.get_home_inventory()
		self.sort(key=lambda job: min(inventory[res] for res in job.resources), reverse=False)
 
	def _sort_jobs_fewest_available_and_distance(self):
	def _sort_jobs_distance(self):
		"""Prefer targets that are nearer"""
		collector_point = self.collector.position
		self.sort(key=lambda job: collector_point.distance(job.object.loading_area))
 
	def _sort_target_inventory_full(self):
		"""Prefer targets with full inventory"""
		self.sort(key=operator.attrgetter('target_inventory_full_num'), reverse=True)

src/c/a/captain-HEAD/vendor/lib/python/django/contrib/gis/geos/mutable_list.py   captain(Download)
    def sort(self, cmp=None, key=None, reverse=False):
        "Standard list sort method"
        if key:
            temp = [(key(v),v) for v in self]
            temp.sort(key=lambda x: x[0], reverse=reverse)
            self[:] = [v[1] for v in temp]
        else:
            temp = list(self)
            if cmp is not None:
                temp.sort(cmp=cmp, reverse=reverse)
                temp.sort(cmp=cmp, reverse=reverse)
            else:
                temp.sort(reverse=reverse)
            self[:] = temp
 

src/d/j/django-mobile-app-distribution-0.2/django_mobile_app_distribution/views.py   django-mobile-app-distribution(Download)
			apps.append(group_app)
 
	apps.sort(key=attrgetter('build_date'), reverse=True)
	apps.sort(key=attrgetter('version'), reverse=True)
	apps.sort(key=attrgetter('operating_system'), reverse=True) # let iOS come first
	apps.sort(key=attrgetter('name'))	

src/p/l/playdoh-lib-HEAD/lib/python/django/contrib/gis/geos/mutable_list.py   playdoh-lib(Download)
    def sort(self, cmp=None, key=None, reverse=False):
        "Standard list sort method"
        if key:
            temp = [(key(v),v) for v in self]
            temp.sort(key=lambda x: x[0], reverse=reverse)
            self[:] = [v[1] for v in temp]
        else:
            temp = list(self)
            if cmp is not None:
                temp.sort(cmp=cmp, reverse=reverse)
                temp.sort(cmp=cmp, reverse=reverse)
            else:
                temp.sort(reverse=reverse)
            self[:] = temp
 

src/s/y/sympy-HEAD/sympy/printing/repr.py   sympy(Download)
    def _print_PolyElement(self, poly):
        terms = list(poly.terms())
        terms.sort(key=poly.ring.order, reverse=True)
        return "%s(%s, %s)" % (poly.__class__.__name__, self._print(poly.ring), self._print(terms))
 
    def _print_FracElement(self, frac):
        numer_terms = list(frac.numer.terms())
        numer_terms.sort(key=frac.field.order, reverse=True)
        denom_terms = list(frac.denom.terms())
        denom_terms.sort(key=frac.field.order, reverse=True)

src/b/u/build-cloud-tools-HEAD/scripts/aws_manage_subnets.py   build-cloud-tools(Download)

Previous  7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15  Next