correct syntax to config with check pycodestyle

This commit is contained in:
AleaJactaEst 2018-10-09 13:25:09 +02:00
parent ef3cc5347d
commit c3d115b970

View file

@ -74,8 +74,8 @@ This script need configuration file (see below for model)::
# size array/dict state # size array/dict state
size_max_filter = 1000 size_max_filter = 1000
# search regex to add state (python regex) # search regex to add state (python regex)
add_filter = "^((.*)(setActiveCharForPlayer).*(: set active char )[\d]+( for )(?P<ActivePlayer>.*)|(.*)(disconnectPlayer)(.+:.+<.+>){0,1}[\s]+(?P<InactivePlayer>.*)[\s]+(is disconnected))" add_filter = "^((.*)(setActiveCharForPlayer).*(: set active char )[0-9]+( for )(?P<ActivePlayer>.*)|(.*)(disconnectPlayer)(.+:.+<.+>){0,1}[ ]+(?P<InactivePlayer>.*)[ ]+(is disconnected))"
del_filter = "^((.*)(setActiveCharForPlayer).*(: set active char )[\d]+( for )(?P<InactivePlayer>.*)|(.*)(disconnectPlayer)(.+:.+<.+>){0,1}[\s]+(?P<ActivePlayer>.*)[\s]+(is disconnected))" del_filter = "^((.*)(setActiveCharForPlayer).*(: set active char )[0-9]+( for )(?P<InactivePlayer>.*)|(.*)(disconnectPlayer)(.+:.+<.+>){0,1}[ ]+(?P<ActivePlayer>.*)[ ]+(is disconnected))"
# autostart (when start OpenNelManager, launch this program) # autostart (when start OpenNelManager, launch this program)
autostart = no autostart = no
# restart after crash # restart after crash
@ -635,12 +635,12 @@ class ManageCommand():
self.restart_delay = restart_delay self.restart_delay = restart_delay
self.threadRestart = None self.threadRestart = None
self.egs_filter = egs_filter self.egs_filter = egs_filter
self.egs_filter_load_character = re.compile(".*(egs_plinfo).*(: LOADED User )'(?P<UID>[\d]+)' Character '(?P<NameDomain>[^']+)' from BS stream file 'characters/([\d]+)/account_(?P<UIDBIS>[\d]+)_(?P<IDCHAR>[\d]+)_pdr.bin") self.egs_filter_load_character = re.compile(r".*(egs_plinfo).*(: LOADED User )'(?P<UID>[\d]+)' Character '(?P<NameDomain>[^']+)' from BS stream file 'characters/([\d]+)/account_(?P<UIDBIS>[\d]+)_(?P<IDCHAR>[\d]+)_pdr.bin")
self.egs_filter_active_character = re.compile(".*(setActiveCharForPlayer).*(: set active char )(?P<IDCHAR>[\d]+)( for player )(?P<UID>[\d]+)") self.egs_filter_active_character = re.compile(r".*(setActiveCharForPlayer).*(: set active char )(?P<IDCHAR>[\d]+)( for player )(?P<UID>[\d]+)")
self.egs_filter_sid = re.compile(".*(Mapping UID )(?P<UID>[\d]+)( => Sid )\((?P<SID>.*)\)") self.egs_filter_sid = re.compile(r".*(Mapping UID )(?P<UID>[\d]+)( => Sid )[(](?P<SID>.*)[)]")
self.egs_filter_client_ready = re.compile(".*(Updating IS_NEWBIE flag for character: )\((?P<ID>.*)\)") self.egs_filter_client_ready = re.compile(r".*(Updating IS_NEWBIE flag for character: )[(](?P<ID>.*)[)]")
self.egs_filter_disconnected = re.compile(".*(disconnectPlayer).+[\s]+(player )(?P<UID>[\d]+)[\s]+(is disconnected)") self.egs_filter_disconnected = re.compile(r".*(disconnectPlayer).+[\s]+(player )(?P<UID>[\d]+)[\s]+(is disconnected)")
self.egs_filter_admin = re.compile("(.*)(cbClientAdmin).*(: ADMIN)(: Player )\((?P<SID>.*)\)(?P<ACTION>.+)") self.egs_filter_admin = re.compile(r"(.*)(cbClientAdmin).*(: ADMIN)(: Player )[(](?P<SID>.*)[)](?P<ACTION>.+)")
# cbClientAdmin EGS-133 : ADMIN: Player (0x0000000021:00:00:86) tried to execute a no valid client admin command 'info' # cbClientAdmin EGS-133 : ADMIN: Player (0x0000000021:00:00:86) tried to execute a no valid client admin command 'info'
self.filter_load_character = {} self.filter_load_character = {}
self.filter_active_character = {} self.filter_active_character = {}
@ -787,7 +787,6 @@ class ManageCommand():
code = self.process.poll() code = self.process.poll()
if code is not None: if code is not None:
logging.error("process %s down" % self.name) logging.error("process %s down" % self.name)
#self.eventRunning.clear()
crashed = True crashed = True
except AttributeError as e: except AttributeError as e:
logging.warning("process %s down (%s)" % (self.name, e)) logging.warning("process %s down (%s)" % (self.name, e))
@ -802,7 +801,7 @@ class ManageCommand():
while self.eventRunningReader.is_set() and not wait_semaphore: while self.eventRunningReader.is_set() and not wait_semaphore:
time.sleep(1) time.sleep(1)
wait_semaphore = self.semaphore.acquire(False) wait_semaphore = self.semaphore.acquire(False)
if wait_semaphore == True: if wait_semaphore:
self.queueIn.put("STOPPED") self.queueIn.put("STOPPED")
self.semaphore.release() self.semaphore.release()
if self.activate_filter: if self.activate_filter:
@ -821,7 +820,7 @@ class ManageCommand():
time.sleep(1) time.sleep(1)
wait_semaphore = self.semaphore.acquire(False) wait_semaphore = self.semaphore.acquire(False)
logging.debug('Prepare restart service %s (step 2)' % (self.name)) logging.debug('Prepare restart service %s (step 2)' % (self.name))
if wait_semaphore == True: if wait_semaphore:
logging.debug('Restart service %s' % (self.name)) logging.debug('Restart service %s' % (self.name))
self.queueIn.put("START") self.queueIn.put("START")
self.queueOut.get() self.queueOut.get()
@ -889,7 +888,6 @@ class ManageCommand():
return 0 return 0
else: else:
logging.error("%s crashed (return code:%d)" % (self.name, code)) logging.error("%s crashed (return code:%d)" % (self.name, code))
#self.semaphore
# self.queueIn.put("STOPPED") # self.queueIn.put("STOPPED")
return 2 return 2
else: else:
@ -1035,7 +1033,6 @@ class ManageCommand():
loop = False loop = False
continue continue
elif command == "START": elif command == "START":
#if savedstate != 0:
savedstate = self.start() savedstate = self.start()
self.queueOut.put({'state': statuscmd[savedstate]}) self.queueOut.put({'state': statuscmd[savedstate]})
elif command == "STATUS": elif command == "STATUS":
@ -1080,7 +1077,6 @@ class ManageCommand():
self.stop() self.stop()
savedstate = 2 savedstate = 2
self.eventRunningRestart.clear() self.eventRunningRestart.clear()
#logging.warning("program (%s) is crashed" % self.name)
try: try:
self.threadRestart.terminate() self.threadRestart.terminate()
self.threadRestart.join() self.threadRestart.join()