22#
33# typing.py
44"""
5- Common aliases for type hinting.
6-
7- **Data:**
8-
9- .. autosummary2::
10-
11- ~domdf_python_tools.typing.PathLike
12- ~domdf_python_tools.typing.AnyNumber
13- ~domdf_python_tools.typing.WrapperDescriptorType, The type of methods of some built-in data types and base classes.
14- ~domdf_python_tools.typing.MethodWrapperType, The type of *bound* methods of some built-in data types and base classes.
15- ~domdf_python_tools.typing.MethodDescriptorType, The type of methods of some built-in data types.
16- ~domdf_python_tools.typing.ClassMethodDescriptorType, The type of *unbound* class methods of some built-in data types.
17-
5+ Various type annotation aids.
186"""
197#
208# Copyright © 2020 Dominic Davis-Foster <dominic@davis-foster.co.uk>
7058 "PathLike" ,
7159 "PathType" ,
7260 "AnyNumber" ,
73- "check_membership" ,
74- "JsonLibrary" ,
7561 "WrapperDescriptorType" ,
7662 "MethodWrapperType" ,
7763 "MethodDescriptorType" ,
7864 "ClassMethodDescriptorType" ,
65+ "JsonLibrary" ,
7966 "HasHead" ,
8067 "String" ,
8168 "FrameOrSeries" ,
8471 "SupportsLessEqual" ,
8572 "SupportsGreaterThan" ,
8673 "SupportsGreaterEqual" ,
74+ "check_membership" ,
8775 ]
8876
8977PathLike = Union [str , pathlib .Path , os .PathLike ]
@@ -126,9 +114,9 @@ def check_membership(obj: Any, type_: Union[Type, object]) -> bool:
126114
127115class JsonLibrary (Protocol ):
128116 """
129- Type hint for functions that take a JSON serialisation-deserialisation library as an argument .
117+ :class:`typing.Protocol` for libraries that implement the same API as :mod:`json` .
130118
131- The library implement at least the following methods:
119+ Useful for annotating functions which take a JSON serialisation-deserialisation library as an argument.
132120 """
133121
134122 @staticmethod
@@ -262,7 +250,10 @@ class SupportsLessThan(Protocol):
262250 .. versionadded:: 3.0.0
263251 """
264252
265- def __lt__ (self , __other : Any ) -> bool : ...
253+ def __lt__ (self , __other : Any ) -> bool :
254+ """
255+ Return ``self < value``.
256+ """
266257
267258
268259class SupportsLessEqual (Protocol ):
@@ -272,7 +263,10 @@ class SupportsLessEqual(Protocol):
272263 .. versionadded:: 3.0.0
273264 """
274265
275- def __le__ (self , __other : Any ) -> bool : ...
266+ def __le__ (self , __other : Any ) -> bool :
267+ """
268+ Return ``self <= value``.
269+ """
276270
277271
278272class SupportsGreaterThan (Protocol ):
@@ -282,7 +276,10 @@ class SupportsGreaterThan(Protocol):
282276 .. versionadded:: 3.0.0
283277 """
284278
285- def __gt__ (self , __other : Any ) -> bool : ...
279+ def __gt__ (self , __other : Any ) -> bool :
280+ """
281+ Return ``self > value``.
282+ """
286283
287284
288285class SupportsGreaterEqual (Protocol ):
@@ -292,4 +289,7 @@ class SupportsGreaterEqual(Protocol):
292289 .. versionadded:: 3.0.0
293290 """
294291
295- def __ge__ (self , __other : Any ) -> bool : ...
292+ def __ge__ (self , __other : Any ) -> bool :
293+ """
294+ Return ``self >= value``.
295+ """
0 commit comments