本文整理匯總了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