# HG changeset patch # User Dennis Fink # Date 2016-05-16 14:33:54 # Node ID 85e51fafd8b355a1c944886bf441a5fda89420ac # Parent 0ef190ed951e5955b2f527ed2f71b20fd45dfe36 # Parent f75ba5c69103b3a04ab429b42de8caa5227704fd Merged hotfix-ennstatuscli-key-error diff --git a/ennstatus/cli/commands/stats.py b/ennstatus/cli/commands/stats.py --- a/ennstatus/cli/commands/stats.py +++ b/ennstatus/cli/commands/stats.py @@ -182,22 +182,27 @@ def exit_probability(obj, by_server): exit_probability = defaultdict(int) for server in servers['exit']: for subkey in ('1_week', '1_month', '3_months', '1_year', '5_years'): - if server.mean_exit_probability[subkey] is not None: - exit_probability[subkey] += server.mean_exit_probability[subkey] - + try: + if server.mean_exit_probability[subkey] is not None: + exit_probability[subkey] += server.mean_exit_probability[subkey] + except KeyError: + continue for subkey in ('1_week', '1_month', '3_months', '1_year', '5_years'): - click.echo( - 'Mean exit probability over %s: %s' % ( - click.style( - subkey, - fg='blue' - ), - click.style( - str(round(exit_probability[subkey], 2)) + '%', - fg='red' + try: + click.echo( + 'Mean exit probability over %s: %s' % ( + click.style( + subkey, + fg='blue' + ), + click.style( + str(round(exit_probability[subkey], 2)) + '%', + fg='red' + ) ) ) - ) + except KeyError: + continue else: for server in servers['exit']: click.echo( @@ -209,16 +214,19 @@ def exit_probability(obj, by_server): ) ) for subkey in ('1_week', '1_month', '3_months', '1_year', '5_years'): - if server.mean_exit_probability[subkey] is not None: - click.echo( - 'Mean exit probabilty over %s: %s' % ( - click.style( - subkey, - fg='blue' - ), - click.style( - str(round(server.mean_exit_probability[subkey], 2)) + "%", - fg='red' + try: + if server.mean_exit_probability[subkey] is not None: + click.echo( + 'Mean exit probabilty over %s: %s' % ( + click.style( + subkey, + fg='blue' + ), + click.style( + str(round(server.mean_exit_probability[subkey], 2)) + "%", + fg='red' + ) ) ) - ) + except KeyError: + continue diff --git a/setup.py b/setup.py --- a/setup.py +++ b/setup.py @@ -11,7 +11,7 @@ def _get_requirements(): setup(name='Ennstatus', - version='5.4.5', + version='5.4.6', description=('Ennstatus provides the user with vital information about ' 'the status of the organizations Tor servers.'), author='Frënn vun der Ënn',