def expand_braces(patterns, flags):
    """Expand braces."""

    if flags & BRACE:
        for p in ([patterns] if isinstance(patterns, (str, bytes)) else patterns):
            try:
                yield from bracex.iexpand(p, keep_escapes=True)
            except Exception:  # pragma: no cover
                # We will probably never hit this as `bracex`
                # doesn't throw any specific exceptions and
                # should normally always parse, but just in case.
                yield p
    else:
        for p in ([patterns] if isinstance(patterns, (str, bytes)) else patterns):
            yield p
def expand_braces ( patterns , flags ) : if flags & BRACE : for p in ( [ patterns ] if isinstance ( patterns , ( str , bytes ) ) else patterns ) : try : yield from bracex . iexpand ( p , keep_escapes = True ) except Exception : yield p else : for p in ( [ patterns ] if isinstance ( patterns , ( str , bytes ) ) else patterns ) : yield p
Expand braces.