22High-level convenience functions for inspecting Java objects.
33"""
44
5- from typing import Optional
6-
7- from scyjava ._introspect import jreflect , jsource
5+ from scyjava import _introspect
86
97
108def members (data ):
@@ -50,7 +48,7 @@ def src(data):
5048
5149 :param data: The Java class, object, or fully qualified class name as string.
5250 """
53- source_url = jsource (data )
51+ source_url = _introspect . jsource (data )
5452 print (f"Source code URL: { source_url } " )
5553
5654
@@ -108,7 +106,7 @@ def _pretty_string(entry, offset):
108106 return f"{ return_val } { modifier } = { obj_name } ({ arg_string } )\n "
109107
110108
111- def _print_data (data , aspect , static : Optional [ bool ] = None , source : bool = True ):
109+ def _print_data (data , aspect , static : bool | None = None , source : bool = True ):
112110 """
113111 Write data to a printed string of class methods with inputs, static modifier,
114112 arguments, and return values.
@@ -119,7 +117,7 @@ def _print_data(data, aspect, static: Optional[bool] = None, source: bool = True
119117 Optional, default is None (prints all).
120118 :param source: Whether to print any available source code. Default True.
121119 """
122- table = jreflect (data , aspect )
120+ table = _introspect . jreflect (data , aspect )
123121 if len (table ) == 0 :
124122 print (f"No { aspect } found" )
125123 return
@@ -128,7 +126,7 @@ def _print_data(data, aspect, static: Optional[bool] = None, source: bool = True
128126 offset = max (list (map (lambda entry : len (entry ["returns" ] or "void" ), table )))
129127 all_methods = ""
130128 if source :
131- urlstring = jsource (data )
129+ urlstring = _introspect . jsource (data )
132130 print (f"Source code URL: { urlstring } " )
133131
134132 # Print methods
0 commit comments