Rearrange imports

Just sorting imports
This commit is contained in:
Samuel Sloniker 2021-06-20 16:44:03 -07:00
parent 4d5ce06eb6
commit 549cfb10f9

View File

@ -1,17 +1,17 @@
import os
import base64
import threading
import random
import time
import shutil
import tempfile
import tornado.web, tornado.websocket, tornado.ioloop
import imgproc as hcapi
import argon2 import argon2
import asyncio import asyncio
import base64
import imgproc
import importlib import importlib
import os
import parse_config import parse_config
import random
import shutil
import sys import sys
import tempfile
import threading
import time
import tornado.web, tornado.websocket, tornado.ioloop
try: try:
conf = sys.argv[1] conf = sys.argv[1]
@ -21,9 +21,9 @@ except IndexError:
with open(conf) as f: with open(conf) as f:
config_data = parse_config.load(f) config_data = parse_config.load(f)
hcapi.backend = importlib.import_module(f'backends.{config_data["backend"]}') imgproc.backend = importlib.import_module(f'backends.{config_data["backend"]}')
hcapi.backend.config = config_data imgproc.backend.config = config_data
hcapi.config = config_data imgproc.config = config_data
ph = argon2.PasswordHasher() ph = argon2.PasswordHasher()
@ -42,7 +42,7 @@ class HCRAServer(tornado.websocket.WebSocketHandler):
self.lock = threading.Lock() self.lock = threading.Lock()
self.good = True self.good = True
try: try:
imgname = hcapi.get_full_img() imgname = imgproc.get_full_img()
except Exception as e: except Exception as e:
self.write_message('err%noconn%Server failed to capture screenshot') self.write_message('err%noconn%Server failed to capture screenshot')
return return
@ -97,7 +97,7 @@ class HCRAServer(tornado.websocket.WebSocketHandler):
try: try:
ph.verify(config_data['password_argon2'], password) ph.verify(config_data['password_argon2'], password)
x, y, w, is_long = int(x), int(y), int(w), is_long == 'true' x, y, w, is_long = int(x), int(y), int(w), is_long == 'true'
hcapi.touch(x, y, w, is_long) imgproc.touch(x, y, w, is_long)
except argon2.exceptions.VerifyMismatchError: except argon2.exceptions.VerifyMismatchError:
self.send(f'err%*badpass%Incorrect password', 'BADPASS') self.send(f'err%*badpass%Incorrect password', 'BADPASS')
self.close() self.close()
@ -108,7 +108,7 @@ class HCRAServer(tornado.websocket.WebSocketHandler):
def cycle(): def cycle():
try: try:
changed = hcapi.get_split_imgs() changed = imgproc.get_split_imgs()
except Exception as e: except Exception as e:
if client is not None: if client is not None:
client.send('err%noconn%Server failed to capture screenshot', 'ERR') client.send('err%noconn%Server failed to capture screenshot', 'ERR')