()
return mirrors
Discover "geographically suitable" Ubuntu mirrors.
Discover "geographically suitable" Ubuntu mirrors.
Discover geographically suitable Ubuntu mirrors .
def discover_mirror_selection():
    """Discover "geographically suitable" Ubuntu mirrors."""
    timer = Timer()
    logger.info("Identifying fast Ubuntu mirrors using %s ..", MIRROR_SELECTION_URL)
    data = fetch_url(MIRROR_SELECTION_URL, timeout=3, retry=True, max_attempts=5)
    # shorter timeout with more retries is good for unstable connections to MIRROR_SELECTION_URL
    dammit = UnicodeDammit(data)
    mirrors = set(
        CandidateMirror(mirror_url=mirror_url.strip())
        for mirror_url in dammit.unicode_markup.splitlines()
        if mirror_url and not mirror_url.isspace() and mirror_url.startswith(('http://', 'https://'))
    )
    logger.debug("Found %s in %s.", pluralize(len(mirrors), "fast Ubuntu mirror"), timer)
    return mirrors
def discover_mirror_selection ( ) : timer = Timer ( ) logger . info ( "Identifying fast Ubuntu mirrors using %s .." , MIRROR_SELECTION_URL ) data = fetch_url ( MIRROR_SELECTION_URL , timeout = 3 , retry = True , max_attempts = 5 ) # shorter timeout with more retries is good for unstable connections to MIRROR_SELECTION_URL dammit = UnicodeDammit ( data ) mirrors = set ( CandidateMirror ( mirror_url = mirror_url . strip ( ) ) for mirror_url in dammit . unicode_markup . splitlines ( ) if mirror_url and not mirror_url . isspace ( ) and mirror_url . startswith ( ( 'http://' , 'https://' ) ) ) logger . debug ( "Found %s in %s." , pluralize ( len ( mirrors ) , "fast Ubuntu mirror" ) , timer ) return mirrors