معرفی شرکت ها


errr-1.2.0


Card image cap
تبلیغات ما

مشتریان به طور فزاینده ای آنلاین هستند. تبلیغات می تواند به آنها کمک کند تا کسب و کار شما را پیدا کنند.

مشاهده بیشتر
Card image cap
تبلیغات ما

مشتریان به طور فزاینده ای آنلاین هستند. تبلیغات می تواند به آنها کمک کند تا کسب و کار شما را پیدا کنند.

مشاهده بیشتر
Card image cap
تبلیغات ما

مشتریان به طور فزاینده ای آنلاین هستند. تبلیغات می تواند به آنها کمک کند تا کسب و کار شما را پیدا کنند.

مشاهده بیشتر
Card image cap
تبلیغات ما

مشتریان به طور فزاینده ای آنلاین هستند. تبلیغات می تواند به آنها کمک کند تا کسب و کار شما را پیدا کنند.

مشاهده بیشتر
Card image cap
تبلیغات ما

مشتریان به طور فزاینده ای آنلاین هستند. تبلیغات می تواند به آنها کمک کند تا کسب و کار شما را پیدا کنند.

مشاهده بیشتر

توضیحات

Elegant detailed Python exceptions.
ویژگی مقدار
سیستم عامل -
نام فایل errr-1.2.0
نام errr
نسخه کتابخانه 1.2.0
نگهدارنده []
ایمیل نگهدارنده []
نویسنده Robin De Schepper
ایمیل نویسنده robingilbert.deschepper@unipv.it
آدرس صفحه اصلی https://github.com/Helveg/errr
آدرس اینترنتی https://pypi.org/project/errr/
مجوز MIT
# errr Elegantly create detailed exceptions in Python. ## Detailed exceptions ```python >>> import errr >>> class MyException(errr.DetailedException, list_detailts=True, details=["cause", "type"]): ... pass ... >>> example = MyException("The backend server crashed", "backend", "crash") >>> raise example __main__.MyException: The backend server crashed Details: ˪cause: backend ˪type: crash >>> example.details {'cause': 'backend', 'type': 'crash'} >>> example.cause 'backend' ``` ## Semantic exceptions You can also rapidly create large semantic trees of exceptions using the `make_tree` function, listing exceptions as keyword arguments using the `errr.exception` factory method. The `make_tree` method executes these recursive factories to produce your exceptions. Nesting these factory methods will make the resultant exceptions inherit from eachother. All of the produced exceptions are then flat injected into the given module dictionary (typically) this should be `globals()` but you can inject into other modules using `sys.modules["name"].__dict__`. ```python from errr import make_tree, exception as _e make_tree( # Pass the module dictionary as first argument globals(), # List your nested exceptions RootException=_e( ChildException=_e(), Child2Exception=_e() ), SecondRootException=_e( # List details as positional arguments "detail1", "detail2", # And continue with child exceptions as keyword arguments AnotherChildException=_e() ) ) print(RootException) # <class '__main__.RootException'> print(ChildException) # <class '__main__.ChildException'> print(ChildException.__bases__) # (<class '__main__.RootException'>,) ``` ## Exception wrapping You can catch and reraise exceptions as a new type of exception with the `wrap` function: ```python import errr class LibraryError(errr.DetailedException, details=["library"]): pass for name, library in libraries.items(): try: library.load() except Exception as e: errr.wrap(LibraryError, e, name, prepend="When trying to load %library% it reported:\n") # Traceback # ... # __main__.LibraryError: When trying to load myLibrary it reported: # Module 'missing' not found. ```


نیازمندی

مقدار نام
- sphinx
- sphinx-rtd-theme


نحوه نصب


نصب پکیج whl errr-1.2.0:

    pip install errr-1.2.0.whl


نصب پکیج tar.gz errr-1.2.0:

    pip install errr-1.2.0.tar.gz