This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from extras.validators import CustomValidator | |
from virtualization.models import VirtualMachine | |
class UniqueVirtualMachineNamesCasefold(CustomValidator): | |
"""Enforce case-insensitive unique VM names. | |
Your configuration.py file would contain something like this: | |
CUSTOM_VALIDATORS = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import asyncio | |
async def task(seconds: int=5): | |
"""Sleep for some time.""" | |
await asyncio.sleep(seconds) | |
return f"slept {seconds} seconds!" | |
async def multi_task(sleeps_to_sleep: list[int]): | |
"""Start coroutines from a list of inputs.""" | |
all_the_tasks = [task(sleep_time) for sleep_time in sleeps_to_sleep] |
OlderNewer