mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2025-01-19 09:45:28 +01:00
Appease the linter
This commit is contained in:
parent
11278ebe5f
commit
d760fcb010
@ -1,8 +1,7 @@
|
||||
import os
|
||||
import psutil
|
||||
import pprint
|
||||
import socket
|
||||
import time
|
||||
import psutil
|
||||
|
||||
class BedrockPing:
|
||||
magic = b'\x00\xff\xff\x00\xfe\xfe\xfe\xfe\xfd\xfd\xfd\xfd\x12\x34\x56\x78'
|
||||
@ -39,11 +38,11 @@ class BedrockPing:
|
||||
ret = []
|
||||
bi = 0 # bytes index
|
||||
pi = 0 # pattern index
|
||||
while(bi < len(in_bytes)):
|
||||
while bi < len(in_bytes):
|
||||
try:
|
||||
f = BedrockPing.fields[pattern[pi]]
|
||||
except IndexError:
|
||||
raise IndexError("Ran out of pattern with additional bytes remaining")
|
||||
except IndexError as index_error:
|
||||
raise IndexError("Ran out of pattern with additional bytes remaining") from index_error
|
||||
if pattern[pi] == "string":
|
||||
shl = f[0] # string header length
|
||||
sl = int.from_bytes(in_bytes[bi:bi+shl], BedrockPing.byte_order, signed=f[1]) # string length
|
||||
@ -73,7 +72,6 @@ class BedrockPing:
|
||||
self.sock.sendto(d2s, (self.addr, self.port))
|
||||
|
||||
def __recvpong(self):
|
||||
t_start = time.perf_counter()
|
||||
data = self.sock.recv(4096)
|
||||
if data[0] == 0x1c:
|
||||
ret = {}
|
||||
|
@ -179,4 +179,3 @@ def ping_bedrock(ip, port):
|
||||
return brp.ping()
|
||||
except socket.timeout:
|
||||
logger.debug("Unable to get RakNet stats")
|
||||
|
||||
|
@ -163,7 +163,6 @@ class Stats:
|
||||
|
||||
@staticmethod
|
||||
def parse_server_RakNet_ping(ping_obj: object):
|
||||
online_stats = {}
|
||||
|
||||
try:
|
||||
server_icon = base64.encodebytes(ping_obj['icon'])
|
||||
|
@ -577,7 +577,8 @@ class Server:
|
||||
logger.info(f"Starting server {self.name} (ID {self.server_id}) backup")
|
||||
server_users = server_permissions.get_server_user_list(self.server_id)
|
||||
for user in server_users:
|
||||
websocket_helper.broadcast_user(user, 'notification', translation.translate('notify', 'backupStarted', users_helper.get_user_lang_by_id(user)) + self.name)
|
||||
websocket_helper.broadcast_user(user, 'notification', translation.translate('notify',
|
||||
'backupStarted', users_helper.get_user_lang_by_id(user)) + self.name)
|
||||
time.sleep(3)
|
||||
self.is_backingup = True
|
||||
conf = management_helper.get_backup_config(self.server_id)
|
||||
@ -617,7 +618,8 @@ class Server:
|
||||
logger.info(f"Backup of server: {self.name} completed")
|
||||
server_users = server_permissions.get_server_user_list(self.server_id)
|
||||
for user in server_users:
|
||||
websocket_helper.broadcast_user(user, 'notification', translation.translate('notify', 'backupComplete', users_helper.get_user_lang_by_id(user)) + self.name)
|
||||
websocket_helper.broadcast_user(user, 'notification', translation.translate('notify', 'backupComplete',
|
||||
users_helper.get_user_lang_by_id(user)) + self.name)
|
||||
time.sleep(3)
|
||||
return
|
||||
except:
|
||||
|
Loading…
x
Reference in New Issue
Block a user