当前位置: 首页>>代码示例>>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;未经允许,请勿转载。