Skip to content

SG-41525 Replace lambda with functools.partial in get_actions_for_publishes.py #5

Merged
eduardoChaucaGallegos merged 4 commits intomainfrom
ticket/SG-41524-lambda-closure-bug-in-loader_action_manager
Jan 8, 2026
Merged

SG-41525 Replace lambda with functools.partial in get_actions_for_publishes.py #5
eduardoChaucaGallegos merged 4 commits intomainfrom
ticket/SG-41524-lambda-closure-bug-in-loader_action_manager

Conversation

@eduardoChaucaGallegos
Copy link
Copy Markdown
Contributor

@eduardoChaucaGallegos eduardoChaucaGallegos commented Dec 16, 2025

Description

This pull request makes minor improvements to the loader_action_manager.py file, focusing on code clarity and maintainability. The most notable change is the use of functools.partial to simplify the signal handler connection for action triggers.

Code quality and maintainability:

  • Replaced the lambda function with functools.partial when connecting the triggered signal to _execute_hook, making the code more readable and less error-prone.
  • Moved the import sgtk statement to follow standard import order and added the import for functools.partial.

This is a replica from shotgunsoftware/tk-multi-loader2#131

… avoid late-binding closure issues. Also reorganize imports to follow PEP 8 conventions.
@eduardoChaucaGallegos eduardoChaucaGallegos requested review from a team and staceyoue December 16, 2025 18:25
@eduardoChaucaGallegos eduardoChaucaGallegos changed the title SG-41524 Replace lambda with functools.partial in get_actions_for_publishes.py SG-41525 Replace lambda with functools.partial in get_actions_for_publishes.py Dec 16, 2025
Copy link
Copy Markdown
Member

@julien-lang julien-lang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer having a module name when calling a method or object. So we know it's coming from a different file.
It's a personal preference but I think it makes things easier to read.

Comment thread python/tk_multi_entity_app/loader_action_manager.py Outdated
Comment thread python/tk_multi_entity_app/loader_action_manager.py Outdated
Copy link
Copy Markdown
Member

@julien-lang julien-lang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! One minor suggestion but not mandatory.

Comment thread python/tk_multi_entity_app/loader_action_manager.py
@eduardoChaucaGallegos eduardoChaucaGallegos merged commit a882286 into main Jan 8, 2026
12 checks passed
@eduardoChaucaGallegos eduardoChaucaGallegos deleted the ticket/SG-41524-lambda-closure-bug-in-loader_action_manager branch January 8, 2026 21:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants