summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--adblock/__init__.py1
-rw-r--r--adblock/adblock.pyi78
-rw-r--r--adblock/py.typed0
-rw-r--r--tests/test_engine.py1
5 files changed, 81 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index 7683933..e7384ce 100644
--- a/.gitignore
+++ b/.gitignore
@@ -121,6 +121,7 @@ share/python-wheels/
121.installed.cfg 121.installed.cfg
122*.egg 122*.egg
123MANIFEST 123MANIFEST
124*.so
124 125
125# PEP 582; used by e.g. github.com/David-OConnor/pyflow 126# PEP 582; used by e.g. github.com/David-OConnor/pyflow
126__pypackages__/ 127__pypackages__/
diff --git a/adblock/__init__.py b/adblock/__init__.py
new file mode 100644
index 0000000..28d0665
--- /dev/null
+++ b/adblock/__init__.py
@@ -0,0 +1 @@
from .adblock import *
diff --git a/adblock/adblock.pyi b/adblock/adblock.pyi
new file mode 100644
index 0000000..50a61e8
--- /dev/null
+++ b/adblock/adblock.pyi
@@ -0,0 +1,78 @@
1from typing import Optional, Dict, List, Set
2
3class BlockerResult:
4 matched: bool
5 explicit_cancel: bool
6 important: bool
7 redirect: Optional[str]
8 exception: Optional[str]
9 filter: Optional[str]
10 error: Optional[str]
11 def __repr__(self) -> str:
12 pass
13
14class HostnameSpecificResources:
15 hide_selectors: Set[str]
16 style_selectors: Dict[str, List[str]]
17 exceptions: Set[str]
18 injected_script: str
19 def __repr__(self) -> str:
20 pass
21
22class Engine:
23 def __init__(
24 self,
25 network_filters: Optional[List[str]] = None,
26 load_network: bool = True,
27 load_cosmetic: bool = False,
28 debug: bool = False,
29 ) -> None:
30 pass
31 def check_network_urls(
32 self, url: str, source_url: str, request_type: str
33 ) -> BlockerResult:
34 pass
35 def check_network_urls_with_hostnames(
36 self,
37 url: str,
38 hostname: str,
39 source_hostname: str,
40 request_type: str,
41 third_party_request: Optional[bool],
42 ) -> BlockerResult:
43 pass
44 def check_network_urls_with_hostnames_subset(
45 self,
46 url: str,
47 hostname: str,
48 source_hostname: str,
49 request_type: str,
50 third_party_request: Optional[bool],
51 previously_matched_rule: bool,
52 force_check_exceptions: bool,
53 ) -> BlockerResult:
54 pass
55 def serialize(self) -> bytes:
56 pass
57 def serialize_to_file(self, file: str) -> None:
58 pass
59 def deserialize(self, serialized: bytes) -> None:
60 pass
61 def deserialize_from_file(self, file: str) -> None:
62 pass
63 def add_filter_list(self, filter_list: str) -> None:
64 pass
65 def filter_exists(self, filter: str) -> bool:
66 pass
67 def tags_enable(self, tags: List[str]) -> None:
68 pass
69 def tags_disable(self, tags: List[str]) -> None:
70 pass
71 def tag_exists(self, tag: str) -> bool:
72 pass
73 def hostname_cosmetic_resources(self, hostname: str) -> HostnameSpecificResources:
74 pass
75 def hidden_class_id_selectors(
76 self, classes: List[str], ids: List[str], exceptions: Set[str]
77 ) -> List[str]:
78 pass
diff --git a/adblock/py.typed b/adblock/py.typed
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/adblock/py.typed
diff --git a/tests/test_engine.py b/tests/test_engine.py
index 602d794..af15b6d 100644
--- a/tests/test_engine.py
+++ b/tests/test_engine.py
@@ -1,5 +1,6 @@
1import adblock 1import adblock
2 2
3
3def test_engine_arguments(): 4def test_engine_arguments():
4 # None of these should panic 5 # None of these should panic
5 adblock.Engine() 6 adblock.Engine()