Skip to content

info

Functions:

is_preview

is_preview() -> bool
Source code
10
11
12
13
14
15
16
17
18
19
20
21
22
def is_preview() -> bool:
    c_frame = [inspect.currentframe()]

    while (t := c_frame[-1] and c_frame[-1].f_back):
        c_frame.append(t)

        if t and '__name__' in t.f_locals:
            if t.f_locals['__name__'] == '__vspreview__':
                c_frame.clear()
                return True

    c_frame.clear()
    return False