diff options
| -rw-r--r-- | src/lib.rs | 12 |
1 files changed, 5 insertions, 7 deletions
| @@ -11,12 +11,12 @@ | |||
| 11 | deprecated | 11 | deprecated |
| 12 | )] | 12 | )] |
| 13 | 13 | ||
| 14 | use adblock::blocker::{BlockerError as RustBlockerError, Redirection}; | ||
| 15 | use adblock::blocker::BlockerResult as RustBlockerResult; | 14 | use adblock::blocker::BlockerResult as RustBlockerResult; |
| 15 | use adblock::blocker::{BlockerError as RustBlockerError, Redirection}; | ||
| 16 | use adblock::cosmetic_filter_cache::UrlSpecificResources as RustUrlSpecificResources; | 16 | use adblock::cosmetic_filter_cache::UrlSpecificResources as RustUrlSpecificResources; |
| 17 | use adblock::engine::Engine as RustEngine; | 17 | use adblock::engine::Engine as RustEngine; |
| 18 | use adblock::lists::{FilterFormat, ParseOptions}; | ||
| 19 | use adblock::lists::FilterSet as RustFilterSet; | 18 | use adblock::lists::FilterSet as RustFilterSet; |
| 19 | use adblock::lists::{FilterFormat, ParseOptions}; | ||
| 20 | use pyo3::class::PyObjectProtocol; | 20 | use pyo3::class::PyObjectProtocol; |
| 21 | use pyo3::create_exception; | 21 | use pyo3::create_exception; |
| 22 | use pyo3::exceptions::PyException; | 22 | use pyo3::exceptions::PyException; |
| @@ -24,16 +24,15 @@ use pyo3::prelude::*; | |||
| 24 | use pyo3::types::PyBytes; | 24 | use pyo3::types::PyBytes; |
| 25 | use pyo3::PyErr; | 25 | use pyo3::PyErr; |
| 26 | 26 | ||
| 27 | use adblock::resources::{ | ||
| 28 | AddResourceError as RustAddResourceError, MimeType, Resource, ResourceType, | ||
| 29 | }; | ||
| 27 | use std::collections::HashMap; | 30 | use std::collections::HashMap; |
| 28 | use std::collections::HashSet; | 31 | use std::collections::HashSet; |
| 29 | use std::error::Error; | 32 | use std::error::Error; |
| 30 | use std::fmt::{self, Display}; | 33 | use std::fmt::{self, Display}; |
| 31 | use std::fs; | 34 | use std::fs; |
| 32 | use std::io::{Read, Write}; | 35 | use std::io::{Read, Write}; |
| 33 | use adblock::resources::{ | ||
| 34 | AddResourceError as RustAddResourceError, MimeType, Resource, ResourceType, | ||
| 35 | }; | ||
| 36 | |||
| 37 | 36 | ||
| 38 | /// Brave's adblocking library in Python! | 37 | /// Brave's adblocking library in Python! |
| 39 | #[pymodule] | 38 | #[pymodule] |
| @@ -197,7 +196,6 @@ create_exception!(adblock, BadFilterAddUnsupported, BlockerException); | |||
| 197 | create_exception!(adblock, FilterExists, BlockerException); | 196 | create_exception!(adblock, FilterExists, BlockerException); |
| 198 | create_exception!(adblock, AddResourceError, BlockerException); | 197 | create_exception!(adblock, AddResourceError, BlockerException); |
| 199 | 198 | ||
| 200 | |||
| 201 | impl From<BlockerError> for PyErr { | 199 | impl From<BlockerError> for PyErr { |
| 202 | fn from(err: BlockerError) -> Self { | 200 | fn from(err: BlockerError) -> Self { |
| 203 | let msg = format!("{:?}", err); | 201 | let msg = format!("{:?}", err); |
