File: __init__.py

package info (click to toggle)
python-keyring 25.6.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 560 kB
  • sloc: python: 1,929; sh: 17; makefile: 17
file content (11 lines) | stat: -rw-r--r-- 302 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
import contextlib


def suppress_exceptions(callables, exceptions=Exception):
    """
    yield the results of calling each element of callables, suppressing
    any indicated exceptions.
    """
    for callable in callables:
        with contextlib.suppress(exceptions):
            yield callable()