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


Python typing.NoReturn方法代碼示例

本文整理匯總了Python中typing.NoReturn方法的典型用法代碼示例。如果您正苦於以下問題:Python typing.NoReturn方法的具體用法?Python typing.NoReturn怎麽用?Python typing.NoReturn使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在typing的用法示例。


在下文中一共展示了typing.NoReturn方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_app_handle_request_asyncio_cancelled_error

# 需要導入模塊: import typing [as 別名]
# 或者: from typing import NoReturn [as 別名]
def test_app_handle_request_asyncio_cancelled_error() -> None:
    app = Quart(__name__)

    @app.route("/")
    async def index() -> NoReturn:
        raise asyncio.CancelledError()

    request = app.request_class(
        "GET",
        "http",
        "/",
        b"",
        Headers([("host", "quart.com")]),
        "",
        "1.1",
        send_push_promise=no_op_push,
    )
    with pytest.raises(asyncio.CancelledError):
        await app.handle_request(request) 
開發者ID:pgjones,項目名稱:quart,代碼行數:21,代碼來源:test_app.py

示例2: fit

# 需要導入模塊: import typing [as 別名]
# 或者: from typing import NoReturn [as 別名]
def fit(self, decisions: np.ndarray, rewards: np.ndarray,
            contexts: Optional[np.ndarray] = None) -> NoReturn:

        # Set the historical data for prediction
        self.decisions = decisions
        self.contexts = contexts

        # Binarize the rewards if using Thompson Sampling
        if isinstance(self.lp_list[0], _ThompsonSampling) and self.lp_list[0].binarizer:
            for lp in self.lp_list:
                lp.is_contextual_binarized = False
            self.rewards = self.lp_list[0]._get_binary_rewards(decisions, rewards)
            for lp in self.lp_list:
                lp.is_contextual_binarized = True
        else:
            self.rewards = rewards

        self._fit_operation() 
開發者ID:fidelity,項目名稱:mabwiser,代碼行數:20,代碼來源:clusters.py

示例3: partial_fit

# 需要導入模塊: import typing [as 別名]
# 或者: from typing import NoReturn [as 別名]
def partial_fit(self, decisions: np.ndarray, rewards: np.ndarray,
                    contexts: Optional[np.ndarray] = None) -> NoReturn:

        # Binarize the rewards if using Thompson Sampling
        if isinstance(self.lp_list[0], _ThompsonSampling) and self.lp_list[0].binarizer:
            for lp in self.lp_list:
                lp.is_contextual_binarized = False
            rewards = self.lp_list[0]._get_binary_rewards(decisions, rewards)
            for lp in self.lp_list:
                lp.is_contextual_binarized = True

        # Add more historical data for prediction
        self.decisions = np.concatenate((self.decisions, decisions))
        self.contexts = np.concatenate((self.contexts, contexts))
        self.rewards = np.concatenate((self.rewards, rewards))

        self._fit_operation() 
開發者ID:fidelity,項目名稱:mabwiser,代碼行數:19,代碼來源:clusters.py

示例4: raise_exc_info

# 需要導入模塊: import typing [as 別名]
# 或者: from typing import NoReturn [as 別名]
def raise_exc_info(
    exc_info,  # type: Tuple[Optional[type], Optional[BaseException], Optional[TracebackType]]
):
    # type: (...) -> typing.NoReturn
    #
    # This function's type annotation must use comments instead of
    # real annotations because typing.NoReturn does not exist in
    # python 3.5's typing module. The formatting is funky because this
    # is apparently what flake8 wants.
    try:
        if exc_info[1] is not None:
            raise exc_info[1].with_traceback(exc_info[2])
        else:
            raise TypeError("raise_exc_info called with no exception")
    finally:
        # Clear the traceback reference from our stack frame to
        # minimize circular references that slow down GC.
        exc_info = (None, None, None) 
開發者ID:opendevops-cn,項目名稱:opendevops,代碼行數:20,代碼來源:util.py

示例5: __init__

# 需要導入模塊: import typing [as 別名]
# 或者: from typing import NoReturn [as 別名]
def __init__(self,
                 apns_topic: str,
                 loop: Optional[asyncio.AbstractEventLoop] = None,
                 on_connection_lost: Optional[
                     Callable[['APNsBaseClientProtocol'], NoReturn]] = None,
                 auth_provider: Optional[AuthorizationHeaderProvider] = None):
        super(APNsBaseClientProtocol, self).__init__()
        self.apns_topic = apns_topic
        self.loop = loop or asyncio.get_event_loop()
        self.on_connection_lost = on_connection_lost
        self.auth_provider = auth_provider

        self.requests = {}
        self.request_streams = {}
        self.request_statuses = {}
        self.inactivity_timer = None 
開發者ID:Fatal1ty,項目名稱:aioapns,代碼行數:18,代碼來源:connection.py

示例6: format_pytest_with_black

# 需要導入模塊: import typing [as 別名]
# 或者: from typing import NoReturn [as 別名]
def format_pytest_with_black(*python_paths: Text) -> NoReturn:
    logger.info("format pytest cases with black ...")
    try:
        if is_support_multiprocessing() or len(python_paths) <= 1:
            subprocess.run(["black", *python_paths])
        else:
            logger.warning(
                f"this system does not support multiprocessing well, format files one by one ..."
            )
            [subprocess.run(["black", path]) for path in python_paths]
    except subprocess.CalledProcessError as ex:
        capture_exception(ex)
        logger.error(ex)
        sys.exit(1)
    except FileNotFoundError:
        err_msg = """
missing dependency tool: black
install black manually and try again:
$ pip install black
"""
        logger.error(err_msg)
        sys.exit(1) 
開發者ID:httprunner,項目名稱:httprunner,代碼行數:24,代碼來源:make.py

示例7: start

# 需要導入模塊: import typing [as 別名]
# 或者: from typing import NoReturn [as 別名]
def start(self) -> NoReturn:
        """
        Starts monitoring the webserver.
        """
        try:  # pylint: disable=too-many-nested-blocks
            self._wait_until_true(
                lambda: self.num_workers_expected == self._get_num_workers_running(),
                timeout=self.master_timeout
            )
            while True:
                if not self.gunicorn_master_proc.is_running():
                    sys.exit(1)
                self._check_workers()
                # Throttle loop
                sleep(1)

        except (AirflowWebServerTimeout, OSError) as err:
            self.log.error(err)
            self.log.error("Shutting down webserver")
            try:
                self.gunicorn_master_proc.terminate()
                self.gunicorn_master_proc.wait()
            finally:
                sys.exit(1) 
開發者ID:apache,項目名稱:airflow,代碼行數:26,代碼來源:webserver_command.py

示例8: sim

# 需要導入模塊: import typing [as 別名]
# 或者: from typing import NoReturn [as 別名]
def sim(self, *args: Any, **kwargs: Any) -> NoReturn:
        """Raise exception when called.

        Parameters
        ----------
        *args
            Variable length argument list
        **kwargs
            Arbitrary keyword arguments

        Raises
        ------
        NotImplementedError
            Method disabled for Morisita similarity.


        .. versionadded:: 0.3.6

        """
        raise NotImplementedError('Method disabled for Morisita similarity.') 
開發者ID:chrislit,項目名稱:abydos,代碼行數:22,代碼來源:_morisita.py

示例9: dist

# 需要導入模塊: import typing [as 別名]
# 或者: from typing import NoReturn [as 別名]
def dist(self, *args: Any, **kwargs: Any) -> NoReturn:
        """Raise exception when called.

        Parameters
        ----------
        *args
            Variable length argument list
        **kwargs
            Arbitrary keyword arguments

        Raises
        ------
        NotImplementedError
            Method disabled for Morisita similarity.


        .. versionadded:: 0.3.6

        """
        raise NotImplementedError('Method disabled for Morisita similarity.') 
開發者ID:chrislit,項目名稱:abydos,代碼行數:22,代碼來源:_morisita.py

示例10: sim

# 需要導入模塊: import typing [as 別名]
# 或者: from typing import NoReturn [as 別名]
def sim(self, *args: Any, **kwargs: Any) -> NoReturn:
        """Raise exception when called.

        Parameters
        ----------
        *args
            Variable length argument list
        **kwargs
            Arbitrary keyword arguments

        Raises
        ------
        NotImplementedError
            Method disabled for Millar dissimilarity.


        .. versionadded:: 0.3.6

        """
        raise NotImplementedError('Method disabled for Millar dissimilarity.') 
開發者ID:chrislit,項目名稱:abydos,代碼行數:22,代碼來源:_millar.py

示例11: dist

# 需要導入模塊: import typing [as 別名]
# 或者: from typing import NoReturn [as 別名]
def dist(self, *args: Any, **kwargs: Any) -> NoReturn:
        """Raise exception when called.

        Parameters
        ----------
        *args
            Variable length argument list
        **kwargs
            Arbitrary keyword arguments

        Raises
        ------
        NotImplementedError
            Method disabled for Millar dissimilarity.


        .. versionadded:: 0.3.6

        """
        raise NotImplementedError('Method disabled for Millar dissimilarity.') 
開發者ID:chrislit,項目名稱:abydos,代碼行數:22,代碼來源:_millar.py

示例12: sim

# 需要導入模塊: import typing [as 別名]
# 或者: from typing import NoReturn [as 別名]
def sim(self, *args: Any, **kwargs: Any) -> NoReturn:
        """Raise exception when called.

        Parameters
        ----------
        *args
            Variable length argument list
        **kwargs
            Arbitrary keyword arguments

        Raises
        ------
        NotImplementedError
            Method disabled for Sokal & Sneath III similarity.


        .. versionadded:: 0.3.6

        """
        raise NotImplementedError(
            'Method disabled for Sokal & Sneath III similarity.'
        ) 
開發者ID:chrislit,項目名稱:abydos,代碼行數:24,代碼來源:_sokal_sneath_iii.py

示例13: sim

# 需要導入模塊: import typing [as 別名]
# 或者: from typing import NoReturn [as 別名]
def sim(self, *args: Any, **kwargs: Any) -> NoReturn:
        """Raise exception when called.

        Parameters
        ----------
        *args
            Variable length argument list
        **kwargs
            Arbitrary keyword arguments

        Raises
        ------
        NotImplementedError
            Method disabled for Kulczynski I similarity.


        .. versionadded:: 0.3.6

        """
        raise NotImplementedError(
            'Method disabled for Kulczynski I similarity.'
        ) 
開發者ID:chrislit,項目名稱:abydos,代碼行數:24,代碼來源:_kulczynski_i.py

示例14: dist

# 需要導入模塊: import typing [as 別名]
# 或者: from typing import NoReturn [as 別名]
def dist(self, *args: Any, **kwargs: Any) -> NoReturn:
        """Raise exception when called.

        Parameters
        ----------
        *args
            Variable length argument list
        **kwargs
            Arbitrary keyword arguments

        Raises
        ------
        NotImplementedError
            Method disabled for Kulczynski I similarity.


        .. versionadded:: 0.3.6

        """
        raise NotImplementedError(
            'Method disabled for Kulczynski I similarity.'
        ) 
開發者ID:chrislit,項目名稱:abydos,代碼行數:24,代碼來源:_kulczynski_i.py

示例15: skip

# 需要導入模塊: import typing [as 別名]
# 或者: from typing import NoReturn [as 別名]
def skip(msg: str = "", *, allow_module_level: bool = False) -> "NoReturn":
    """
    Skip an executing test with the given message.

    This function should be called only during testing (setup, call or teardown) or
    during collection by using the ``allow_module_level`` flag.  This function can
    be called in doctests as well.

    :kwarg bool allow_module_level: allows this function to be called at
        module level, skipping the rest of the module. Default to False.

    .. note::
        It is better to use the :ref:`pytest.mark.skipif ref` marker when possible to declare a test to be
        skipped under certain conditions like mismatching platforms or
        dependencies.
        Similarly, use the ``# doctest: +SKIP`` directive (see `doctest.SKIP
        <https://docs.python.org/3/library/doctest.html#doctest.SKIP>`_)
        to skip a doctest statically.
    """
    __tracebackhide__ = True
    raise Skipped(msg=msg, allow_module_level=allow_module_level) 
開發者ID:pytest-dev,項目名稱:pytest,代碼行數:23,代碼來源:outcomes.py


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