From b00c442846212a9bbe6e60e1cbd12196812e944c Mon Sep 17 00:00:00 2001 From: Solirs Date: Fri, 30 Jun 2023 17:26:17 +0200 Subject: [PATCH] Local packages should try to be imported before global ones --- freefang/main.py | 14 +++++++------- freefang/models.py | 11 ++++++----- freefang/net.py | 5 +++-- freefang/roles.py | 11 ++++++----- 4 files changed, 22 insertions(+), 19 deletions(-) diff --git a/freefang/main.py b/freefang/main.py index eefc9f4..44daed8 100644 --- a/freefang/main.py +++ b/freefang/main.py @@ -1,19 +1,19 @@ import socket import json try: - + import models + import utils + import net + import packets + import roles + +except ImportError: import freefang.models as models import freefang.utils as utils import freefang.net as net import freefang.packets as packets import freefang.roles as roles -except: - import models - import utils - import net - import packets - import roles import uuid import threading import select diff --git a/freefang/models.py b/freefang/models.py index 4f1405b..547040d 100644 --- a/freefang/models.py +++ b/freefang/models.py @@ -1,15 +1,16 @@ import select, random, json, traceback, sys, datetime, time try: - from freefang.roles import * - import freefang.net as fn - import freefang.packets as packets - import freefang.utils as utils -except ImportError: from roles import * import net as fn import packets import utils +except ImportError: + from freefang.roles import * + import freefang.net as fn + import freefang.packets as packets + import freefang.utils as utils + class Player: def __init__(self): diff --git a/freefang/net.py b/freefang/net.py index a260361..10be8ae 100644 --- a/freefang/net.py +++ b/freefang/net.py @@ -3,10 +3,11 @@ try: import freefang.utils as utils import freefang.packets as packets -except: + +except ImportError: import packets import utils - + def readlength(con): # Read the length of the packet prepended to it diff --git a/freefang/roles.py b/freefang/roles.py index f968159..6571e3a 100644 --- a/freefang/roles.py +++ b/freefang/roles.py @@ -1,13 +1,14 @@ try: - import freefang.net as fn - import freefang.packets as packets - import freefang.utils as utils - import freefang.voting as voting -except ImportError: import net as fn import packets import utils import voting +except ImportError: + + import freefang.net as fn + import freefang.packets as packets + import freefang.utils as utils + import freefang.voting as voting import json