三种调用接口保持一致性
This commit is contained in:
@@ -16,7 +16,7 @@ G_mode_txt = ('顺序执行','线程池','进程池')
|
|||||||
|
|
||||||
class noThread(object):
|
class noThread(object):
|
||||||
def map(self, fn, param):
|
def map(self, fn, param):
|
||||||
return builtins.map(fn, param)
|
return list(builtins.map(fn, param))
|
||||||
def __enter__(self):
|
def __enter__(self):
|
||||||
return self
|
return self
|
||||||
def __exit__(self, exc_type, exc_val, exc_tb):
|
def __exit__(self, exc_type, exc_val, exc_tb):
|
||||||
@@ -47,7 +47,6 @@ def getStoryline(number, title, sites: list=None):
|
|||||||
assert run_mode in (0,1,2)
|
assert run_mode in (0,1,2)
|
||||||
with ThreadPool(cores) if run_mode == 1 else Pool(cores) if run_mode == 2 else noThread() as pool:
|
with ThreadPool(cores) if run_mode == 1 else Pool(cores) if run_mode == 2 else noThread() as pool:
|
||||||
result = pool.map(getStoryline_mp, mp_args)
|
result = pool.map(getStoryline_mp, mp_args)
|
||||||
result = list(result) if run_mode == 0 else result
|
|
||||||
if not debug and conf.storyline_show() == 0:
|
if not debug and conf.storyline_show() == 0:
|
||||||
for value in result:
|
for value in result:
|
||||||
if isinstance(value, str) and len(value):
|
if isinstance(value, str) and len(value):
|
||||||
|
|||||||
Reference in New Issue
Block a user