From 5354165c7fccaf40ec4ee57e3489c09690f88aad Mon Sep 17 00:00:00 2001 From: GijsTimmers Date: Tue, 6 Jan 2015 14:22:04 +0100 Subject: [PATCH] credited sysexits.h (#55); magic numbers improvement --- communicator.py | 10 ++++++---- tools/errorcodes.py | 4 ++++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/communicator.py b/communicator.py index 8b2c805..ed228e1 100644 --- a/communicator.py +++ b/communicator.py @@ -341,14 +341,16 @@ def print_generic_balk(self, percentage, style, color, stop_color, stop_style): percentagefloat = float(percentage) percentagestring = str(percentage) - lengteVanBalk = 10.0 + lengteVanBalkfloat = 10.0 + lengteVanBalkint = 10 + lengteVanRuimteVoorPercentages = 3 - aantalStreepjesObvPercentage = int(round(percentagefloat/lengteVanBalk)) + aantalStreepjesObvPercentage = int(round(percentagefloat/lengteVanBalkfloat)) print style + "[" + color + \ "=" * aantalStreepjesObvPercentage + stop_color + \ - " " * (10-aantalStreepjesObvPercentage) + \ + " " * (lengteVanBalkint-aantalStreepjesObvPercentage) + \ "] [" + \ - " " * (3 - len(percentagestring)) + \ + " " * (lengteVanRuimteVoorPercentages - len(percentagestring)) + \ color + percentagestring + "%" + \ stop_color + "]" + stop_style diff --git a/tools/errorcodes.py b/tools/errorcodes.py index 7737a46..7d16b4e 100644 --- a/tools/errorcodes.py +++ b/tools/errorcodes.py @@ -16,6 +16,10 @@ ## CA 94042, USA. + +## Derived from /usr/include/sysexits.h + + ## Error numbers begin at BASE to reduce the possibility of ## clashing with other exit statuses that random programs may ## already return. The meaning of the codes is approximately