diff --git a/.gitignore b/.gitignore index e87cb1c..f9608e8 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,8 @@ function_inputs.json # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 +.idea/* + # User-specific stuff .idea/**/workspace.xml .idea/**/tasks.xml diff --git a/flatten.py b/flatten.py index 4c2d5bb..196d022 100644 --- a/flatten.py +++ b/flatten.py @@ -7,7 +7,10 @@ def flatten_base(base: Base) -> Iterable[Base]: """Take a base and flatten it to an iterable of bases.""" + if hasattr(base, "elements"): + print("flatten: base has " + str(len(elements)) + " elements") for element in base["elements"]: yield from flatten_base(element) + yield base diff --git a/main.py b/main.py index d66a07d..77adc24 100644 --- a/main.py +++ b/main.py @@ -45,6 +45,9 @@ def automate_function( It also has conveniece methods attach result data to the Speckle model. function_inputs: An instance object matching the defined schema. """ + + print("automate_function(): started") + # the context provides a conveniet way, to receive the triggering version version_root_object = automate_context.receive_version() @@ -55,7 +58,12 @@ def automate_function( ] count = len(objects_with_forbidden_speckle_type) + print("automate_function(): found " + str(len(count)) + " elements of forbidden type: " + function_inputs.forbidden_speckle_type) + if count > 0: + + print("automate_function(): count = " + str(len(count)) + " > 0") + # this is how a run is marked with a failure cause automate_context.attach_error_to_objects( category="Forbidden speckle_type" @@ -75,6 +83,7 @@ def automate_function( automate_context.set_context_view() else: + print("automate_function(): count = " + str(len(count)) + "") automate_context.mark_run_success("No forbidden types found.") # if the function generates file results, this is how it can be