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:
parent
4874a107e8
commit
a61b74308f
1 changed files with 3 additions and 2 deletions
|
@ -100,8 +100,9 @@ class RT:
|
||||||
def exists(self, ticket_id: RTId, attachment_id: Optional[RTId]=None) -> bool:
|
def exists(self, ticket_id: RTId, attachment_id: Optional[RTId]=None) -> bool:
|
||||||
return self.url(ticket_id, attachment_id) is not None
|
return self.url(ticket_id, attachment_id) is not None
|
||||||
|
|
||||||
def parse(self, s: str) -> Optional[Tuple[str, Optional[str]]]:
|
@classmethod
|
||||||
for regexp in self.PARSE_REGEXPS:
|
def parse(cls, s: str) -> Optional[Tuple[str, Optional[str]]]:
|
||||||
|
for regexp in cls.PARSE_REGEXPS:
|
||||||
match = regexp.match(s)
|
match = regexp.match(s)
|
||||||
if match is not None:
|
if match is not None:
|
||||||
ticket_id, attachment_id = match.groups()
|
ticket_id, attachment_id = match.groups()
|
||||||
|
|
Loading…
Reference in a new issue