Added inspect() to repl, closes #501
This commit is contained in:
@@ -1,3 +1,3 @@
|
|||||||
""" version info """
|
""" version info """
|
||||||
|
|
||||||
__version__ = "0.42.72"
|
__version__ = "0.42.73"
|
||||||
|
|||||||
@@ -4074,6 +4074,10 @@ def _get_selected(photosdb):
|
|||||||
@click.pass_context
|
@click.pass_context
|
||||||
def repl(ctx, cli_obj, db):
|
def repl(ctx, cli_obj, db):
|
||||||
"""Run interactive osxphotos shell"""
|
"""Run interactive osxphotos shell"""
|
||||||
|
|
||||||
|
from osxphotos import PhotosDB, PhotoInfo, ExifTool
|
||||||
|
from rich import inspect as _inspect
|
||||||
|
|
||||||
pretty.install()
|
pretty.install()
|
||||||
print(f"python version: {sys.version}")
|
print(f"python version: {sys.version}")
|
||||||
print(f"osxphotos version: {osxphotos._version.__version__}")
|
print(f"osxphotos version: {osxphotos._version.__version__}")
|
||||||
@@ -4090,6 +4094,10 @@ def repl(ctx, cli_obj, db):
|
|||||||
show = _show_photo
|
show = _show_photo
|
||||||
get_selected = _get_selected(photosdb)
|
get_selected = _get_selected(photosdb)
|
||||||
|
|
||||||
|
def inspect(obj):
|
||||||
|
"""inspect object"""
|
||||||
|
return _inspect(obj, methods=True)
|
||||||
|
|
||||||
print(f"Found {len(photos)} photos in {tictoc:0.2f} seconds")
|
print(f"Found {len(photos)} photos in {tictoc:0.2f} seconds")
|
||||||
print("The following variables are defined:")
|
print("The following variables are defined:")
|
||||||
print(f"- photosdb: PhotosDB() instance for {photosdb.library_path}")
|
print(f"- photosdb: PhotosDB() instance for {photosdb.library_path}")
|
||||||
@@ -4105,5 +4113,8 @@ def repl(ctx, cli_obj, db):
|
|||||||
print(
|
print(
|
||||||
f"- help(object): print help text including list of methods for object; for example, help(PhotosDB)"
|
f"- help(object): print help text including list of methods for object; for example, help(PhotosDB)"
|
||||||
)
|
)
|
||||||
|
print(
|
||||||
|
f"- inspect(object): print information about an object; for example inspect(photosdb)"
|
||||||
|
)
|
||||||
print(f"- quit(): exit this interactive shell\n")
|
print(f"- quit(): exit this interactive shell\n")
|
||||||
code.interact(banner="", local=locals())
|
code.interact(banner="", local=locals())
|
||||||
|
|||||||
Reference in New Issue
Block a user