Skip to content

Commit 9553013

Browse files
Change methods not using its bound instance to staticmethods
1 parent d2b4bb2 commit 9553013

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

server/db/admin/crud_subjects.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ def delete_collection(self):
4141
except:
4242
return False
4343

44-
def get_collections(self):
44+
@staticmethod
45+
def get_collections():
4546
try:
4647
results = subject_db.collection_names()
4748
string_results = " "

server/db/admin/crud_users.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ def add_teacher(self):
6868
except:
6969
return False
7070

71-
def delete_teacher(self, email, user_name):
71+
@staticmethod
72+
def delete_teacher(email, user_name):
7273
results = []
7374
for result in auth_collection_sign_in.find(
7475
{"User Name": user_name, "Email": email, "Role": "Teacher"}
@@ -93,7 +94,8 @@ def get_data_of_teacher(user_name, email):
9394
return [False, results]
9495
return [True, results]
9596

96-
def update_teacher(self, new_info: dict, old_info: dict):
97+
@staticmethod
98+
def update_teacher(new_info: dict, old_info: dict):
9799
# si1 = Sign_In(
98100
# user_name=new_info["User Name"],
99101
# password_or_email=new_info["Password"],
@@ -209,15 +211,17 @@ def add_student(self):
209211
)
210212
return [True, "New Student Created ! "]
211213

212-
def delete_student(self, infos: list):
214+
@staticmethod
215+
def delete_student(infos: list):
213216
for info in infos:
214217
try:
215218
auth_collection_sign_in.delete_one(info)
216219
except:
217220
pass
218221
return True
219222

220-
def get_students(self):
223+
@staticmethod
224+
def get_students():
221225
try:
222226
results = []
223227
for result in auth_collection_sign_in.find({"Role": "Student"}):
@@ -226,7 +230,8 @@ def get_students(self):
226230
except:
227231
return [False, ""]
228232

229-
def update_student(self, new_info: dict, old_info: dict):
233+
@staticmethod
234+
def update_student(new_info: dict, old_info: dict):
230235
# si1 = Sign_In(
231236
# user_name=new_info["User Name"],
232237
# password_or_email=new_info["Password"],

server/db/admin/sms.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ def get_balance(self):
5656
balance = requests.post(url, {"user_id": self.user_id, "api_key": self.api_key})
5757
return balance.json()["result"]["account_balance"]
5858

59-
def add_balance(self, amount):
59+
@staticmethod
60+
def add_balance(amount):
6061
# +94718024596 is the phone number of the person who updates the price.
6162
sms = SMS(
6263
phone_numbers=["+94718024596"],

0 commit comments

Comments
 (0)