Python warnings.__warningregistry__() Examples

The following are 5 code examples for showing how to use warnings.__warningregistry__(). These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example.

You may check out the related API usage on the sidebar.

You may also want to check out all available functions/classes of the module warnings , or try the search function .

Example 1
Project: Fluid-Designer   Author: Microvellum   File: test_loader.py    License: GNU General Public License v3.0 5 votes vote down vote up
def warningregistry(func):
    def wrapper(*args, **kws):
        missing = object()
        saved = getattr(warnings, '__warningregistry__', missing).copy()
        try:
            return func(*args, **kws)
        finally:
            if saved is missing:
                try:
                    del warnings.__warningregistry__
                except AttributeError:
                    pass
            else:
                warnings.__warningregistry__ = saved 
Example 2
Project: Imogen   Author: CedricGuillemet   File: test_loader.py    License: MIT License 5 votes vote down vote up
def warningregistry(func):
    def wrapper(*args, **kws):
        missing = []
        saved = getattr(warnings, '__warningregistry__', missing).copy()
        try:
            return func(*args, **kws)
        finally:
            if saved is missing:
                try:
                    del warnings.__warningregistry__
                except AttributeError:
                    pass
            else:
                warnings.__warningregistry__ = saved
    return wrapper 
Example 3
Project: Project-New-Reign---Nemesis-Main   Author: ShikyoKira   File: test_loader.py    License: GNU General Public License v3.0 5 votes vote down vote up
def warningregistry(func):
    def wrapper(*args, **kws):
        missing = []
        saved = getattr(warnings, '__warningregistry__', missing).copy()
        try:
            return func(*args, **kws)
        finally:
            if saved is missing:
                try:
                    del warnings.__warningregistry__
                except AttributeError:
                    pass
            else:
                warnings.__warningregistry__ = saved
    return wrapper 
Example 4
Project: odoo13-x64   Author: guohuadeng   File: test_loader.py    License: GNU General Public License v3.0 5 votes vote down vote up
def warningregistry(func):
    def wrapper(*args, **kws):
        missing = []
        saved = getattr(warnings, '__warningregistry__', missing).copy()
        try:
            return func(*args, **kws)
        finally:
            if saved is missing:
                try:
                    del warnings.__warningregistry__
                except AttributeError:
                    pass
            else:
                warnings.__warningregistry__ = saved
    return wrapper 
Example 5
Project: android_universal   Author: bkerler   File: test_loader.py    License: MIT License 5 votes vote down vote up
def warningregistry(func):
    def wrapper(*args, **kws):
        missing = []
        saved = getattr(warnings, '__warningregistry__', missing).copy()
        try:
            return func(*args, **kws)
        finally:
            if saved is missing:
                try:
                    del warnings.__warningregistry__
                except AttributeError:
                    pass
            else:
                warnings.__warningregistry__ = saved
    return wrapper