mirror of
https://github.com/FAUSheppy/skillbird
synced 2025-12-09 16:08:31 +01:00
[git fast commit] 02. Feb 2019 - 15:34:59
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
import TrueSkillWrapper as TS
|
||||
import time
|
||||
import threading
|
||||
import insurgencyParsing as iparse
|
||||
|
||||
def readfile(filename, start_at_end=True, exit_on_eof=False, parsingBackend=None):
|
||||
def readfile(filename, start_at_end=True, exit_on_eof=False, parsingBackend=iparse, cpus=1):
|
||||
|
||||
f = open(filename)
|
||||
|
||||
if start_at_end:
|
||||
f.seek(0,2)
|
||||
|
||||
@@ -14,15 +14,15 @@ def readfile(filename, start_at_end=True, exit_on_eof=False, parsingBackend=None
|
||||
raise NotImplementedError("Multiprocessing not implemeted yet")
|
||||
else:
|
||||
if callable(parsingBackend):
|
||||
parsingBackend(f)
|
||||
parsingBackend(f, exit_on_eof, start_at_end)
|
||||
else:
|
||||
parsingBackend.parse(f)
|
||||
parsingBackend.parse(f, exit_on_eof, start_at_end)
|
||||
except TypeError:
|
||||
raise RuntimeError("parsingBackend musst be callable or have .parse() callable")
|
||||
|
||||
f.close()
|
||||
|
||||
def readfiles(filenames, parsingBackend, start_at_end=True, nofollow=False):
|
||||
def readfiles(filenames, start_at_end=True, nofollow=False, parsingBackend=iparse ):
|
||||
for f in filenames:
|
||||
threading.Thread(target=readfile,args=\
|
||||
(f, start_at_end, nofollow, parsingBackend)).start()
|
||||
|
||||
Reference in New Issue
Block a user