annotate
Function annotations.
Overview
@annotate
Examples
from typing import Optional, Tuple, Union, Sequence
from annotate import annotate
import jni
from .lib import cached
from .jobjectbase import JObjectBase
from .jclass import JClass
from .jobject import JObject
class JArray(JObjectBase):
"""Java Array"""
@classmethod
@annotate("JArray", size=Union[int, long])
def newBooleanArray(cls, size):
...
...
@classmethod
@annotate("JArray", size=Union[int, long])
def newDoubleArray(cls, size):
...
@classmethod
@annotate("JArray", size=Union[int, long])
def newStringArray(cls, size):
...
@classmethod
@annotate("JArray", size=Union[int, long], component_class=JClass)
def newObjectArray(cls, size, component_class):
...
@annotate(jenv=jni.JNIEnv, jarr=jni.jarray, borrowed=bool)
def __init__(self, jenv, jarr, borrowed=False):
...
def __hash__(self):
return super(JArray, self).__hash__()
def __len__(self):
return self.getLength()
@annotate(JObject, borrowed=bool)
def asObject(self, borrowed=False):
...
@cached
@annotate(int)
def getLength(self):
...
@annotate(bool, idx=int)
def getBoolean(self, idx):
...
...
@annotate(float, idx=int)
def getDouble(self, idx):
...
@annotate(Optional[str], idx=int)
def getString(self, idx):
...
@annotate(Optional[JObject], idx=int)
def getObject(self, idx):
...
@annotate(idx=int, val=bool)
def setBoolean(self, idx, val):
...
@annotate(idx=int, val=str)
def setChar(self, idx, val):
...
...
@annotate(idx=int, val=Union[int, long])
def setLong(self, idx, val):
...
@annotate(idx=int, val=float)
def setDouble(self, idx, val):
...
@annotate(idx=int, val=Optional[str])
def setString(self, idx, val):
...
@annotate(idx=int, val=Optional[JObject])
def setObject(self, idx, val):
...
@annotate("JArray", start=int, stop=int, step=int)
def getBooleanSlice(self, start, stop, step):
...
...
@annotate("JArray", start=int, stop=int, step=int)
def getDoubleSlice(self, start, stop, step):
...
@annotate("JArray", start=int, stop=int, step=int)
def getStringSlice(self, start, stop, step):
...
@annotate("JArray", start=int, stop=int, step=int)
def getObjectSlice(self, start, stop, step):
...
@annotate(start=int, stop=int, step=int, val=Sequence[bool])
def setBooleanSlice(self, start, stop, step, val):
...
@annotate(start=int, stop=int, step=int, val=Union[Sequence[str], str])
def setCharSlice(self, start, stop, step, val):
...
@annotate(start=int, stop=int, step=int,
val=Union[Sequence[Union[int,bytes]], (bytes, bytearray)])
def setByteSlice(self, start, stop, step, val):
...
...
@annotate(start=int, stop=int, step=int, val=Sequence[float])
def setDoubleSlice(self, start, stop, step, val):
...
@annotate(start=int, stop=int, step=int, val=Sequence[Optional[str]])
def setStringSlice(self, start, stop, step, val):
...
@annotate(start=int, stop=int, step=int, val=Sequence[Optional[JObject]])
def setObjectSlice(self, start, stop, step, val):
...
@annotate(Tuple)
def getBooleanBuffer(self):
with self.jvm as (jvm, jenv):
is_copy = jni.jboolean()
return jenv.GetBooleanArrayElements(self._jobj, is_copy), jni.sizeof(jni.jboolean), b"B", is_copy
...
@annotate(Tuple)
def getDoubleBuffer(self):
with self.jvm as (jvm, jenv):
is_copy = jni.jboolean()
return jenv.GetDoubleArrayElements(self._jobj, is_copy), jni.sizeof(jni.jdouble), b"d", is_copy
@annotate(buf=object)
def releaseBooleanBuffer(self, buf):
with self.jvm as (jvm, jenv):
jenv.ReleaseBooleanArrayElements(self._jobj, jni.cast(buf, jni.POINTER(jni.jboolean)))
...
@annotate(buf=object)
def releaseDoubleBuffer(self, buf):
with self.jvm as (jvm, jenv):
jenv.ReleaseDoubleArrayElements(self._jobj, jni.cast(buf, jni.POINTER(jni.jdouble)))
Installation
Prerequisites:
Python 3.11 or higher
pip
To install run:
python -m pip install --upgrade annotate
Development
Prerequisites:
Development is strictly based on nox. To install it run:
python -m pip install --upgrade nox
Visit Development page.
Installation from sources:
clone the sources:
git clone https://github.com/karpierz/annotate annotate
and run:
python -m pip install ./annotate
or on development mode:
python -m pip install --editable ./annotate
License
Copyright (c) 2012-2026 Adam KarpierzLicensed under the zlib/libpng LicensePlease refer to the accompanying LICENSE file.
Sponsoring
Metadata
Release files for annotate 2.5.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| annotate-2.5.1.tar.gz | 14.8 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| annotate-2.5.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 20.0 kB
Release files / annotate-2.5.1.tar.gz
| Download URL | annotate-2.5.1.tar.gz |
|---|---|
| Size | 14.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b49a16a9f5df920a6be4f4e5251d66260556af9adccc96408cf47c2e7730e0b3
|
|
BLAKE2b-256 checksum How to use checksums |
9e48383de3b03e5045fcda22a1a740222e3f72ee5464fb37b4a88316d55b6de3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.8
|
Release files / annotate-2.5.1-py3-none-any.whl
| Download URL | annotate-2.5.1-py3-none-any.whl |
|---|---|
| Size | 5.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
23b564ce8462fb8183c5326a3235111d72b4bb5eab5e6287545b2d749651cf42
|
|
BLAKE2b-256 checksum How to use checksums |
be743e27b064706561fe3449910e1ce74ae6acebe0226c65f1738073e298caee
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.8
|
Security for annotate 2.5.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.