chore: add .pylint and clean up code
This commit is contained in:
parent
4d398654cb
commit
a3329c0a7f
5
server/.pylintrc
Normal file
5
server/.pylintrc
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
[MASTER]
|
||||||
|
init-hook='import sys; sys.path.append("src")'
|
||||||
|
|
||||||
|
[MESSAGES CONTROL]
|
||||||
|
disable=R0903,C0114,C0115,C0116
|
@ -1,6 +1,6 @@
|
|||||||
|
from datetime import datetime
|
||||||
from sqlalchemy.ext.declarative import declarative_base
|
from sqlalchemy.ext.declarative import declarative_base
|
||||||
from sqlalchemy import Column, Integer, String, DateTime
|
from sqlalchemy import Column, Integer, String, DateTime
|
||||||
from datetime import datetime
|
|
||||||
|
|
||||||
Base = declarative_base()
|
Base = declarative_base()
|
||||||
|
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
import json
|
import json
|
||||||
import socket
|
import socket
|
||||||
import threading
|
import threading
|
||||||
|
from datetime import datetime
|
||||||
|
from loguru import logger
|
||||||
|
|
||||||
import database
|
import database
|
||||||
from database.models import Agent
|
from database.models import Agent
|
||||||
from utils.config import load_yaml_config
|
from utils.config import load_yaml_config
|
||||||
from loguru import logger
|
|
||||||
from datetime import datetime
|
|
||||||
|
|
||||||
|
|
||||||
class Server:
|
class Server:
|
||||||
@ -61,9 +62,6 @@ class Server:
|
|||||||
conn (socket.socket): The socket object for the connection to the
|
conn (socket.socket): The socket object for the connection to the
|
||||||
agent.
|
agent.
|
||||||
addr (tuple): The address of the agent.
|
addr (tuple): The address of the agent.
|
||||||
|
|
||||||
Raises:
|
|
||||||
Exception: If there is an error handling the agent.
|
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
agent_info = json.loads(conn.recv(1024).decode())
|
agent_info = json.loads(conn.recv(1024).decode())
|
||||||
|
@ -17,9 +17,10 @@ def load_yaml_config(file_path):
|
|||||||
dict: A dictionary containing the configuration data.
|
dict: A dictionary containing the configuration data.
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
with open(file_path, "r") as f:
|
with open(file_path, "r", encoding="utf-8") as f:
|
||||||
config = yaml.safe_load(f)
|
config = yaml.safe_load(f)
|
||||||
except Exception as e:
|
except Exception:
|
||||||
|
# TODO: Log error
|
||||||
config = {
|
config = {
|
||||||
"host": "0.0.0.0",
|
"host": "0.0.0.0",
|
||||||
"port": 9999
|
"port": 9999
|
||||||
|
Loading…
Reference in New Issue
Block a user