python-adblock

Updated Brave adblock library for Python
Log | Files | Refs | README

commit 05f646792baf08121e6e8b3f798551714194d153
parent e9c68701334fa5ccf464418399a7aef14752b0bc
Author: Árni Dagur <agudmundsson@fc-md.umd.edu>
Date:   Mon,  4 May 2020 22:03:35 -0400

Gag stderr for 'add_filter_list'

Diffstat:
MCargo.toml | 1+
Msrc/lib.rs | 4++++
2 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/Cargo.toml b/Cargo.toml @@ -11,6 +11,7 @@ debug = true [dependencies] adblock = "0.2.8" pyo3 = "0.9" +gag = "0.1" [lib] name="adblock" diff --git a/src/lib.rs b/src/lib.rs @@ -18,6 +18,7 @@ use pyo3::class::PyObjectProtocol; use pyo3::exceptions::ValueError as PyValueError; use pyo3::prelude::*; use pyo3::PyErr; +use gag::Gag; use std::collections::HashMap; use std::collections::HashSet; @@ -350,6 +351,9 @@ impl Engine { /// Add the contents of a block list file to the blocking engine. #[text_signature = "($self, filter_list)"] pub fn add_filter_list(&mut self, filter_list: &str) { + // Gag the any messages to stderr. This is necessary until issue + // https://github.com/brave/adblock-rust/issues/88 is closed. + let _stderr_gag = Gag::stderr(); self.engine.add_filter_list(filter_list); }