Package: annotate
annotateFunction annotations.Overview@annotateDecorator to set a function’s __annotations__ like Py3.https://www.python.org/dev/peps/pep-3107/PyPI record.Documentation.ExamplesfromtypingimportOptional,Tuple,Union,Sequencefromannotateimportannotatefrom.libimportcachedfrom.importjnifrom.jobjectbaseimportJObjectBasefrom.jclassimportJClassfrom.jobjectimportJObjectclassJArray(JObjectBase):"""Java Array"""@classmethod@annotate('JArray',size=Union[int,long])defnewBooleanArray(cls,size):......@classmethod@annotate('JArray',size=Union[int,long])defnewDoubleArray(cls,size):...@classmethod@annotate('JArray',size=Union[int,long])defnewStringArray(cls,size):...@classmethod@annotate('JArray',size=Union[int,long],component_class=JClass)defnewObjectArray(cls,size,component_class):...@annotate(jenv=jni.JNIEnv,jarr=jni.jarray,borrowed=bool)def__init__(self,jenv,jarr,borrowed=False):...def__hash__(self):returnsuper(JArray,self).__hash__()def__len__(self):returnself.getLength()@annotate(JObject,borrowed=bool)defasObject(self,borrowed=False):...@cached@annotate(int)defgetLength(self):...@annotate(bool,idx=int)defgetBoolean(self,idx):......@annotate(float,idx=int)defgetDouble(self,idx):...@annotate(Optional[str],idx=int)defgetString(self,idx):...@annotate(Optional[JObject],idx=int)defgetObject(self,idx):...@annotate(idx=int,val=bool)defsetBoolean(self,idx,val):...@annotate(idx=int,val=str)defsetChar(self,idx,val):......@annotate(idx=int,val=Union[int,long])defsetLong(self,idx,val):...@annotate(idx=int,val=float)defsetDouble(self,idx,val):...@annotate(idx=int,val=Optional[str])defsetString(self,idx,val):...@annotate(idx=int,val=Optional[JObject])defsetObject(self,idx,val):...@annotate('JArray',start=int,stop=int,step=int)defgetBooleanSlice(self,start,stop,step):......@annotate('JArray',start=int,stop=int,step=int)defgetDoubleSlice(self,start,stop,step):...@annotate('JArray',start=int,stop=int,step=int)defgetStringSlice(self,start,stop,step):...@annotate('JArray',start=int,stop=int,step=int)defgetObjectSlice(self,start,stop,step):...@annotate(start=int,stop=int,step=int,val=Sequence[bool])defsetBooleanSlice(self,start,stop,step,val):...@annotate(start=int,stop=int,step=int,val=Union[Sequence[str],str])defsetCharSlice(self,start,stop,step,val):...@annotate(start=int,stop=int,step=int,val=Union[Sequence[Union[int,bytes]],(bytes,bytearray)])defsetByteSlice(self,start,stop,step,val):......@annotate(start=int,stop=int,step=int,val=Sequence[float])defsetDoubleSlice(self,start,stop,step,val):...@annotate(start=int,stop=int,step=int,val=Sequence[Optional[str]])defsetStringSlice(self,start,stop,step,val):...@annotate(start=int,stop=int,step=int,val=Sequence[Optional[JObject]])defsetObjectSlice(self,start,stop,step,val):...@annotate(Tuple)defgetBooleanBuffer(self):withself.jvmas(jvm,jenv):is_copy=jni.jboolean()returnjenv.GetBooleanArrayElements(self._jobj,is_copy),jni.sizeof(jni.jboolean),b"B",is_copy...@annotate(Tuple)defgetDoubleBuffer(self):withself.jvmas(jvm,jenv):is_copy=jni.jboolean()returnjenv.GetDoubleArrayElements(self._jobj,is_copy),jni.sizeof(jni.jdouble),b"d",is_copy@annotate(buf=object)defreleaseBooleanBuffer(self,buf):withself.jvmas(jvm,jenv):jenv.ReleaseBooleanArrayElements(self._jobj,jni.cast(buf,jni.POINTER(jni.jboolean)))...@annotate(buf=object)defreleaseDoubleBuffer(self,buf):withself.jvmas(jvm,jenv):jenv.ReleaseDoubleArrayElements(self._jobj,jni.cast(buf,jni.POINTER(jni.jdouble)))InstallationPrerequisites:Python 3.7 or higherhttps://www.python.org/3.7 is a primary test environment.pip and setuptoolshttps://pypi.org/project/pip/https://pypi.org/project/setuptools/To install run:python -m pip install --upgrade annotateDevelopmentPrerequisites:Development is strictly based ontox. To install it run:python -m pip install --upgrade toxVisitdevelopment page.Installation from sources:clone the sources:git clonehttps://github.com/karpierz/annotate.gitannotateand run:python -m pip install ./annotateor on development mode:python -m pip install --editable ./annotateLicenseCopyright (c) 2012-2022 Adam KarpierzLicensed under the zlib/libpng Licensehttps://opensource.org/licenses/ZlibPlease refer to the accompanying LICENSE file.AuthorsAdam Karpierz <adam@karpierz.net>Changelog1.1.19 (2022-10-18)Tox configuration has been moved to pyproject.toml1.0.18 (2022-08-22)Setup update.1.0.17 (2022-07-24)Add support for Python 3.10 and 3.11Setup update (currently based mainly on pyproject.toml).1.0.16 (2022-01-10)Drop support for Python 2, 3.5 and 3.6.Copyright year update.Setup update.1.0.15 (2020-10-18)Setup: fix an improper dependencies versions.Setup general update and cleanup.Fixed docs setup.1.0.8 (2019-05-21)Update required setuptools version.Setup update and improvements.1.0.7 (2018-11-08)Drop support for Python 2.6 and 3.0-3.3Update required setuptools version.1.0.6 (2018-05-08)Update required setuptools version.Improve and simplify setup and packaging.1.0.5 (2018-02-26)Improve and simplify setup and packaging.1.0.4 (2018-01-28)Fix a bug and inconsistencies in tox.iniUpdate of README.rst.1.0.1 (2018-01-24)Update required Sphinx version.Update doc Sphinx configuration files.1.0.0 (2017-11-18)Setup improvements.Other minor improvements.0.7.4 (2017-01-05)Minor setup improvements.0.7.3 (2016-09-25)Fix bug in setup.py0.7.1 (2016-09-25)More PEP8 compliant0.6.7 (2016-09-24)Minor description suplement0.6.4 (2016-09-23)Simplify package structure.0.6.3 (2016-06-19)Fix incompatibility for older versions of setuptools.Add example.0.6.0 (2015-08-17)Python3 support.0.5.1 (2015-02-27)Remove ‘returns’ as keyword argument for declare return type.For now, the type of returned value should be declared by thefirst positional argument.0.3.3 (2014-09-15)Add wheels.0.3.2 (2014-09-13)Standarize package.0.3.0 (2014-09-06)Standarize package.Cosmetic changes.0.2.6 (2014-06-10)Portable setup.py.0.2.5 (2014-06-10)Cosmetic changes.0.2.3 (2012-10-13)Initial release.