def main(catch): results = [check_ip(ip, catch) for ip in addresses] for result in results: if not result: continue click.secho(result, fg='magenta')
def check_ip_wo_catch(ip): gevent.sleep(random.choice(delays)) with semaphore: click.secho('Acquired semaphore.', bg='white', fg='black') result = check_ip(ip, False) click.secho('Release semaphore.', bg='white', fg='black') return result
def check_ip_wo_catch(ip): return check_ip(ip, False)
def check_ip_w_catch(ip): with semaphore: click.secho('Acquired semaphore.', bg='white', fg='black') result = check_ip(ip, True) click.secho('Release semaphore.', bg='white', fg='black') return result
def check_ip_w_catch(ip): return check_ip(ip, True)