[Python] Clarify rationale for mutator design (#2488)

## Changes
Clarify rationale for design of `@job_mutator`
This commit is contained in:
Gleb Kanterov 2025-03-14 10:41:42 +01:00 committed by GitHub
parent d9695fe1e8
commit afa253c431
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 14 additions and 0 deletions

View File

@ -52,6 +52,20 @@ class ResourceMutator(Generic[_T]):
"""
# Below, we define decorators for each resource type. This approach allows us
# to implement mutators that are only applied for specific resource types.
#
# Alternative approaches considered and rejected during design:
#
# - Inspecting type annotations without decorators.
# Rationale: Avoid implicit runtime behavior changes based solely on type annotations,
# especially if a function lacks an explicit decorator.
#
# - Using a universal @mutator decorator.
# Rationale: Determining whether a mutator is invoked based solely on type annotations
# was deemed overly implicit and potentially confusing.
@overload
def job_mutator(
function: Callable[[Bundle, "Job"], "Job"],