本文整理汇总了Python中concurrent.futures._base.Future方法的典型用法代码示例。如果您正苦于以下问题:Python _base.Future方法的具体用法?Python _base.Future怎么用?Python _base.Future使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类concurrent.futures._base
的用法示例。
在下文中一共展示了_base.Future方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: result_for_completed_scan_jobs
# 需要导入模块: from concurrent.futures import _base [as 别名]
# 或者: from concurrent.futures._base import Future [as 别名]
def result_for_completed_scan_jobs(
cls, server_info: ServerConnectivityInfo, completed_scan_jobs: List[Future]
) -> RobotScanResult:
if len(completed_scan_jobs) != cls._TEST_ATTEMPTS_NB:
raise RuntimeError(f"Unexpected number of scan jobs received: {completed_scan_jobs}")
combined_server_responses: Dict[RobotPmsPaddingPayloadEnum, List[str]] = {
payload_enum: [] for payload_enum in RobotPmsPaddingPayloadEnum
}
for future in completed_scan_jobs:
try:
server_responses_per_robot_payloads = future.result()
for payload_enum, server_response in server_responses_per_robot_payloads.items():
combined_server_responses[payload_enum].append(server_response)
except ServerDoesNotSupportRsa:
return RobotScanResult(robot_result=RobotScanResultEnum.NOT_VULNERABLE_RSA_NOT_SUPPORTED)
result = RobotServerResponsesAnalyzer(combined_server_responses, cls._TEST_ATTEMPTS_NB).compute_result_enum()
return RobotScanResult(result)
示例2: result_for_completed_scan_jobs
# 需要导入模块: from concurrent.futures import _base [as 别名]
# 或者: from concurrent.futures._base import Future [as 别名]
def result_for_completed_scan_jobs(
cls, server_info: ServerConnectivityInfo, completed_scan_jobs: List[Future]
) -> SessionResumptionRateScanResult:
if len(completed_scan_jobs) != cls._SESSION_ID_RESUMPTION_ATTEMPTS_NB:
raise RuntimeError(f"Unexpected number of scan jobs received: {completed_scan_jobs}")
successful_resumptions_count = 0
for job in completed_scan_jobs:
was_resumption_successful = job.result()
if was_resumption_successful:
successful_resumptions_count += 1
return SessionResumptionRateScanResult(
attempted_session_id_resumptions_count=cls._SESSION_ID_RESUMPTION_ATTEMPTS_NB,
successful_session_id_resumptions_count=successful_resumptions_count,
)
示例3: submit
# 需要导入模块: from concurrent.futures import _base [as 别名]
# 或者: from concurrent.futures._base import Future [as 别名]
def submit(self, fn, *args, **kwargs):
with self._shutdown_lock:
if self._shutdown_thread:
raise RuntimeError('cannot schedule new futures after shutdown')
f = _base.Future()
w = _WorkItem(f, fn, args, kwargs)
self._pending_work_items[self._queue_count] = w
self._work_ids.put(self._queue_count)
self._queue_count += 1
# Wake up queue management thread
self._result_queue.put(None)
self._start_queue_management_thread()
self._adjust_process_count()
return f
示例4: post
# 需要导入模块: from concurrent.futures import _base [as 别名]
# 或者: from concurrent.futures._base import Future [as 别名]
def post(self, message):
with self._shutdown_lock:
if self._broken:
raise process.BrokenProcessPool(
'A child process terminated '
'abruptly, the process pool is not usable anymore')
if self._shutdown_thread:
raise RuntimeError('cannot schedule new futures after shutdown')
f = _base.Future()
w = _WorkItem(f, message)
self._pending_work_items[self._queue_count] = w
self._work_ids.put(self._queue_count)
self._queue_count += 1
# Wake up queue management thread
self._result_queue.put(None)
self._start_queue_management_thread()
return f
示例5: submit
# 需要导入模块: from concurrent.futures import _base [as 别名]
# 或者: from concurrent.futures._base import Future [as 别名]
def submit(self, fn, *args, **kwargs):
with self._shutdown_lock:
if self._broken:
raise BrokenProcessPool('A child process terminated '
'abruptly, the process pool is not usable anymore')
if self._shutdown_thread:
raise RuntimeError('cannot schedule new futures after shutdown')
f = _base.Future()
w = _WorkItem(f, fn, args, kwargs)
self._pending_work_items[self._queue_count] = w
self._work_ids.put(self._queue_count)
self._queue_count += 1
# Wake up queue management thread
self._result_queue.put(None)
self._start_queue_management_thread()
return f
示例6: submit
# 需要导入模块: from concurrent.futures import _base [as 别名]
# 或者: from concurrent.futures._base import Future [as 别名]
def submit(self, fn, *args, **kwargs):
with self._shutdown_lock:
if self._broken:
raise BrokenThreadPool(self._broken)
if self._shutdown:
raise RuntimeError('cannot schedule new futures after shutdown')
if _shutdown:
raise RuntimeError('cannot schedule new futures after'
'interpreter shutdown')
f = _base.Future()
w = _WorkItem(f, fn, args, kwargs)
self._work_queue.put(w)
self._adjust_thread_count()
return f
示例7: submit
# 需要导入模块: from concurrent.futures import _base [as 别名]
# 或者: from concurrent.futures._base import Future [as 别名]
def submit(self, fn, *args, **kwargs):
with self._shutdown_lock:
if self._broken:
raise BrokenProcessPool(self._broken)
if self._shutdown_thread:
raise RuntimeError('cannot schedule new futures after shutdown')
if _global_shutdown:
raise RuntimeError('cannot schedule new futures after '
'interpreter shutdown')
f = _base.Future()
w = _WorkItem(f, fn, args, kwargs)
self._pending_work_items[self._queue_count] = w
self._work_ids.put(self._queue_count)
self._queue_count += 1
# Wake up queue management thread
self._queue_management_thread_wakeup.wakeup()
self._start_queue_management_thread()
return f
示例8: submit
# 需要导入模块: from concurrent.futures import _base [as 别名]
# 或者: from concurrent.futures._base import Future [as 别名]
def submit(self, fn, *args, **kwargs):
with self._shutdown_lock:
if self._broken:
raise BrokenThreadPool(self._broken)
if self._shutdown:
raise RuntimeError('cannot schedule new futures after shutdown')
if _shutdown:
raise RuntimeError('cannot schedule new futures after '
'interpreter shutdown')
f = _base.Future()
w = _WorkItem(f, fn, args, kwargs)
self._work_queue.put(w)
self._adjust_thread_count()
return f
示例9: result_for_completed_scan_jobs
# 需要导入模块: from concurrent.futures import _base [as 别名]
# 或者: from concurrent.futures._base import Future [as 别名]
def result_for_completed_scan_jobs(
cls, server_info: ServerConnectivityInfo, completed_scan_jobs: List[Future]
) -> CompressionScanResult:
if len(completed_scan_jobs) != 1:
raise RuntimeError(f"Unexpected number of scan jobs received: {completed_scan_jobs}")
return CompressionScanResult(supports_compression=completed_scan_jobs[0].result())
示例10: result_for_completed_scan_jobs
# 需要导入模块: from concurrent.futures import _base [as 别名]
# 或者: from concurrent.futures._base import Future [as 别名]
def result_for_completed_scan_jobs(
cls, server_info: ServerConnectivityInfo, completed_scan_jobs: List[Future]
) -> HeartbleedScanResult:
if len(completed_scan_jobs) != 1:
raise RuntimeError(f"Unexpected number of scan jobs received: {completed_scan_jobs}")
return HeartbleedScanResult(is_vulnerable_to_heartbleed=completed_scan_jobs[0].result())
示例11: result_for_completed_scan_jobs
# 需要导入模块: from concurrent.futures import _base [as 别名]
# 或者: from concurrent.futures._base import Future [as 别名]
def result_for_completed_scan_jobs(
cls, server_info: ServerConnectivityInfo, completed_scan_jobs: List[Future]
) -> EarlyDataScanResult:
if len(completed_scan_jobs) != 1:
raise RuntimeError(f"Unexpected number of scan jobs received: {completed_scan_jobs}")
return EarlyDataScanResult(supports_early_data=completed_scan_jobs[0].result())
示例12: result_for_completed_scan_jobs
# 需要导入模块: from concurrent.futures import _base [as 别名]
# 或者: from concurrent.futures._base import Future [as 别名]
def result_for_completed_scan_jobs(
cls, server_info: ServerConnectivityInfo, completed_scan_jobs: List[Future]
) -> FallbackScsvScanResult:
if len(completed_scan_jobs) != 1:
raise RuntimeError(f"Unexpected number of scan jobs received: {completed_scan_jobs}")
return FallbackScsvScanResult(supports_fallback_scsv=completed_scan_jobs[0].result())
示例13: result_for_completed_scan_jobs
# 需要导入模块: from concurrent.futures import _base [as 别名]
# 或者: from concurrent.futures._base import Future [as 别名]
def result_for_completed_scan_jobs(
cls, server_info: ServerConnectivityInfo, completed_scan_jobs: List[Future]
) -> HttpHeadersScanResult:
if len(completed_scan_jobs) != 1:
raise RuntimeError(f"Unexpected number of scan jobs received: {completed_scan_jobs}")
return completed_scan_jobs[0].result()
示例14: result_for_completed_scan_jobs
# 需要导入模块: from concurrent.futures import _base [as 别名]
# 或者: from concurrent.futures._base import Future [as 别名]
def result_for_completed_scan_jobs(
cls, server_info: ServerConnectivityInfo, completed_scan_jobs: List[Future]
) -> OpenSslCcsInjectionScanResult:
if len(completed_scan_jobs) != 1:
raise RuntimeError(f"Unexpected number of scan jobs received: {completed_scan_jobs}")
return OpenSslCcsInjectionScanResult(is_vulnerable_to_ccs_injection=completed_scan_jobs[0].result())
示例15: submit
# 需要导入模块: from concurrent.futures import _base [as 别名]
# 或者: from concurrent.futures._base import Future [as 别名]
def submit(self, fn, *args, **kwargs):
with self._shutdown_lock:
if self._shutdown:
raise RuntimeError('cannot schedule new futures after shutdown')
f = _base.Future()
w = _WorkItem(f, fn, args, kwargs)
self._work_queue.put(w)
self._adjust_thread_count()
return f