Revert "Reformat project"
This reverts commit 64e3e1160aa76d191740342ab3edc68807f890fb.
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
from os import listdir
|
||||
|
||||
import commands
|
||||
from main import CommandMap
|
||||
from utils.logging.debug import debug
|
||||
from utils.logging.log import *
|
||||
import commands
|
||||
|
||||
from main import CommandMap
|
||||
|
||||
|
||||
def loadCommands(allowDup=False):
|
||||
@@ -14,15 +15,11 @@ def loadCommands(allowDup=False):
|
||||
try:
|
||||
module = __import__("commands.%s" % commandName)
|
||||
if not commandName in CommandMap:
|
||||
CommandMap[commandName] = getattr(
|
||||
getattr(module, commandName), className
|
||||
)
|
||||
CommandMap[commandName] = getattr(getattr(module, commandName), className)
|
||||
debug("Registered command: %s" % commandName)
|
||||
else:
|
||||
if allowDup:
|
||||
CommandMap[commandName] = getattr(
|
||||
getattr(module, commandName), className
|
||||
)
|
||||
CommandMap[commandName] = getattr(getattr(module, commandName), className)
|
||||
debug("Registered command: %s" % commandName)
|
||||
|
||||
error("Duplicate command: %s" % (commandName))
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
import sys
|
||||
from importlib import reload
|
||||
from os import listdir
|
||||
from importlib import reload
|
||||
import sys
|
||||
|
||||
import commands
|
||||
from main import CommandMap
|
||||
from utils.logging.debug import debug
|
||||
from utils.logging.log import *
|
||||
import commands
|
||||
|
||||
from main import CommandMap
|
||||
|
||||
|
||||
def loadSingle(commandName):
|
||||
@@ -14,9 +15,7 @@ def loadSingle(commandName):
|
||||
try:
|
||||
if commandName in CommandMap.keys():
|
||||
reload(sys.modules["commands." + commandName])
|
||||
CommandMap[commandName] = getattr(
|
||||
sys.modules["commands." + commandName], className
|
||||
)
|
||||
CommandMap[commandName] = getattr(sys.modules["commands." + commandName], className)
|
||||
debug("Reloaded command: %s" % commandName)
|
||||
return "RELOAD"
|
||||
module = __import__("commands.%s" % commandName)
|
||||
|
||||
Reference in New Issue
Block a user