@@ -180,7 +180,7 @@ FUNCTIONS
180
180
181
181
This function is a shortcut for Java' s System.gc().
182
182
183
- :raise RuntimeError : if the JVM has not yet been started.
183
+ :raise RuntimeError : If the JVM has not started yet .
184
184
185
185
get_version(java_class_or_python_package) -> str
186
186
Return the version of a Java class or Python package.
@@ -213,13 +213,13 @@ FUNCTIONS
213
213
those actions via the jpype.setupGuiEnvironment wrapper function;
214
214
see the Troubleshooting section of the scyjava README for details.
215
215
216
- is_jarray(data) -> bool
216
+ is_jarray(data: Any ) -> bool
217
217
Return whether the given data object is a Java array.
218
218
219
219
is_jvm_headless() -> bool
220
220
Return true iff Java is running in headless mode.
221
221
222
- :raises RuntimeError : If the JVM has not started yet.
222
+ :raise RuntimeError : If the JVM has not started yet.
223
223
224
224
is_memoryarraylike(arr: Any) -> bool
225
225
Return True iff the object is memoryarraylike:
@@ -265,7 +265,7 @@ FUNCTIONS
265
265
:param lengths: List of lengths for the array. For example:
266
266
`jarray(' z' , [3 , 7 ])` is the equivalent of `new boolean[3 ][7 ]` in Java.
267
267
You can pass a single integer to make a 1 - dimensional array of that length.
268
- :returns : The newly allocated array
268
+ :return : The newly allocated array
269
269
270
270
jclass(data)
271
271
Obtain a Java class object .
@@ -285,22 +285,23 @@ FUNCTIONS
285
285
i.e. the Java class for the Class class . :- )
286
286
287
287
:param data: The object from which to glean the class .
288
- :returns : A java.lang.Class object , suitable for use with reflection.
289
- :raises TypeError : if the argument is not one of the aforementioned types.
288
+ :return : A java.lang.Class object , suitable for use with reflection.
289
+ :raise TypeError : if the argument is not one of the aforementioned types.
290
290
291
291
jimport(class_name: str )
292
292
Import a class from Java to Python.
293
293
294
294
:param class_name: Name of the class to import .
295
- :returns: A pointer to the class , which can be used to
296
- e.g. instantiate objects of that class .
295
+ :return :
296
+ A pointer to the class , which can be used to
297
+ e.g. instantiate objects of that class .
297
298
298
299
jinstance(obj, jtype) -> bool
299
300
Test if the given object is an instance of a particular Java type .
300
301
301
302
:param obj: The object to check.
302
303
:param jtype: The Java type , as either a jimported class or as a string.
303
- :returns : True iff the object is an instance of that Java type .
304
+ :return : True iff the object is an instance of that Java type .
304
305
305
306
jstacktrace(exc) -> str
306
307
Extract the Java- side stack trace from a Java exception.
@@ -315,7 +316,7 @@ FUNCTIONS
315
316
print (jstacktrace(exc))
316
317
317
318
:param exc: The Java Throwable from which to extract the stack trace.
318
- :returns : A multi- line string containing the stack trace, or empty string
319
+ :return : A multi- line string containing the stack trace, or empty string
319
320
if no stack trace could be extracted.
320
321
321
322
jvm_started() -> bool
@@ -379,8 +380,18 @@ FUNCTIONS
379
380
:return : The used memory in bytes .
380
381
:raise RuntimeError : if the JVM has not yet been started.
381
382
383
+ numeric_bounds(the_type: type ) -> Union[Tuple[int , int ], Tuple[float , float ], Tuple[NoneType, NoneType]]
384
+ Get the minimum and maximum values for the given numeric type .
385
+ For example, a Java long returns (int (Long.MIN_VALUE ), int (Long.MAX_VALUE )),
386
+ whereas a Java double returns (float (- Double.MAX_VALUE ), float (Double.MAX_VALUE )).
387
+
388
+ :param the_type: The type whose minimum and maximum values are needed.
389
+ :return :
390
+ The minimum and maximum values as a two- element tuple of int or float ,
391
+ or a two- element tuple of None if no known bounds.
392
+
382
393
shutdown_jvm() -> None
383
- Shutdown the JVM .
394
+ Shut down the JVM .
384
395
385
396
This function makes a best effort to clean up Java resources first.
386
397
In particular, shutdown hooks registered with scyjava.when_jvm_stops
@@ -398,7 +409,7 @@ FUNCTIONS
398
409
Note that if the JVM is not already running, then this function does
399
410
nothing! In particular, shutdown hooks are skipped in this situation.
400
411
401
- :raises RuntimeError : if this method is called while in Jep mode.
412
+ :raise RuntimeError : if this method is called while in Jep mode.
402
413
403
414
start_jvm(options = None ) -> None
404
415
Explicitly connect to the Java virtual machine (JVM ). Only one JVM can
@@ -407,8 +418,9 @@ FUNCTIONS
407
418
time a scyjava function needing a JVM is invoked, one is started on the
408
419
fly with the configuration specified via the scijava.config mechanism.
409
420
410
- :param options: List of options to pass to the JVM . For example:
411
- [' -Dfoo=bar' , ' -XX:+UnlockExperimentalVMOptions' ]
421
+ :param options:
422
+ List of options to pass to the JVM .
423
+ For example: [' -Dfoo=bar' , ' -XX:+UnlockExperimentalVMOptions' ]
412
424
413
425
to_java(obj: Any, ** hints: Dict) -> Any
414
426
Recursively convert a Python object to a Java object .
@@ -451,11 +463,13 @@ FUNCTIONS
451
463
* float values in Double range but outside float range convert to Double
452
464
* float values outside double range convert to BigDecimal
453
465
454
- :param obj: The Python object to convert.
455
- :param hints: An optional dictionary of hints, to help scyjava
456
- make decisions about how to do the conversion.
457
- :returns: A corresponding Java object with the same contents.
458
- :raises TypeError : if the argument is not one of the aforementioned types.
466
+ :param obj:
467
+ The Python object to convert.
468
+ :param hints:
469
+ An optional dictionary of hints, to help scyjava
470
+ make decisions about how to do the conversion.
471
+ :return : A corresponding Java object with the same contents.
472
+ :raise TypeError : if the argument is not one of the aforementioned types.
459
473
460
474
to_python(data: Any, gentle: bool = False ) -> Any
461
475
Recursively convert a Java object to a Python object .
@@ -472,12 +486,15 @@ FUNCTIONS
472
486
* Iterable -> collections.abc.Iterable
473
487
* Iterator -> collections.abc.Iterator
474
488
475
- :param data: The Java object to convert.
476
- :param gentle: If set , and the type cannot be converted, leaves
477
- the data alone rather than raising a TypeError .
478
- :returns: A corresponding Python object with the same contents.
479
- :raises TypeError : if the argument is not one of the aforementioned types,
480
- and the gentle flag is not set .
489
+ :param data:
490
+ The Java object to convert.
491
+ :param gentle:
492
+ If set , and the type cannot be converted, leaves
493
+ the data alone rather than raising a TypeError .
494
+ :return : A corresponding Python object with the same contents.
495
+ :raise TypeError :
496
+ if the argument is not one of the aforementioned types,
497
+ and the gentle flag is not set .
481
498
482
499
when_jvm_starts(f) -> None
483
500
Registers a function to be called when the JVM starts (or immediately).
0 commit comments