~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to scripts/ftpmaster-tools/sync-source.py

  • Committer: Jeroen Vermeulen
  • Date: 2011-09-26 06:30:07 UTC
  • mto: This revision was merged to the branch mainline in revision 14049.
  • Revision ID: jeroen.vermeulen@canonical.com-20110926063007-1fb5eelnidpnra9a
Fix lots of lint in recently-changed files.

Show diffs side-by-side

added added

removed removed

Lines of Context:
558
558
               current_sources, current_binaries)
559
559
 
560
560
 
 
561
class Percentages:
 
562
    """Helper to compute percentage ratios compared to a fixed total."""
 
563
 
 
564
    def __init__(self, total):
 
565
        self.total = total
 
566
 
 
567
    def get_ratio(self, number):
 
568
        """Report the ration of `number` to `self.total`, as a percentage."""
 
569
        return (float(number) / self.total) * 100
 
570
 
 
571
 
561
572
def do_diff(Sources, Suite, origin, arguments, current_binaries):
562
573
    stat_us = 0
563
574
    stat_cant_update = 0
622
633
                        % (pkg, dest_version, source_version))
623
634
 
624
635
    if Options.all:
 
636
        percentages = Percentages(stat_count)
625
637
        print
626
638
        print ("Out-of-date BUT modified: %3d (%.2f%%)"
627
 
               % (stat_cant_update, (float(stat_cant_update)/stat_count)*100))
 
639
            % (stat_cant_update, percentages.get_ratio(stat_cant_update)))
628
640
        print ("Updated:                  %3d (%.2f%%)"
629
 
               % (stat_updated, (float(stat_updated)/stat_count)*100))
 
641
            % (stat_updated, percentages.get_ratio(stat_updated)))
630
642
        print ("Ubuntu Specific:          %3d (%.2f%%)"
631
 
               % (stat_us, (float(stat_us)/stat_count)*100))
 
643
            % (stat_us, percentages.get_ratio(stat_us)))
632
644
        print ("Up-to-date [Modified]:    %3d (%.2f%%)"
633
 
               % (stat_uptodate_modified,
634
 
                  (float(stat_uptodate_modified)/stat_count)*100))
 
645
            % (stat_uptodate_modified, percentages.get_ratio(
 
646
                stat_uptodate_modified)))
635
647
        print ("Up-to-date:               %3d (%.2f%%)"
636
 
               % (stat_uptodate, (float(stat_uptodate)/stat_count)*100))
 
648
               % (stat_uptodate, percentages.get_ratio(stat_uptodate)))
637
649
        print ("Blacklisted:              %3d (%.2f%%)"
638
 
               % (stat_blacklisted, (float(stat_blacklisted)/stat_count)*100))
 
650
               % (stat_blacklisted, percentages.get_ratio(stat_blacklisted)))
639
651
        print ("Broken:                   %3d (%.2f%%)"
640
 
               % (stat_broken, (float(stat_broken)/stat_count)*100))
 
652
               % (stat_broken, percentages.get_ratio(stat_broken)))
641
653
        print "                          -----------"
642
654
        print "Total:                    %s" % (stat_count)
643
655