mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 12:54:11 +08:00
[BE] format test/inductor/s429861_repro.py
(#148554)
Split from #148186 The diff can be re-generated with the following code in the repo root directory on main branch: ```python import re from pathlib import Path def replace(m: re.Match) -> str: s = m.group() if '\n' not in s: return s indent = m.group("indent") varnames = s.removesuffix("None").replace("=", "").replace("(", "").replace(")", "").split() return "\n".join( [ f"{indent}(", *(f"{indent} {varname}," for varname in varnames), f"{indent}) = (None,) * {len(varnames)}", ] ) file = Path('test/inductor/s429861_repro.py') content = file.read_text(encoding='utf-8') new_content = re.sub( r"^(?P<indent> *)\w+ *=(\s*(\(\s*\w+\s*\)|\w+)\s*=\s*)+None$", replace, content, flags=re.MULTILINE, ) file.write_text(new_content, encoding='utf-8') ``` Pull Request resolved: https://github.com/pytorch/pytorch/pull/148554 Approved by: https://github.com/jansel
This commit is contained in:
committed by
PyTorch MergeBot
parent
c5deacc27a
commit
85f6d61421