Refactor find_density_branch function to use AutomationContext and return Optional[Base]
build and deploy Speckle functions / publish-automate-function-version (push) Has been cancelled
build and deploy Speckle functions / publish-automate-function-version (push) Has been cancelled
This commit refactors the find_density_branch function in objects.py to accept an AutomationContext parameter instead of automate_run_data. It also updates the variable names within the function accordingly. The return type of the function is changed to Optional[Base]. Additionally, the code in transport_recolorized_commit is modified to call find_density_branch with automate_context instead of automate_context.automation_run_data. This change ensures that commits on the density branch cannot be recolored.
This commit is contained in:
@@ -404,9 +404,9 @@ def density_summary(
|
||||
|
||||
return data, all_densities, all_areas
|
||||
|
||||
def find_density_branch(automate_run_data):
|
||||
client = automate_run_data.client
|
||||
project_id = automate_run_data.project_id
|
||||
def find_density_branch(automation_context: AutomationContext) -> Optional[Base]:
|
||||
client = automation_context.speckle_client
|
||||
project_id = automation_context.automation_run_data.project_id
|
||||
|
||||
branches = client.branch.list(project_id, 100, 0)
|
||||
for branch in branches:
|
||||
@@ -425,7 +425,7 @@ def transport_recolorized_commit(
|
||||
# return the commit id of the new commit
|
||||
# create a new commit on a specific branch - we'll use "dirstat" for now
|
||||
|
||||
if find_density_branch(automate_context.automation_run_data) is not None:
|
||||
if find_density_branch(automate_context) is not None:
|
||||
# commits on the density branch cannot be recolored
|
||||
print("------------------------------------------------")
|
||||
print("| CANNOT RECOLOR COMMITS ON THE DENSITY BRANCH |")
|
||||
|
||||
Reference in New Issue
Block a user