

@pytest.fixture
def throttle_history(expired_throttle_history, retry_after_value):
    '\n    Contains multiple randomly generated throttle snapshots in storage. There\n    is one snapshot where search service has black status and a retry-after\n    value.\n    '
    storage = expired_throttle_history
    system_stats = ('idle', 'busy', 'overloaded')
    lights = ('green', 'yellow', 'red')
    sample_count = 4
    expected = {
        
    }
    service_limits = {
        
    }

    def _range(end, step=(- 10)):
        start = (end + ((- step) * (sample_count - 1)))
        return range(start, (end - 1), step)

    def _services_dicts(limits):
        snapshots = []
        for i in range(sample_count):
            sd = {
                
            }
            for (k, v) in limits.items():
                sd[k] = (choice(lights), v[i])
            snapshots.append(sd)
        return snapshots
    for (service, limit) in zip(SQLite.SERVICES, (200, 100, 60, 10, 5)):
        expected[service] = (60.0 / limit)
        service_limits[service] = list(_range(limit))
        shuffle(service_limits[service])
    for d in _services_dicts(service_limits):
        storage.update(make_header(make_throttle_snapshot(choice(system_stats), d).as_header()))
    services = list(SQLite.SERVICES)
    system_stats.remove('search')
    services = ', '.join(['{0}=green:1000'.format(s) for s in services])
    storage.update(make_header('{0} (search=black:0, {1})'.format(choice(system_stats), services), retry_after_value))
    expected['search'] = (retry_after_value / 1000.0)
    th = {
        'expected': expected,
        'storage': storage,
    }
    return th

dataset/ETHPy150Open 55minutes/python-epo-ops-client/tests/middlewares/throttle/conftest.py throttle_history/VarMisuse@290/420 `services`->`system_stats`