Enable and fix all UP (pyupgrade) linting rules to modernize Python syntax following modern Python best practices (PEP 604, PEP 695).
Scope
UP038: Use X | Y instead of isinstance(x, (X, Y))
UP045: Convert Optional[X] to X | None
UP047: Use PEP 695 type parameter syntax for generics
UP031: Convert printf-style formatting to f-strings