HEX
Server: Apache/2.4.46 (Win64) OpenSSL/1.1.1j PHP/8.4.25
System: Windows NT DESKTOP-4TAV2RJ 10.0 build 19045 (Windows 10) AMD64
User: fred (0)
PHP: 8.4.25
Disabled: NONE
Upload Files
File: C:/Users/fred/anaconda3/Lib/site-packages/astropy/utils/tests/test_progress_bar_func.py
import time

import numpy as np

from astropy.utils.misc import NumpyRNGContext


def func(i):
    """An identity function that jitters its execution time by a
    pseudo-random amount.

    FIXME: This function should be defined in test_console.py, but Astropy's
    test runner interacts strangely with Python's `multiprocessing`
    module. I was getting a mysterious PicklingError until I moved this
    function into a separate module. (It worked fine in a standalone pytest
    script.)"""
    with NumpyRNGContext(i):
        time.sleep(np.random.uniform(0, 0.01))
    return i