torchrec icon indicating copy to clipboard operation
torchrec copied to clipboard

Refactor source code parity check with `ast`

Open XuehaiPan opened this issue 1 year ago • 0 comments

Use ast.unparse(ast.parse(code)) to normalize the source code. This ignores formatting differences and allows us to enable code formattor on torch upstream.

As per:

  • https://github.com/pytorch/pytorch/pull/128594#issuecomment-2181558483
  • https://github.com/pytorch/pytorch/pull/128594#discussion_r1649795743

XuehaiPan avatar Jun 22 '24 21:06 XuehaiPan