rtutil: Make RT.parse a classmethod.

Because it works, and I can imagine it being useful to have this
method more handy to other code.
This commit is contained in:
Brett Smith 2020-03-25 00:13:18 -04:00
parent 4874a107e8
commit a61b74308f

View file

@ -100,8 +100,9 @@ class RT:
def exists(self, ticket_id: RTId, attachment_id: Optional[RTId]=None) -> bool:
return self.url(ticket_id, attachment_id) is not None
def parse(self, s: str) -> Optional[Tuple[str, Optional[str]]]:
for regexp in self.PARSE_REGEXPS:
@classmethod
def parse(cls, s: str) -> Optional[Tuple[str, Optional[str]]]:
for regexp in cls.PARSE_REGEXPS:
match = regexp.match(s)
if match is not None:
ticket_id, attachment_id = match.groups()