─░├žeri─če ge├ž

Referans i├žin hub_sdk/helpers/exceptions.py

Not

Bu dosya https://github.com/ultralytics/hub-sdk/blob/main/hub_sdk/helpers/exceptions .py adresinde mevcuttur. Bir sorun tespit ederseniz, l├╝tfen bir ├çekme ─░ste─či ­čŤá´ŞĆ ile katk─▒da bulunarak d├╝zeltmeye yard─▒mc─▒ olun. Te┼čekk├╝rler ­čÖĆ!



hub_sdk.helpers.exceptions.suppress_exceptions()

Global HUB_EXCEPTIONS bayra─č─▒na ba─čl─▒ olarak istisnalar─▒ yerel olarak bast─▒r─▒r.

HUB_EXCEPTIONS bayra─č─▒ False olarak ayarlan─▒rsa, bu fonksiyon yakalanan istisnay─▒ y├╝kseltir, yay─▒lmas─▒na ve ba┼čka bir yerde i┼členmesine izin verir. Bayrak True olarak ayarlan─▒rsa, i┼člev istisnay─▒ bast─▒r─▒r ve etkin bir ┼čekilde yerel olarak ele al─▒r.

├ľrnek

─░stisna i┼člemeyi global olarak kontrol etmek i├žin HUB_EXCEPTIONS sabitini ayarlay─▒n

HUB_EXCEPTIONS = False

try: # ─░stisna olu┼čturabilecek kodunuz except ValueError as e: # HUB_EXCEPTIONS True ise istisna bast─▒r─▒lacakt─▒r suppress_exceptions() # HUB_EXCEPTIONS False ise istisna i┼čleme burada devam eder

Not

Bu fonksiyon global HUB_EXCEPTIONS sabiti ile birlikte kullan─▒lmak ├╝zere tasarlanm─▒┼čt─▒r Kod taban─▒n─▒n birden fazla b├Âl├╝m├╝nde istisna i┼čleme davran─▒┼č─▒n─▒ kontrol etmek i├žin.

Kaynak kodu hub_sdk/helpers/exceptions.py
def suppress_exceptions() -> None:
    """
    Suppress exceptions locally based on the global HUB_EXCEPTIONS flag.

    If the HUB_EXCEPTIONS flag is set to False, this function raises the caught exception,
    allowing it to propagate and be handled elsewhere. If the flag is set to True,
    the function suppresses the exception, effectively handling it locally.

    Example:
        # Set the HUB_EXCEPTIONS constant to control exception handling globally
        HUB_EXCEPTIONS = False

        try:
            # Your code that may raise an exception
        except ValueError as e:
            # The exception will be suppressed if HUB_EXCEPTIONS is True
            suppress_exceptions()
            # Exception handling continues here if HUB_EXCEPTIONS is False

    Note:
        This function is designed to be used in conjunction with the global HUB_EXCEPTIONS constant
        to control exception handling behavior across multiple parts of the codebase.
    """
    if not HUB_EXCEPTIONS:
        raise