2
2
High-level convenience functions for inspecting Java objects.
3
3
"""
4
4
5
- from typing import Optional
6
-
7
- from scyjava ._introspect import jreflect , jsource
5
+ from scyjava import _introspect
8
6
9
7
10
8
def members (data ):
@@ -50,7 +48,7 @@ def src(data):
50
48
51
49
:param data: The Java class, object, or fully qualified class name as string.
52
50
"""
53
- source_url = jsource (data )
51
+ source_url = _introspect . jsource (data )
54
52
print (f"Source code URL: { source_url } " )
55
53
56
54
@@ -108,7 +106,7 @@ def _pretty_string(entry, offset):
108
106
return f"{ return_val } { modifier } = { obj_name } ({ arg_string } )\n "
109
107
110
108
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 ):
112
110
"""
113
111
Write data to a printed table with inputs, static modifier,
114
112
arguments, and return values.
@@ -119,7 +117,7 @@ def _print_data(data, aspect, static: Optional[bool] = None, source: bool = True
119
117
Optional, default is None (prints all).
120
118
:param source: Whether to print any available source code. Default True.
121
119
"""
122
- table = jreflect (data , aspect )
120
+ table = _introspect . jreflect (data , aspect )
123
121
if len (table ) == 0 :
124
122
print (f"No { aspect } found" )
125
123
return
@@ -128,7 +126,7 @@ def _print_data(data, aspect, static: Optional[bool] = None, source: bool = True
128
126
offset = max (list (map (lambda entry : len (entry ["returns" ] or "void" ), table )))
129
127
all_methods = ""
130
128
if source :
131
- urlstring = jsource (data )
129
+ urlstring = _introspect . jsource (data )
132
130
print (f"Source code URL: { urlstring } " )
133
131
134
132
# Print methods
0 commit comments