Merge .pyi type stubs inline (#563)

* Merged types into .py code.

Signed-off-by: dblock <[email protected]>

* Fix: nox -rs generate.

Signed-off-by: dblock <[email protected]>

* Updated CHANGELOG.

Signed-off-by: dblock <[email protected]>

* Use lowest common python version for lint.

Signed-off-by: dblock <[email protected]>

* Fix: don't typeshed.

Signed-off-by: dblock <[email protected]>

* Removed unneeded comment.

Signed-off-by: dblock <[email protected]>

* Simplify OPENSEARCH_URL.

Signed-off-by: dblock <[email protected]>

* Fix: positional ignore_status used as chunk_size.

Signed-off-by: dblock <[email protected]>

* Fix: parse version string.

Signed-off-by: dblock <[email protected]>

* Remove future annotations for Python 3.6.

Signed-off-by: dblock <[email protected]>

* Fix: types in documentation.

Signed-off-by: dblock <[email protected]>

* Improve CHANGELOG text.

Signed-off-by: dblock <[email protected]>

* Re-added missing separator.

Signed-off-by: dblock <[email protected]>

* Remove duplicate licenses.

Signed-off-by: dblock <[email protected]>

* Get rid of Optional[Any].

Signed-off-by: dblock <[email protected]>

* Fix docs with AsyncOpenSearch.

Signed-off-by: dblock <[email protected]>

* Fix: undo comment.

Signed-off-by: dblock <[email protected]>

---------

Signed-off-by: dblock <[email protected]>
This commit is contained in:
Daniel (dB.) Doubrovkine
2023-11-06 10:08:19 -08:00
committed by GitHub
parent 0d8a23dd78
commit dcb79cc322
268 changed files with 6218 additions and 16378 deletions
+9 -7
View File
@@ -26,13 +26,12 @@
# under the License.
import operator
from typing import Any
from six import iteritems, string_types
from .utils import AttrDict
__all__ = ["Range"]
class Range(AttrDict):
OPS = {
@@ -42,7 +41,7 @@ class Range(AttrDict):
"gte": operator.ge,
}
def __init__(self, *args, **kwargs):
def __init__(self, *args: Any, **kwargs: Any) -> None:
if args and (len(args) > 1 or kwargs or not isinstance(args[0], dict)):
raise ValueError(
"Range accepts a single dictionary or a set of keyword arguments."
@@ -61,10 +60,10 @@ class Range(AttrDict):
super(Range, self).__init__(args[0] if args else kwargs)
def __repr__(self):
def __repr__(self) -> str:
return "Range(%s)" % ", ".join("%s=%r" % op for op in iteritems(self._d_))
def __contains__(self, item):
def __contains__(self, item: Any) -> bool:
if isinstance(item, string_types):
return super(Range, self).__contains__(item)
@@ -74,7 +73,7 @@ class Range(AttrDict):
return True
@property
def upper(self):
def upper(self) -> Any:
if "lt" in self._d_:
return self._d_["lt"], False
if "lte" in self._d_:
@@ -82,9 +81,12 @@ class Range(AttrDict):
return None, False
@property
def lower(self):
def lower(self) -> Any:
if "gt" in self._d_:
return self._d_["gt"], False
if "gte" in self._d_:
return self._d_["gte"], True
return None, False
__all__ = ["Range"]