rendercomment: move Repository init to __init__

This makes rendercomment a slight bit more lazy. Now,
it will only actually initialize a pygit2.Repository
when it needs to produce a Git commit inline.

Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
Kevin Morris 2021-07-20 11:28:18 -07:00
parent a6ca345af4
commit 4959f62cf5

View file

@ -60,9 +60,8 @@ class GitCommitsInlineProcessor(markdown.inlinepatterns.InlineProcessor):
considered. considered.
""" """
_repo = pygit2.Repository(repo_path)
def __init__(self, md, head): def __init__(self, md, head):
self._repo = pygit2.Repository(repo_path)
self._head = head self._head = head
super().__init__(r'\b([0-9a-f]{7,40})\b', md) super().__init__(r'\b([0-9a-f]{7,40})\b', md)