The Stealth embedded Python is documented with Python doc strings. Below is a code snippet that will generate a listing of each of the functions and the other types and write it to a file. It builds off of
Boydon's recommendation in Vlek's post about
Stealth Python Documentation. This code works in Python 2. I have not tested it in Python 3 but see no reason why it wouldn't run in Python 3.
# Stealth UO Client Import
import stealth
# Python Library Imports
import inspect
import subprocess
# Test Code
# print help(CreateComponent)
# print CreateComponent.__doc__
func_lines = []
other_lines = []
# Get a listing of the member attributes of the Stealth library
functiondict = inspect.getmembers(stealth)
# Loop over each member and get its type and description
for k, v in functiondict:
cur_line = "%s:\t%s\n" % (k, v)
cur_doc = inspect.getdoc(getattr(stealth, k))
if cur_doc:
cur_line += "\t" + cur_doc + "\n"
else:
cur_line += "\tNo description\n"
if inspect.isbuiltin(getattr(stealth, k)):
# If the current member is a function add it to func_lines
func_lines.append(cur_line)
else:
# else add the member and description to other_lines
other_lines.append(cur_line)
with open("stealth_member_listing.txt", "w") as fh:
# Write the functions to the file first
for line in func_lines:
fh.write(line)
# Then write the other members to the file
for line in other_lines:
fh.write(line)
# Show the file in notepad
subprocess.call(["notepad", "stealth_member_listing.txt"])
I find it helpful to generate this listing each time Stealth is updated to a new version.