[GH1] replace globs with patterns that mergebot can process (#81414)

https://github.com/pytorch/pytorch/pull/81330#issuecomment-1182345751 shouldn't have happened and should have matched the linalg rule.

The reason it happened is cuz we don't treat the patterns like globs.

We may follow this up with a BE change to make the patterns be treated more like globs, which I expected originally.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/81414
Approved by: https://github.com/malfet
This commit is contained in:
Jane Xu
2022-07-19 16:11:32 +00:00
committed by PyTorch MergeBot
parent 270069cfb9
commit c67a4d8a65
3 changed files with 26 additions and 14 deletions

View File

@ -305,8 +305,8 @@ def patterns_to_regex(allowed_patterns: List[str]) -> Any:
"""
pattern is glob-like, i.e. the only special sequences it has are:
- ? - matches single character
- * - matches any non-folder separator characters
- ** - matches any characters
- * - matches any non-folder separator characters or no character
- ** - matches any characters or no character
Assuming that patterns are free of braces and backslashes
the only character that needs to be escaped are dot and plus
"""
@ -324,9 +324,9 @@ def patterns_to_regex(allowed_patterns: List[str]) -> Any:
elif c == "*":
if pattern_.peek() == "*":
next(pattern_)
rc += ".+"
rc += ".*"
else:
rc += "[^/]+"
rc += "[^/]*"
else:
rc += c
rc += ")"