Merge branch 'bugfix/lint-corrections' into 'dev'

Bugfix/lint corrections

See merge request crafty-controller/crafty-commander!233
This commit is contained in:
Iain Powrie 2022-04-02 19:58:51 +00:00
commit 505f06825a
5 changed files with 21 additions and 19 deletions

View File

@ -322,8 +322,11 @@ class helpers_management:
@staticmethod
def get_schedules_enabled():
# pylint: disable=singleton-comparison
return Schedules.select().where(Schedules.enabled == True).execute()
return (
Schedules.select()
.where(Schedules.enabled == True) # pylint: disable=singleton-comparison
.execute()
)
# **********************************************************************************
# Backups Methods
@ -435,12 +438,9 @@ class helpers_management:
@staticmethod
def clear_unexecuted_commands():
Commands.update(
{
Commands.executed: True
# pylint: disable=singleton-comparison
}
).where(Commands.executed == False).execute()
Commands.update({Commands.executed: True}).where(
Commands.executed == False # pylint: disable=singleton-comparison
).execute()
management_helper = helpers_management()

View File

@ -227,8 +227,9 @@ class Permissions_Servers:
def get_server_user_list(server_id):
final_users = []
server_roles = Role_Servers.select().where(Role_Servers.server_id == server_id)
# pylint: disable=singleton-comparison
super_users = Users.select().where(Users.superuser == True)
super_users = Users.select().where(
Users.superuser == True # pylint: disable=singleton-comparison
)
for role in server_roles:
users = User_Roles.select().where(User_Roles.role_id == role.role_id)
for user in users:

View File

@ -260,8 +260,7 @@ class helper_servers:
@staticmethod
def is_crashed(server_id):
svr = Server_Stats.select().where(Server_Stats.server_id == server_id).get()
# pylint: disable=singleton-comparison
if svr.crashed == True:
if svr.crashed is True:
return True
else:
return False

View File

@ -221,8 +221,9 @@ class helper_users:
@staticmethod
def get_super_user_list():
final_users = []
# pylint: disable=singleton-comparison
super_users = Users.select().where(Users.superuser == True)
super_users = Users.select().where(
Users.superuser == True # pylint: disable=singleton-comparison
)
for suser in super_users:
if suser.user_id not in final_users:
final_users.append(suser.user_id)
@ -251,8 +252,9 @@ class helper_users:
@staticmethod
def clear_support_status():
# pylint: disable=singleton-comparison
Users.update(preparing=False).where(Users.preparing == True).execute()
Users.update(preparing=False).where(
Users.preparing == True # pylint: disable=singleton-comparison
).execute()
@staticmethod
def user_id_exists(user_id):

View File

@ -21,12 +21,12 @@ class MainPrompt(cmd.Cmd):
# overrides the default Prompt
prompt = f"Crafty Controller v{helper.get_version_string()} > "
# see MR !233 for pylint exemptino reason
@staticmethod
def emptyline():
def emptyline(): # pylint: disable=arguments-differ
pass
# pylint: disable=unused-argument
def do_exit(self, line):
def do_exit(self, _line):
self.tasks_manager._main_graceful_exit()
self.universal_exit()