original_docstring: Build the list of enabled source ips.
docstring: Build the list of enabled source ips.
docstring_tokens: Build the list of enabled source ips .
code: async def async_get_enabled_source_ips(
      hass: HomeAssistant,
  ) -> list[IPv4Address | IPv6Address]:
      """Build the list of enabled source ips."""
      adapters = await async_get_adapters(hass)
      sources: list[IPv4Address | IPv6Address] = []
      for adapter in adapters:
          if not adapter["enabled"]:
              continue
          if adapter["ipv4"]:
              sources.extend(IPv4Address(ipv4["address"]) for ipv4 in adapter["ipv4"])
          if adapter["ipv6"]:
              # With python 3.9 add scope_ids can be
              # added by enumerating adapter["ipv6"]s
              # IPv6Address(f"::%{ipv6['scope_id']}")
              sources.extend(IPv6Address(ipv6["address"]) for ipv6 in adapter["ipv6"])
  
      return sources
code_tokens: async def async_get_enabled_source_ips ( hass : HomeAssistant , ) -> list [ IPv4Address | IPv6Address ] : adapters = await async_get_adapters ( hass ) sources : list [ IPv4Address | IPv6Address ] = [ ] for adapter in adapters : if not adapter [ "enabled" ] : continue if adapter [ "ipv4" ] : sources . extend ( IPv4Address ( ipv4 [ "address" ] ) for ipv4 in adapter [ "ipv4" ] ) if adapter [ "ipv6" ] : sources . extend ( IPv6Address ( ipv6 [ "address" ] ) for ipv6 in adapter [ "ipv6" ] ) return sources
short_docstring: Build the list of enabled source ips.
short_docstring_tokens: Build the list of enabled source ips .
comment: """Build the list of enabled source ips."""$SEP$# With python 3.9 add scope_ids can be$SEP$# added by enumerating adapter["ipv6"]s$SEP$# IPv6Address(f"::%{ipv6['scope_id']}")