當前位置: 首頁>>代碼示例>>Python>>正文


Python _base.Future方法代碼示例

本文整理匯總了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) 
開發者ID:nabla-c0d3,項目名稱:sslyze,代碼行數:21,代碼來源:implementation.py

示例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,
        ) 
開發者ID:nabla-c0d3,項目名稱:sslyze,代碼行數:18,代碼來源:implementation.py

示例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 
開發者ID:remg427,項目名稱:misp42splunk,代碼行數:19,代碼來源:process.py

示例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 
開發者ID:Erotemic,項目名稱:ibeis,代碼行數:22,代碼來源:process_actor.py

示例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 
開發者ID:Microvellum,項目名稱:Fluid-Designer,代碼行數:21,代碼來源:process.py

示例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 
開發者ID:CedricGuillemet,項目名稱:Imogen,代碼行數:19,代碼來源:thread.py

示例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 
開發者ID:CedricGuillemet,項目名稱:Imogen,代碼行數:23,代碼來源:process.py

示例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 
開發者ID:bkerler,項目名稱:android_universal,代碼行數:19,代碼來源:thread.py

示例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()) 
開發者ID:nabla-c0d3,項目名稱:sslyze,代碼行數:9,代碼來源:compression_plugin.py

示例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()) 
開發者ID:nabla-c0d3,項目名稱:sslyze,代碼行數:9,代碼來源:heartbleed_plugin.py

示例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()) 
開發者ID:nabla-c0d3,項目名稱:sslyze,代碼行數:9,代碼來源:early_data_plugin.py

示例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()) 
開發者ID:nabla-c0d3,項目名稱:sslyze,代碼行數:9,代碼來源:fallback_scsv_plugin.py

示例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() 
開發者ID:nabla-c0d3,項目名稱:sslyze,代碼行數:9,代碼來源:http_headers_plugin.py

示例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()) 
開發者ID:nabla-c0d3,項目名稱:sslyze,代碼行數:9,代碼來源:openssl_ccs_injection_plugin.py

示例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 
開發者ID:remg427,項目名稱:misp42splunk,代碼行數:13,代碼來源:thread.py


注:本文中的concurrent.futures._base.Future方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。