Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

random fixes #1332

Open
wants to merge 47 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
55bc286
add some rules to ruff
DinhHuy2010 Dec 21, 2024
2c06530
ignore unused imports
DinhHuy2010 Dec 21, 2024
484886a
Initial formatting and liniting fix of all files
DinhHuy2010 Dec 21, 2024
6330d4b
add type checking configuration (use pyright)
DinhHuy2010 Dec 21, 2024
325891b
add _libgit2.pyi
DinhHuy2010 Dec 21, 2024
aa37e2d
mega fix _pygit2.pyi
DinhHuy2010 Dec 21, 2024
b53b9a7
fix stubs
DinhHuy2010 Dec 21, 2024
c70241d
change lib to Any
DinhHuy2010 Dec 21, 2024
42b5129
fix pyright config
DinhHuy2010 Dec 21, 2024
5f6657e
fix _pygit2.pyi again
DinhHuy2010 Dec 21, 2024
4b3878b
fix enums.py
DinhHuy2010 Dec 21, 2024
49bc71b
add FilterSource
DinhHuy2010 Dec 21, 2024
7433683
yet another fix the _pygit2.pyi
DinhHuy2010 Dec 21, 2024
3aabbc7
add typing to credentials.py
DinhHuy2010 Dec 21, 2024
9a1affc
add typing to errors.py
DinhHuy2010 Dec 21, 2024
735ba5a
fix pyproject again
DinhHuy2010 Dec 21, 2024
5fc3b70
add filter_* functions to _pygit2.pyi
DinhHuy2010 Dec 21, 2024
95b003f
add typing to utils.py
DinhHuy2010 Dec 21, 2024
e71d03b
fix ffi.py
DinhHuy2010 Dec 21, 2024
9b68da8
initial commit of pygit2 __init__
DinhHuy2010 Dec 21, 2024
7afd694
remove pygit2 star imports
DinhHuy2010 Dec 22, 2024
b2680c3
fix pyproject again
DinhHuy2010 Dec 22, 2024
4970a94
fix pyproject
DinhHuy2010 Dec 22, 2024
40f44c1
fix pyproject again
DinhHuy2010 Dec 22, 2024
e3ed43f
initial commit of pygit2 callbacks.py
DinhHuy2010 Dec 22, 2024
35fb5e1
typing fix for __init__.py
DinhHuy2010 Dec 22, 2024
c3b01f8
fix typing for _build.py and _run.py
DinhHuy2010 Dec 24, 2024
0fe1aac
fix pyproject.toml
DinhHuy2010 Dec 25, 2024
58b88c2
add typing for packbuilder.py
DinhHuy2010 Dec 25, 2024
d8755fb
fix typing for utils
DinhHuy2010 Dec 25, 2024
8114f2b
hotfix for packbuilder.py
DinhHuy2010 Dec 25, 2024
071df9d
fix _pygit2.pyi
DinhHuy2010 Dec 25, 2024
9a10a41
initial stub for repository.py
DinhHuy2010 Dec 25, 2024
5f2d9ae
add typing for branches.py
DinhHuy2010 Dec 29, 2024
720881e
add typing to blob.py and fix _pygit2.pyi
DinhHuy2010 Dec 30, 2024
0e55fb3
add typing for blame.py and add _ctyping
DinhHuy2010 Dec 30, 2024
6ab13f7
Resolve confilcts from 'upstream/master'
DinhHuy2010 Dec 30, 2024
5dca60a
change pathtype name to StrOrBytesPath
DinhHuy2010 Dec 30, 2024
599f2b7
fix _ctyping
DinhHuy2010 Dec 30, 2024
d3be17a
fix _ctyping again
DinhHuy2010 Dec 30, 2024
dddd720
add maybe_bytes
DinhHuy2010 Dec 30, 2024
f019420
add typing to config.py
DinhHuy2010 Jan 13, 2025
86c62cd
Merge branch 'master' of https://github.com/libgit2/pygit2 into typec…
DinhHuy2010 Jan 13, 2025
b0da06b
fix typing
DinhHuy2010 Jan 13, 2025
0fab374
Solve confilcts
DinhHuy2010 Feb 17, 2025
8b46dec
Merge branch 'master' into typecheck
DinhHuy2010 Feb 17, 2025
48e0dce
fix config
DinhHuy2010 Feb 17, 2025
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
510 changes: 489 additions & 21 deletions pygit2/__init__.py

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pygit2/_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def _get_libgit2_path():

# Default
if os.name == 'nt':
return Path(r'%s\libgit2' % os.getenv('ProgramFiles'))
return Path(r'%s\libgit2' % os.getenv('ProgramFiles')) # noqa: SIM112
return Path('/usr/local')


Expand Down
1 change: 1 addition & 0 deletions pygit2/_ctyping.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# placeholder for pyright
35 changes: 35 additions & 0 deletions pygit2/_ctyping.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
from _cffi_backend import _CDataBase

class CData(_CDataBase): ... # type: ignore

class _CSignatureTime(CData):
time: int
offset: int

class _CSignature(CData):
name: _CDataBase
email: _CDataBase
when: _CSignatureTime

class _COid(CData):
id: _CDataBase

class _CHunk(CData):
boundary: CData
final_commit_id: _COid
final_signature: _CSignature
final_start_line_number: int
lines_in_hunk: int
orig_commit_id: _COid
orig_path: _CDataBase
orig_signature: _CSignature
orig_start_line_number: int

class _CConfigEntry(CData):
backend_type: _CDataBase
free: _CDataBase
include_depth: int
level: int
name: _CDataBase
origin_path: _CDataBase
value: _CDataBase
6 changes: 6 additions & 0 deletions pygit2/_libgit2.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from typing import Any

import _cffi_backend

ffi: _cffi_backend.FFI
lib: Any
Loading