mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-21 13:44:15 +08:00
[BE]: ruff PLC0207 - use maxsplit kwarg (#160107)
Automatically replaces split with rsplit when relevant and only performs the split up to the first ( or last value). This allows early return of the split function and improve efficiency. Pull Request resolved: https://github.com/pytorch/pytorch/pull/160107 Approved by: https://github.com/albanD
This commit is contained in:
committed by
PyTorch MergeBot
parent
3fcd79e023
commit
beb4d7816d
@ -1605,7 +1605,7 @@ class MultiProcContinousTest(TestCase):
|
||||
@classmethod
|
||||
def _run_test_given_id(cls, test_id: str, **kwargs) -> None:
|
||||
# self.id() == e.g. '__main__.TestDistributed.TestAdditive.test_get_rank'
|
||||
test_name = test_id.split(".")[-1]
|
||||
test_name = test_id.rsplit(".", maxsplit=1)[-1]
|
||||
# Get the test function from the test class
|
||||
self = cls(test_name)
|
||||
self.rank = cls.rank
|
||||
|
Reference in New Issue
Block a user