Skip to content

Commit adad8ee

Browse files
Fix pygit2 deprecations (#127)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent d8bca17 commit adad8ee

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

.pre-commit-config.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
default_language_version:
2-
python: python3.11
2+
python: python3.12
33
files: '.py'
44
exclude: ".env,.yml,.gitignore,.git,.md,.txt"
55
default_stages: [push, commit]

bot/cogs/utilities.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def get_bot_uptime(self, *, brief: bool = False) -> str:
3232

3333
def format_commit(self, commit: pygit2.Commit) -> str:
3434
short, _, _ = commit.message.partition("\n")
35-
short_sha2 = commit.hex[0:6]
35+
short_sha2 = str(commit.id)[0:6]
3636
commit_tz = datetime.timezone(
3737
datetime.timedelta(minutes=commit.commit_time_offset)
3838
)
@@ -42,7 +42,8 @@ def format_commit(self, commit: pygit2.Commit) -> str:
4242

4343
# [`hash`](url) message (offset)
4444
offset = format_dt(commit_time.astimezone(datetime.timezone.utc), "R")
45-
return f"[`{short_sha2}`](https://github.com/transprogrammer/rodhaj/commit/{commit.hex}) {short} ({offset})"
45+
commit_id = str(commit.id)
46+
return f"[`{short_sha2}`](https://github.com/transprogrammer/rodhaj/commit/{commit_id}) {short} ({offset})"
4647

4748
def get_last_commits(self, count: int = 5):
4849
repo = pygit2.Repository(".git")

0 commit comments

Comments
 (0)