Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions mypy.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
[mypy]

warn_unused_configs = True
warn_redundant_casts = True
warn_unused_ignores = True

[mypy-test.*]
disallow_untyped_defs = True
disallow_untyped_calls = True
2 changes: 1 addition & 1 deletion pygit2/blame.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def __del__(self) -> None:
C.git_blame_free(self._blame)

def __len__(self) -> int:
return C.git_blame_get_hunk_count(self._blame) # type: ignore[no-any-return]
return C.git_blame_get_hunk_count(self._blame)

def __getitem__(self, index: int) -> BlameHunk:
chunk = C.git_blame_get_hunk_byindex(self._blame, index)
Expand Down
2 changes: 1 addition & 1 deletion pygit2/callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ def git_proxy_options(
elif type(proxy) is str:
opts.type = C.GIT_PROXY_SPECIFIED
# Keep url in memory, otherwise memory is freed and bad things happen
payload.__proxy_url = ffi.new('char[]', to_bytes(proxy)) # type: ignore[attr-defined, no-untyped-call]
payload.__proxy_url = ffi.new('char[]', to_bytes(proxy)) # type: ignore[attr-defined]
opts.url = payload.__proxy_url # type: ignore[attr-defined]
else:
raise TypeError('Proxy must be None, True, or a string')
Expand Down
2 changes: 1 addition & 1 deletion pygit2/ffi.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@
# Boston, MA 02110-1301, USA.

# Import from pygit2
from ._libgit2 import ffi # type: ignore # noqa: F401
from ._libgit2 import ffi # noqa: F401
from ._libgit2 import lib as C # type: ignore # noqa: F401
2 changes: 1 addition & 1 deletion pygit2/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,7 @@ def diff(

# Case 2: Index to workdir
elif a is None and b is None:
return self.index.diff_to_workdir(**options) # type: ignore[arg-type]
return self.index.diff_to_workdir(**options)

# Case 3: Diff tree to index or workdir
elif isinstance(a, Tree) and b is None:
Expand Down
2 changes: 2 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
# the Free Software Foundation, 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301, USA.

# mypy: disable-error-code="import-not-found, import-untyped"

# Import setuptools before distutils to avoid user warning
import os
import sys
Expand Down
4 changes: 2 additions & 2 deletions test/test_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ def test_read(testrepo: Repository) -> None:
assert len(index) == 2

with pytest.raises(TypeError):
index[()] # type: ignore
utils.assertRaisesWithArg(ValueError, -4, lambda: index[-4]) # type: ignore
index[()]
utils.assertRaisesWithArg(ValueError, -4, lambda: index[-4])
utils.assertRaisesWithArg(KeyError, 'abc', lambda: index['abc'])

sha = 'a520c24d85fbfc815d385957eed41406ca5a860b'
Expand Down
2 changes: 1 addition & 1 deletion test/test_tag.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def test_new_tag(barerepo: Repository) -> None:
target_prefix = target[:5]
too_short_prefix = target[:3]
with pytest.raises(ValueError):
barerepo.create_tag(name, too_short_prefix, ObjectType.BLOB, tagger, message) # type: ignore
barerepo.create_tag(name, too_short_prefix, ObjectType.BLOB, tagger, message)

sha = barerepo.create_tag(name, target_prefix, ObjectType.BLOB, tagger, message)
tag = barerepo[sha]
Expand Down
2 changes: 1 addition & 1 deletion test/test_tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def test_sorting(barerepo: Repository) -> None:
tree_a = barerepo['18e2d2e9db075f9eb43bcb2daa65a2867d29a15e']
assert isinstance(tree_a, Tree)
assert list(tree_a) == sorted(reversed(list(tree_a)), key=pygit2.tree_entry_key)
assert list(tree_a) != reversed(list(tree_a)) # type: ignore[comparison-overlap]
assert list(tree_a) != reversed(list(tree_a))


def test_read_subtree(barerepo: Repository) -> None:
Expand Down
Loading