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 _on_lists_downloaded(self, done_count: int, filter_set: "adblock.FilterSet") -> None: """Install block lists after files have been downloaded.""" self._engine = adblock.Engine(filter_set) self._engine.serialize_to_file(str(self._cache_path)) message.info( f"braveadblock: Filters successfully read from {done_count} sources." )
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