def __init__(self, *, data_dir: pathlib.Path, has_basedir: bool = False) -> None: self.enabled = _should_be_used() self._has_basedir = has_basedir self._cache_path = data_dir / "adblock-cache.dat" self._engine = adblock.Engine(adblock.FilterSet())
def adblock_update(self) -> blockutils.BlocklistDownloads: """Update the adblock block lists.""" logger.info("Downloading adblock filter lists...") filter_set = adblock.FilterSet() dl = blockutils.BlocklistDownloads(config.val.content.blocking.adblock.lists) dl.single_download_finished.connect( functools.partial(self._on_download_finished, filter_set=filter_set) ) dl.all_downloads_finished.connect( functools.partial(self._on_lists_downloaded, filter_set=filter_set) ) dl.initiate() return dl
def __init__(self, *, data_dir: pathlib.Path, has_basedir: bool = False) -> None: self.enabled = _should_be_used() self._has_basedir = has_basedir self._cache_path = data_dir / "adblock-cache.dat" try: self._engine = adblock.Engine(adblock.FilterSet()) except AttributeError: # this should never happen - let's get some infos if it does logger.debug(f"adblock module: {adblock}") dist = version.distribution() if (dist is not None and dist.parsed == version.Distribution.arch and hasattr(adblock, "__file__")): proc = subprocess.run( ['pacman', '-Qo', adblock.__file__], stdout=subprocess.PIPE, universal_newlines=True, check=False, ) logger.debug(proc.stdout) raise