Skip to content

Commit ba70273

Browse files
Drop support for ancient dulwich versions (#339)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 0dacec5 commit ba70273

3 files changed

Lines changed: 4 additions & 22 deletions

File tree

klaus/repo.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,7 @@
1010
from dulwich.errors import NotTreeError
1111
from dulwich.object_store import tree_lookup_path
1212
from dulwich.objects import S_ISGITLINK, Blob
13-
14-
try:
15-
from dulwich.refs import SymrefLoop
16-
except ImportError: # dulwich < 0.20.46
17-
InaccessibleRef = KeyError # type: ignore
18-
else:
19-
InaccessibleRef = (SymrefLoop, KeyError) # type: ignore
20-
13+
from dulwich.refs import SymrefLoop
2114

2215
from klaus.diff import render_diff
2316
from klaus.utils import (
@@ -28,6 +21,7 @@
2821
repo_human_name,
2922
)
3023

24+
InaccessibleRef = (SymrefLoop, KeyError) # type: ignore
3125
NOT_SET = "__not_set__"
3226

3327

klaus/views.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,12 @@
66
import dulwich.config
77
import dulwich.objects
88
from dulwich.object_store import tree_lookup_path
9+
from dulwich.refs import SymrefLoop
910
from flask import current_app, render_template, request, url_for
1011
from flask.views import View
1112
from werkzeug.exceptions import NotFound
1213
from werkzeug.wrappers import Response
1314

14-
try:
15-
from dulwich.refs import SymrefLoop
16-
except ImportError: # dulwich < 0.20.46
17-
18-
class SymrefLoop(Exception): # type: ignore
19-
"""Dummy exception."""
20-
21-
2215
try:
2316
import ctags
2417
except ImportError:

tests/test_contrib.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
import os
2-
3-
try:
4-
from importlib import reload # Python 3.4+
5-
except ImportError:
6-
pass
7-
82
import subprocess
3+
from importlib import reload # Python 3.4+
94

105
import pytest
116
import requests

0 commit comments

Comments
 (0)