Skip to content

Commit 4123078

Browse files
ian-coccimiglioctrueden
authored andcommitted
Improve introspection function documentation
1 parent 7293d23 commit 4123078

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/scyjava/_introspection.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
Introspection functions for reporting java classes and URL
2+
Introspection functions for reporting java class 'methods', 'fields', and source code URL.
33
"""
44

55
from functools import partial
@@ -61,7 +61,7 @@ def find_java(data, aspect: str) -> list[dict[str, Any]]:
6161

6262
def _map_syntax(base_type):
6363
"""
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
6565
to a specific type with an Python interpretable syntax.
6666
https://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.3
6767
"""
@@ -113,7 +113,7 @@ def _make_pretty_string(entry, offset):
113113

114114
def java_source(data):
115115
"""
116-
Tries to find the source code using Scijava's SourceFinder'
116+
Tries to find the source code using Scijava's SourceFinder
117117
:param data: The object or class or fully qualified class name to check for source code.
118118
:return: The URL of the java class
119119
"""
@@ -147,10 +147,9 @@ def _print_data(data, aspect, static: bool | None = None, source: bool = True):
147147
"""
148148
Writes data to a printed string of class methods with inputs, static modifier, arguments, and return values.
149149
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).
154153
:param source: Whether to print any available source code. Default True.
155154
"""
156155
table = find_java(data, aspect)
@@ -188,6 +187,7 @@ def _print_data(data, aspect, static: bool | None = None, source: bool = True):
188187
print(all_methods)
189188

190189

190+
# The functions with short names for quick usage.
191191
methods = partial(_print_data, aspect="methods")
192192
fields = partial(_print_data, aspect="fields")
193193
attrs = partial(_print_data, aspect="fields")

0 commit comments

Comments
 (0)