Skip to content

Commit

Permalink
fix: remove useless re-exports (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ravencentric committed Jun 23, 2024
1 parent 79ef55b commit fddaa72
Show file tree
Hide file tree
Showing 11 changed files with 209 additions and 517 deletions.
121 changes: 3 additions & 118 deletions docs/api-reference/exceptions.md
Original file line number Diff line number Diff line change
@@ -1,119 +1,4 @@
!!! note
`pynyaa` only provides a single exception of its own (`HTMLParsingError`).
The rest are simply re-exports from
[`httpx`](https://www.python-httpx.org/exceptions/) and
[`pydantic`](https://docs.pydantic.dev/latest/api/pydantic_core/#pydantic_core.ValidationError) for convenience.
`pynyaa` doesn't raise any custom exceptions of it's own. The two most likely errors you'll encounter will be either of these:

::: pynyaa._exceptions.HTMLParsingError
::: pynyaa._exceptions.CloseError
options:
show_source: false
members: false
::: pynyaa._exceptions.ConnectError
options:
show_source: false
members: false
::: pynyaa._exceptions.ConnectTimeout
options:
show_source: false
members: false
::: pynyaa._exceptions.CookieConflict
options:
show_source: false
members: false
::: pynyaa._exceptions.DecodingError
options:
show_source: false
members: false
::: pynyaa._exceptions.HTTPError
options:
show_source: false
members: false
::: pynyaa._exceptions.HTTPStatusError
options:
show_source: false
members: false
::: pynyaa._exceptions.InvalidURL
options:
show_source: false
members: false
::: pynyaa._exceptions.LocalProtocolError
options:
show_source: false
members: false
::: pynyaa._exceptions.NetworkError
options:
show_source: false
members: false
::: pynyaa._exceptions.PoolTimeout
options:
show_source: false
members: false
::: pynyaa._exceptions.ProtocolError
options:
show_source: false
members: false
::: pynyaa._exceptions.ProxyError
options:
show_source: false
members: false
::: pynyaa._exceptions.ReadError
options:
show_source: false
members: false
::: pynyaa._exceptions.ReadTimeout
options:
show_source: false
members: false
::: pynyaa._exceptions.RemoteProtocolError
options:
show_source: false
members: false
::: pynyaa._exceptions.RequestError
options:
show_source: false
members: false
::: pynyaa._exceptions.RequestNotRead
options:
show_source: false
members: false
::: pynyaa._exceptions.ResponseNotRead
options:
show_source: false
members: false
::: pynyaa._exceptions.StreamClosed
options:
show_source: false
members: false
::: pynyaa._exceptions.StreamConsumed
options:
show_source: false
members: false
::: pynyaa._exceptions.StreamError
options:
show_source: false
members: false
::: pynyaa._exceptions.TimeoutException
options:
show_source: false
members: false
::: pynyaa._exceptions.TooManyRedirects
options:
show_source: false
members: false
::: pynyaa._exceptions.UnsupportedProtocol
options:
show_source: false
members: false
::: pynyaa._exceptions.WriteError
options:
show_source: false
members: false
::: pynyaa._exceptions.WriteTimeout
options:
show_source: false
members: false
::: pynyaa._exceptions.ValidationError
options:
show_source: false
members: false
- `pynyaa.HTTPStatusError` - Alias for [`httpx.HTTPStatusError`](https://www.python-httpx.org/exceptions/). Raised if a request returns a non 2xx status code.
- `pynyaa.ValidationError` - Alias for [`pydantic.ValidationError`](https://docs.pydantic.dev/latest/errors/validation_errors/). Raised if an input is invalid.
11 changes: 0 additions & 11 deletions docs/api-reference/types.md

This file was deleted.

1 change: 0 additions & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,5 +84,4 @@ nav:
- Clients: api-reference/clients.md
- Models: api-reference/models.md
- Enums: api-reference/enums.md
- Types: api-reference/types.md
- Exceptions: api-reference/exceptions.md
2 changes: 1 addition & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

72 changes: 5 additions & 67 deletions src/pynyaa/__init__.py
Original file line number Diff line number Diff line change
@@ -1,85 +1,23 @@
from httpx import HTTPStatusError
from pydantic import ValidationError

from ._clients import AsyncNyaa, Nyaa
from ._enums import NyaaCategory
from ._exceptions import (
CloseError,
ConnectError,
ConnectTimeout,
CookieConflict,
DecodingError,
HTMLParsingError,
HTTPError,
HTTPStatusError,
InvalidURL,
LocalProtocolError,
NetworkError,
PoolTimeout,
ProtocolError,
ProxyError,
ReadError,
ReadTimeout,
RemoteProtocolError,
RequestError,
RequestNotRead,
ResponseNotRead,
StreamClosed,
StreamConsumed,
StreamError,
TimeoutException,
TooManyRedirects,
UnsupportedProtocol,
ValidationError,
WriteError,
WriteTimeout,
)
from ._models import NyaaTorrentPage
from ._types import AnyUrl, File, Filepath, HttpUrl, Torrent
from ._version import _get_version
from ._version import Version, _get_version

__version__ = _get_version()
__version_tuple__ = tuple(__version__.split("."))
__version_tuple__ = Version(*tuple(map(int, __version__.split("."))))

__all__ = [
# Clients
"AsyncNyaa",
"Nyaa",
# Enums
"NyaaCategory",
# Types
"AnyUrl",
"HttpUrl",
"Torrent",
"File",
"Filepath",
# Models
"NyaaTorrentPage",
# Exceptions
"CloseError",
"ConnectError",
"ConnectTimeout",
"CookieConflict",
"DecodingError",
"HTMLParsingError",
"HTTPError",
"HTTPStatusError",
"InvalidURL",
"LocalProtocolError",
"NetworkError",
"PoolTimeout",
"ProtocolError",
"ProxyError",
"ReadError",
"ReadTimeout",
"RemoteProtocolError",
"RequestError",
"RequestNotRead",
"ResponseNotRead",
"StreamClosed",
"StreamConsumed",
"StreamError",
"TimeoutException",
"TooManyRedirects",
"UnsupportedProtocol",
"WriteError",
"WriteTimeout",
"ValidationError",
]
Loading

0 comments on commit fddaa72

Please sign in to comment.