From 9b8b0b63395b073ea1eb4baafcdbe02c7426fd06 Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Mon, 17 Feb 2020 23:04:39 -0800 Subject: [PATCH] Replace else-if with elif. --- voussoirkit/ratelimiter.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/voussoirkit/ratelimiter.py b/voussoirkit/ratelimiter.py index 0675632..02c2ad2 100644 --- a/voussoirkit/ratelimiter.py +++ b/voussoirkit/ratelimiter.py @@ -52,15 +52,16 @@ class Ratelimiter: if self.balance >= cost: self.balance -= cost successful = True + + elif self.mode == 'reject': + successful = False + else: - if self.mode == 'reject': - successful = False - else: - deficit = cost - self.balance - time_needed = deficit / self.gain_rate - time.sleep(time_needed) - self.balance = 0 - successful = True + deficit = cost - self.balance + time_needed = deficit / self.gain_rate + time.sleep(time_needed) + self.balance = 0 + successful = True self.last_operation = time.time() return successful