Skip to content

Markers

Various markers.

UNREACHABLE = 'code marked as `unreachable` was reached' module-attribute

The default unreachable panic message.

unreachable(message: Optional[str] = None) -> Never

Marks points in code as unreachable.

Panics with the message given. If not provided, UNREACHABLE is used.

Parameters:

Name Type Description Default
message Optional[str]

The message to panic with.

None

Raises:

Type Description
Panic

Always raised when calling.

Source code in src/wraps/markers.py
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
def unreachable(message: Optional[str] = None) -> Never:
    """Marks points in code as unreachable.

    Panics with the message given. If not provided,
    [`UNREACHABLE`][wraps.markers.UNREACHABLE] is used.

    Arguments:
        message: The message to panic with.

    Raises:
        Panic: Always raised when calling.
    """
    if message is None:
        message = UNREACHABLE

    panic(message)