Apply up007 and up045 to .ci through tools (#176458)
Summary:
Convert Union[X, Y] to X | Y and Optional[X] to X | None using ruff rules UP007 and UP045 since torch is 3.10+
Note: we skip testing here - that is the last directory remaining
X-link: https://github.com/pytorch/pytorch/pull/176458
Approved by: https://github.com/aorenste
Reviewed By: wdvr
Differential Revision: D95607647
fbshipit-source-id: be3d2f5f900c6270a52ca493e2904d99353f51f9