Skip to content

Commit

Permalink
hide warnings when running with asyncio (without flag --sync) to have…
Browse files Browse the repository at this point in the history
… a clean output. Related to bug scivision#10 in the parent repository of this projects
  • Loading branch information
adrihacar committed Aug 24, 2022
1 parent b53de83 commit c7ffa85
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/mkdocs_linkcheck/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import re
import asyncio
import os
import warnings
from operator import itemgetter

from .coro import check_urls as check_urls_async
Expand Down Expand Up @@ -200,6 +201,7 @@ def check_remotes(
hdr = {"User-Agent": USER_AGENT}

# %% session
warnings.simplefilter("ignore")
if use_async:
missing = asyncio.run(
check_urls_async( urls, hdr=hdr, method=method )
Expand Down
2 changes: 0 additions & 2 deletions src/mkdocs_linkcheck/coro.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,9 @@ async def check_urls(
) -> list[tuple[str, str, T.Any]]:
tasks = [check_url(u, hdr, method=method) for u in urls]

warnings.simplefilter("ignore")

urls = await asyncio.gather(*tasks)

warnings.resetwarnings()

# this is per aiohttp manual, when using HTTPS SSL sites, just before closing
# the event loop, do a 250ms sleep (not for each site)
Expand Down

0 comments on commit c7ffa85

Please sign in to comment.