Prints the league standings in a pretty way
764895
def standings(self, league_table, league):
        
        click.secho("%-6s  %-30s    %-10s    %-10s    %-10s" %
                    ("POS", "CLUB", "PLAYED", "GOAL DIFF", "POINTS"))
        for team in league_table["standings"][0]["table"]:
            if team["goalDifference"] >= 0:
                team["goalDifference"] = ' ' + str(team["goalDifference"])

            # Define the upper and lower bounds for Champions League,
            # Europa League and Relegation places.
            # This is so we can highlight them appropriately.
            cl_upper, cl_lower = LEAGUE_PROPERTIES[league]['cl']
            el_upper, el_lower = LEAGUE_PROPERTIES[league]['el']
            rl_upper, rl_lower = LEAGUE_PROPERTIES[league]['rl']
            team['teamName'] = team['team']['name']
            team_str = (u"{position:<7} {teamName:<33} {playedGames:<12}"
                        u" {goalDifference:<14} {points}").format(**team)
            if cl_upper <= team["position"] <= cl_lower:
                click.secho(team_str, bold=True, fg=self.colors.CL_POSITION)
            elif el_upper <= team["position"] <= el_lower:
                click.secho(team_str, fg=self.colors.EL_POSITION)
            elif rl_upper <= team["position"] <= rl_lower:
                click.secho(team_str, fg=self.colors.RL_POSITION)
            else:
                click.secho(team_str, fg=self.colors.POSITION)
481760
def to_s
      res = ""
      res << "#{self.gamedays.size.to_s} gamedays\n"
      self.gamedays.each do |gd|
        res << gd.date.strftime("%Y-%m-%d") + "\n"
        res << "==========\n"
        gd.games.sort{|g1,g2| g1.gt == g2.gt ? g1.ps <=> g2.ps : g1.gt <=> g2.gt}.each do |g|
          res << "#{g.ta.to_s} VS #{g.tb.to_s} on playing surface #{g.ps} at #{g.gt.strftime("%I:%M %p")}\n"
        end
        res << "\n"
      end
      res
    end
1092228
def print_stats
      fmh = " %-20s | %10s | %5s | %6s | %6s | %6s | %-20s\n"
      fmt = " %-20s | %10.3f | %5i | %6.3f | %6.3f | %6.3f | %s\n"
      head = sprintf(fmh, 
                     "class", "total", "count", "min", "max", "avg", "callers")
      line = "-" * head.length  
      puts line
      print head
      puts line
      @loading_stats.sort_by { |key, val| 
        val[:total_time] 
      }.reverse.each { |key, val|
        key = key.to_s
        if(key.length > 20)
          key = key[-20,20]
        end
        avg = val[:total_time] / val[:count]
        printf(fmt, key, val[:total_time], val[:count],
               val[:times].min, val[:times].max, avg,
               val[:callers].join(','))
      }
      puts line
      $stdout.flush
    end
457894
def print_linescore
    	bs = get_boxscore
    	output = ''
    	if bs.linescore 
      	output += self.visit_team_name + ' ' + bs.linescore.away_team_runs + ' ' + bs.linescore.away_team_hits + ' ' + bs.linescore.away_team_errors + "\n"
      	output += self.home_team_name + ' ' + bs.linescore.home_team_runs + ' ' + bs.linescore.home_team_hits + ' ' + bs.linescore.home_team_errors
      else
      	output += 'No linescore available for ' + @visit_team_name + ' vs. ' + @home_team_name
      end
      output
    end
872018
def live_scores(self, live_scores):
        """"""
        scores = sorted(live_scores, key=lambda x: x["league"])
        for league, games in groupby(scores, key=lambda x: x["league"]):
            self.league_header(league)
            for game in games:
                self.scores(self.parse_result(game), add_new_line=False)
                click.secho('   %s' % Stdout.utc_to_local(game["time"],
                                                          use_12_hour_format=False),
                            fg=self.colors.TIME)
                click.echo()
971947
def prettyprint(d):
        
        print(json.dumps(d, sort_keys=True, 
                         indent=4, separators=("," , ": ")))
515436
def scores(self, result, add_new_line=True):
        """"""
        if result.goalsHomeTeam > result.goalsAwayTeam:
            homeColor, awayColor = (self.colors.WIN, self.colors.LOSE)
        elif result.goalsHomeTeam < result.goalsAwayTeam:
            homeColor, awayColor = (self.colors.LOSE, self.colors.WIN)
        else:
            homeColor = awayColor = self.colors.TIE

        click.secho('%-25s %2s' % (result.homeTeam, result.goalsHomeTeam),
                    fg=homeColor, nl=False)
        click.secho("  vs ", nl=False)
        click.secho('%2s %s' % (result.goalsAwayTeam,
                                result.awayTeam.rjust(25)), fg=awayColor,
                    nl=add_new_line)
901603
def pretty_print(self):
        
        print colored.blue("-" * 40)
        print colored.red("datacats: problem was encountered:")
        print self.message
        print colored.blue("-" * 40)
670369
public function majRankPointChart()
    {
        $teams = $this->findBy(array(), array('pointChart' => 'DESC'));

        $list = array();
        foreach ($teams as $team) {
            $list[] = $team;
        }

        Ranking::addObjectRank($list, 'rankPointChart', array('pointChart'));
        $this->getEntityManager()->flush();
    }
294753
def show(self):
        
        print("StringBlock(stringsCount=0x%x, "
              "stringsOffset=0x%x, "
              "stylesCount=0x%x, "
              "stylesOffset=0x%x, "
              "flags=0x%x"
              ")" % (self.stringCount,
                     self.stringsOffset,
                     self.styleCount,
                     self.stylesOffset,
                     self.flags))

        if self.stringCount > 0:
            print()
            print("String Table: ")
            for i, s in enumerate(self):
                print("{:08d} {}".format(i, repr(s)))

        if self.styleCount > 0:
            print()
            print("Styles Table: ")
            for i in range(self.styleCount):
                print("{:08d} {}".format(i, repr(self.getStyle(i))))
143838
protected void printRanking(final String user, final Map<Long, Double> scoredItems, final PrintStream out, final OUTPUT_FORMAT format) {
        final Map<Double, Set<Long>> preferenceMap = new HashMap<Double, Set<Long>>();
        for (Map.Entry<Long, Double> e : scoredItems.entrySet()) {
            long item = e.getKey();
            double pref = e.getValue();
            // ignore NaN's
            if (Double.isNaN(pref)) {
                continue;
            }
            Set<Long> items = preferenceMap.get(pref);
            if (items == null) {
                items = new HashSet<Long>();
                preferenceMap.put(pref, items);
            }
            items.add(item);
        }
        final List<Double> sortedScores = new ArrayList<Double>(preferenceMap.keySet());
        Collections.sort(sortedScores, Collections.reverseOrder());
        // Write estimated preferences
        int pos = 1;
        for (double pref : sortedScores) {
            for (long itemID : preferenceMap.get(pref)) {
                switch (format) {
                    case TRECEVAL:
                        out.println(user + "\tQ0\t" + itemID + "\t" + pos + "\t" + pref + "\t" + "r");
                        break;
                    default:
                    case SIMPLE:
                        out.println(user + "\t" + itemID + "\t" + pref);
                        break;
                }
                pos++;
            }
        }
    }
348233
def display_breakdown(scores, outfile=None):
    
    total = 0
    outfile = open(outfile, 'w') if outfile else sys.stdout

    format.print_line('-')
    print('Point breakdown', file=outfile)
    for name, (score, max_score) in scores.items():
        print('    {}: {}/{}'.format(name, score, max_score), file=outfile)
        total += score
    print(file=outfile)

    print('Score:', file=outfile)
    print('    Total: {}'.format(total), file=outfile)
    return {'Total': total}
707802
def display(self):
        
        data = []
        first_row = ['Stat']
        first_row.extend(self._names)
        data.append(first_row)

        stats = self._stats()

        for stat in stats:
            k, n, f = stat
            # blank row
            if k is None:
                row = [''] * len(data[0])
                data.append(row)
                continue

            row = [n]
            for key in self._names:
                raw = getattr(self[key], k)

                # if rf is a series print nan
                if k == 'rf' and not type(raw) == float:
                    row.append(np.nan)
                elif f is None:
                    row.append(raw)
                elif f == 'p':
                    row.append(fmtp(raw))
                elif f == 'n':
                    row.append(fmtn(raw))
                elif f == 'dt':
                    row.append(raw.strftime('%Y-%m-%d'))
                else:
                    raise NotImplementedError('unsupported format %s' % f)
            data.append(row)

        print(tabulate(data, headers='firstrow'))
881028
def live_scores(self, live_scores):
        """"""
        headers = ['League', 'Home Team Name', 'Home Team Goals',
                   'Away Team Goals', 'Away Team Name']
        result = [headers]
        result.extend([game['league'], game['homeTeamName'],
                       game['goalsHomeTeam'], game['goalsAwayTeam'],
                       game['awayTeamName']] for game in live_scores['games'])
        self.generate_output(result)
497095
def _display_runner(rows, labels, title, display=_DEFAULT_DISPLAY):
    '''
    
    '''
    if display:
        net_runner_opts = _get_net_runner_opts()
        if net_runner_opts.get('outputter') == 'table':
            ret = salt.output.out_format({'rows': rows, 'labels': labels},
                                         'table',
                                         __opts__,
                                         title=title,
                                         rows_key='rows',
                                         labels_key='labels')
        else:
            ret = salt.output.out_format(rows,
                                         net_runner_opts.get('outputter'),
                                         __opts__)
        print(ret)
    else:
        return rows
1022663
def pretty_print(self):
        """"""
        pt = PrettyTable()
        if len(self) == 0:
            pt._set_field_names(['Sorry,'])
            pt.add_row([TRAIN_NOT_FOUND])
        else:
            pt._set_field_names(self.headers)
            for train in self.trains:
                pt.add_row(train)
        print(pt)
1270033
def team_scores(self, team_scores, time, show_datetime, use_12_hour_format):
        """"""
        for score in team_scores["matches"]:
            if score["status"] == "FINISHED":
                click.secho("%s\t" % score["utcDate"].split('T')[0],
                            fg=self.colors.TIME, nl=False)
                self.scores(self.parse_result(score))
            elif show_datetime:
                self.scores(self.parse_result(score), add_new_line=False)
                click.secho('   %s' % Stdout.utc_to_local(score["utcDate"],
                                                          use_12_hour_format,
                                                          show_datetime),
                            fg=self.colors.TIME)