5 Commits

Author SHA1 Message Date
dependabot[bot] e535d3d428 Bump actions/checkout from 4.1.2 to 4.1.7
Bumps [actions/checkout](https://github.com/actions/checkout) from 4.1.2 to 4.1.7.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v4.1.2...v4.1.7)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-12 19:28:37 +00:00
Jonathon Broughton aede31358d json dump
build and deploy Speckle functions / publish-automate-function-version (push) Has been cancelled
2024-03-15 09:47:19 +00:00
dependabot[bot] 693aded3ae Bump actions/checkout from 4.1.1 to 4.1.2 (#2)
Bumps [actions/checkout](https://github.com/actions/checkout) from 4.1.1 to 4.1.2.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v4.1.1...v4.1.2)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-15 09:35:28 +00:00
Jonathon Broughton 35d428e7bb Update main.py
build and deploy Speckle functions / publish-automate-function-version (push) Has been cancelled
2024-03-12 09:23:20 +00:00
Jonathon Broughton 3be31ec96f Update main.py 2024-03-12 08:51:02 +00:00
2 changed files with 18 additions and 1 deletions
+1 -1
View File
@@ -11,7 +11,7 @@ jobs:
FUNCTION_SCHEMA_FILE_NAME: functionSchema.json
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.1.1
- uses: actions/checkout@v4.1.7
- uses: actions/setup-python@v5
with:
python-version: '3.11'
+17
View File
@@ -9,6 +9,7 @@ from speckle_automate import (
AutomationContext,
execute_automate_function,
)
from specklepy.objects import Base
from flatten import flatten_base
@@ -31,6 +32,18 @@ class FunctionInputs(AutomateBase):
),
)
import json
def serialize_base(base: Base) -> str:
"""Serializes a Base object to a JSON string."""
# Assuming there is a method to convert base objects to dictionaries
base_dict = base.to_dict() if hasattr(base, 'to_dict') else {}
# Use json.dumps() to convert the dictionary to a JSON string
# Set `default=str` to handle any objects that are not directly serializable by default
return json.dumps(base_dict, indent=4, default=str)
def automate_function(
automate_context: AutomationContext,
@@ -48,6 +61,10 @@ def automate_function(
# the context provides a conveniet way, to receive the triggering version
version_root_object = automate_context.receive_version()
# At the point in your code where you want to log the initial base object:
initial_base_json = serialize_base(version_root_object)
print(f"Initial base object as JSON:\n{initial_base_json}")
objects_with_forbidden_speckle_type = [
b
for b in flatten_base(version_root_object)