diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..5714eba --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1 @@ +include hibpwned/py.typed diff --git a/hibpwned/__init__.py b/hibpwned/__init__.py index e61b904..3c0a344 100644 --- a/hibpwned/__init__.py +++ b/hibpwned/__init__.py @@ -17,6 +17,15 @@ import hashlib import requests +ReturnAlias = int | list[dict[str, str | int | bool]] + +AltReturnAlias = int | list[dict[str, str | int | bool]] | list[str] + +DataAlias = list[dict[str, str | int | bool]] | dict[str, str | int | bool] + +AltDataAlias = (list[dict[str, str | int | bool]] + | dict[str, str | int | bool] | list[str]) + def _check(resp: requests.models.Response) -> None: """Helper function to check the response code and prints anything @@ -196,15 +205,6 @@ class Pwned: >>> foo = Pwned("test@example.com", "My_App", "My_API_Key") >>> data = foo.search_password("BadPassword") """ - ReturnAlias = (int | list[dict[str, str | int | bool]]) - - AltReturnAlias = (int | list[dict[str, str | int | bool]] | list[str]) - - DataAlias = (list[dict[str, str | int | bool]] - | dict[str, str | int | bool]) - AltDataAlias = (list[dict[str, str | int | bool]] - | dict[str, str | int | bool] | list[str]) - url: str resp: requests.models.Response truncate_string: str @@ -229,7 +229,6 @@ def __init__(self, account: str, agent: str, key: str) -> None: } self.timeout = 300 - # pylint: disable=undefined-variable def search_all_breaches(self, truncate: bool | None = False, domain: str | None = None, @@ -296,7 +295,6 @@ def search_all_breaches(self, return alt_data return resp.status_code - # pylint: disable=undefined-variable def all_breaches(self, domain: str | None = None) -> ReturnAlias: """Retrieves all breached sites from the system. The result set can also be filtered by domain by passing the argument diff --git a/hibpwned/__init__.pyi b/hibpwned/__init__.pyi new file mode 100644 index 0000000..6d64a30 --- /dev/null +++ b/hibpwned/__init__.pyi @@ -0,0 +1,61 @@ +"""__init__.pyi""" + +from __future__ import annotations +import requests + +ReturnAlias = int | list[dict[str, str | int | bool]] + +AltReturnAlias = int | list[dict[str, str | int | bool]] | list[str] + +DataAlias = list[dict[str, str | int | bool]] | dict[str, str | int | bool] + +AltDataAlias = (list[dict[str, str | int | bool]] + | dict[str, str | int | bool] | list[str]) + + +def _check(resp: requests.models.Response) -> None: + ... + + +class Pwned: + + url: str + resp: requests.models.Response + truncate_string: str + domain_string: str + unverified_string: str + classes: list[str] + hashes: str + hash_list: list[str] + hexdig: str + hsh: str + pnum: str + data: DataAlias + alt_data: AltDataAlias + + def __init__(self, account: str, agent: str, key: str) -> None: + ... + + def search_all_breaches(self, + truncate: bool | None = False, + domain: str | None = None, + unverified: bool | None = False) -> AltReturnAlias: + ... + + def all_breaches(self, domain: str | None = None) -> ReturnAlias: + ... + + def single_breach(self, name: str) -> ReturnAlias: + ... + + def data_classes(self) -> int | list[str]: + ... + + def search_pastes(self) -> ReturnAlias: + ... + + def search_password(self, password: str) -> int | str: + ... + + def search_hashes(self, hsh: str) -> int | str: + ... diff --git a/hibpwned/py.typed b/hibpwned/py.typed new file mode 100644 index 0000000..1242d43 --- /dev/null +++ b/hibpwned/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. diff --git a/pyproject.toml b/pyproject.toml index 07e8bd3..93f007d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "hibpwned" -version = "1.3.8" +version = "1.3.9" authors = [ { name="plasticuproject", email="plasticuproject@pm.me" }, ] @@ -15,7 +15,7 @@ requires-python = ">=3.11" classifiers = [ "Programming Language :: Python :: 3", "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", - "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", + "License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)", "Operating System :: OS Independent", "Topic :: Utilities", "Topic :: Utilities" ]