|
1 | 1 | """ |
2 | | -Introspection functions for reporting java classes and URL |
| 2 | +Introspection functions for reporting java class 'methods', 'fields', and source code URL. |
3 | 3 | """ |
4 | 4 |
|
5 | 5 | from functools import partial |
@@ -61,7 +61,7 @@ def find_java(data, aspect: str) -> list[dict[str, Any]]: |
61 | 61 |
|
62 | 62 | def _map_syntax(base_type): |
63 | 63 | """ |
64 | | - Maps a java BaseType annotation (see link below) in an Java array |
| 64 | + Maps a Java BaseType annotation (see link below) in an Java array |
65 | 65 | to a specific type with an Python interpretable syntax. |
66 | 66 | https://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.3 |
67 | 67 | """ |
@@ -113,7 +113,7 @@ def _make_pretty_string(entry, offset): |
113 | 113 |
|
114 | 114 | def java_source(data): |
115 | 115 | """ |
116 | | - Tries to find the source code using Scijava's SourceFinder' |
| 116 | + Tries to find the source code using Scijava's SourceFinder |
117 | 117 | :param data: The object or class or fully qualified class name to check for source code. |
118 | 118 | :return: The URL of the java class |
119 | 119 | """ |
@@ -147,10 +147,9 @@ def _print_data(data, aspect, static: bool | None = None, source: bool = True): |
147 | 147 | """ |
148 | 148 | Writes data to a printed string of class methods with inputs, static modifier, arguments, and return values. |
149 | 149 |
|
150 | | - :param data: The object or class to inspect. |
151 | | - :param aspect: Whether to print class fields or methods. |
152 | | - :param static: Filter on Static/Instance. Can be set as boolean to filter the class methods based on |
153 | | - static vs. instance methods. Optional, default is None (prints all). |
| 150 | + :param data: The object or class to inspect or fully qualified class name. |
| 151 | + :param aspect: Whether to print class 'fields' or 'methods'. |
| 152 | + :param static: Boolean filter on Static or Instance methods. Optional, default is None (prints all). |
154 | 153 | :param source: Whether to print any available source code. Default True. |
155 | 154 | """ |
156 | 155 | table = find_java(data, aspect) |
@@ -188,6 +187,7 @@ def _print_data(data, aspect, static: bool | None = None, source: bool = True): |
188 | 187 | print(all_methods) |
189 | 188 |
|
190 | 189 |
|
| 190 | +# The functions with short names for quick usage. |
191 | 191 | methods = partial(_print_data, aspect="methods") |
192 | 192 | fields = partial(_print_data, aspect="fields") |
193 | 193 | attrs = partial(_print_data, aspect="fields") |
|
0 commit comments