From 671ed228a57e23f1141f3328cd10087060ec5700 Mon Sep 17 00:00:00 2001 From: Sourcery AI Date: Thu, 28 May 2020 17:49:13 +0000 Subject: [PATCH] Refactored by Sourcery --- data_entry_screen.py | 7 +------ init_screen.py | 7 +------ screens.py | 14 ++------------ 3 files changed, 4 insertions(+), 24 deletions(-) diff --git a/data_entry_screen.py b/data_entry_screen.py index 052190a..184bdc6 100644 --- a/data_entry_screen.py +++ b/data_entry_screen.py @@ -48,12 +48,7 @@ def __init__(self, parent, controller, pages): self.enterData.place(x=500, y=600) def only_numeric_input(self, e): - if e.isdigit(): - return True - elif e == "": - return False - else: - return False + return bool(e.isdigit()) def finalValidation(self): marks = self.t4.get() diff --git a/init_screen.py b/init_screen.py index 3f63a51..27a5468 100644 --- a/init_screen.py +++ b/init_screen.py @@ -109,9 +109,4 @@ def submit(self): self.controller.show_frame("DataScreen") def only_numeric_input(self, e): - if e.isdigit(): - return True - elif e == "": - return True - else: - return False + return bool(e.isdigit() or not e.isdigit() and e == "") diff --git a/screens.py b/screens.py index 8227f4e..9a28c02 100644 --- a/screens.py +++ b/screens.py @@ -125,12 +125,7 @@ def submit(): continue_button.place(x=400, y=470, width=150, height=40) def only_numeric_input(self, e): - if e.isdigit(): - return True - elif e == "": - return True - else: - return False + return bool(e.isdigit() or not e.isdigit() and e == "") def all_children(self, window): _list = window.winfo_children() @@ -195,12 +190,7 @@ def submit(): enter_button.place(x=200, y=300, width=150, height=40) def only_numeric_input(self, e): - if e.isdigit(): - return True - elif e == "": - return True - else: - return False + return bool(e.isdigit() or not e.isdigit() and e == "") if __name__ == "__main__":