Utilities

async fast_channels.utils.await_many_dispatch(consumer_callables: list[Callable[[], Awaitable[Mapping[str, Any]]]], dispatch: Callable[[Any], Awaitable[None]]) None

Given a set of consumer callables, awaits on them all and passes results from them to the dispatch awaitable as they come in.

Parameters:
  • consumer_callables – List of async callables to await on.

  • dispatch – Function to call with results as they come in.

fast_channels.utils.is_same_domain(host: str, pattern: str) bool

Return True if the host is either an exact match or a match to the wildcard pattern.

Any pattern beginning with a period matches a domain and all of its subdomains. (e.g. .example.com matches example.com and foo.example.com). Anything else is an exact string match.

Parameters:
  • host – The hostname to check.

  • pattern – The pattern to match against (may include wildcards).

Returns:

True if the host matches the pattern.