From acc934e6ba9494f429adb477757ca3f383797e80 Mon Sep 17 00:00:00 2001 From: Andrew Svetlov Date: Sun, 19 Jul 2020 12:51:57 +0300 Subject: [PATCH] Hide Query and QueryVariable type aliases (#475) --- CHANGES/431.bugfix | 1 + yarl/__init__.pyi | 18 +++++++++--------- 2 files changed, 10 insertions(+), 9 deletions(-) create mode 100644 CHANGES/431.bugfix diff --git a/CHANGES/431.bugfix b/CHANGES/431.bugfix new file mode 100644 index 000000000..d5a2ae3f2 --- /dev/null +++ b/CHANGES/431.bugfix @@ -0,0 +1 @@ +Hide `Query` and `QueryVariable` type aliases in `__init__.pyi`, now they are prefixed with underscore. \ No newline at end of file diff --git a/yarl/__init__.pyi b/yarl/__init__.pyi index f0a3b7192..d04f38bd2 100644 --- a/yarl/__init__.pyi +++ b/yarl/__init__.pyi @@ -1,9 +1,9 @@ from typing import overload, Any, Tuple, Optional, Mapping, Union, Sequence, Type import multidict -QueryVariable = Union[str, int] -Query = Union[ - None, str, Mapping[str, QueryVariable], Sequence[Tuple[str, QueryVariable]] +_QueryVariable = Union[str, int] +_Query = Union[ + None, str, Mapping[str, _QueryVariable], Sequence[Tuple[str, _QueryVariable]] ] class URL: @@ -42,7 +42,7 @@ class URL: host: str = ..., port: Optional[int] = ..., path: str = ..., - query: Optional[Query] = ..., + query: Optional[_Query] = ..., query_string: str = ..., fragment: str = ..., encoded: bool = ... @@ -56,7 +56,7 @@ class URL: def __gt__(self, other: Any) -> bool: ... def __hash__(self) -> int: ... def __truediv__(self, name: str) -> URL: ... - def __mod__(self, query: Query) -> URL: ... + def __mod__(self, query: _Query) -> URL: ... def is_absolute(self) -> bool: ... def is_default_port(self) -> bool: ... def origin(self) -> URL: ... @@ -68,13 +68,13 @@ class URL: def with_port(self, port: Optional[int]) -> URL: ... def with_path(self, path: str, *, encoded: bool = ...) -> URL: ... @overload - def with_query(self, query: Query) -> URL: ... + def with_query(self, query: _Query) -> URL: ... @overload - def with_query(self, **kwargs: QueryVariable) -> URL: ... + def with_query(self, **kwargs: _QueryVariable) -> URL: ... @overload - def update_query(self, query: Query) -> URL: ... + def update_query(self, query: _Query) -> URL: ... @overload - def update_query(self, **kwargs: QueryVariable) -> URL: ... + def update_query(self, **kwargs: _QueryVariable) -> URL: ... def with_fragment(self, fragment: Optional[str]) -> URL: ... def with_name(self, name: str) -> URL: ... def join(self, url: URL) -> URL: ...