diff --git a/stubs/pygit2/@tests/stubtest_allowlist.txt b/stubs/pygit2/@tests/stubtest_allowlist.txt deleted file mode 100644 index 6c4060d50..000000000 --- a/stubs/pygit2/@tests/stubtest_allowlist.txt +++ /dev/null @@ -1,9 +0,0 @@ -# Actual signatures enforced by C-level checks not visible to stubtest -pygit2.Mailmap.__init__ -pygit2.OdbBackend.__init__ -pygit2.RefLogEntry.__init__ -pygit2.RefdbBackend.__init__ -pygit2._pygit2.Mailmap.__init__ -pygit2._pygit2.OdbBackend.__init__ -pygit2._pygit2.RefLogEntry.__init__ -pygit2._pygit2.RefdbBackend.__init__ diff --git a/stubs/pygit2/METADATA.toml b/stubs/pygit2/METADATA.toml deleted file mode 100644 index 8f0525f88..000000000 --- a/stubs/pygit2/METADATA.toml +++ /dev/null @@ -1,9 +0,0 @@ -version = "1.15.*" -upstream_repository = "https://github.com/libgit2/pygit2" -requires = ["types-cffi"] -obsolete_since = "1.16.0" # Released on 2024-10-11 - -[tool.stubtest] -platforms = ["darwin", "linux", "win32"] -# Does not build on any platform on Python 3.13 as of 2025-03-17. -skip = true diff --git a/stubs/pygit2/pygit2/__init__.pyi b/stubs/pygit2/pygit2/__init__.pyi deleted file mode 100644 index 18fb3dd9a..000000000 --- a/stubs/pygit2/pygit2/__init__.pyi +++ /dev/null @@ -1,60 +0,0 @@ -from _typeshed import StrOrBytesPath, SupportsAllComparisons -from collections.abc import Callable - -# This is intentionally duplicated and placed above the _pygit2 -# star-import to workaround mypy issue #16972, so that consumers -# of the stubs see the correct, wrapped type for the name -# "Repository". -from .repository import Repository as Repository # isort: skip - -from . import enums -from ._build import __version__ as __version__ -from ._pygit2 import * # type: ignore[assignment] -from .blame import Blame as Blame, BlameHunk as BlameHunk -from .blob import BlobIO as BlobIO -from .callbacks import ( - CheckoutCallbacks as CheckoutCallbacks, - Payload as Payload, - RemoteCallbacks as RemoteCallbacks, - StashApplyCallbacks as StashApplyCallbacks, - get_credentials as get_credentials, -) -from .config import Config as Config -from .credentials import * -from .errors import Passthrough as Passthrough -from .filter import Filter as Filter -from .index import Index as Index, IndexEntry as IndexEntry -from .legacyenums import * -from .packbuilder import PackBuilder as PackBuilder -from .remotes import Remote as Remote -from .repository import Repository as Repository # noqa: F811 # intentional workaround -from .settings import Settings -from .submodules import Submodule as Submodule - -features: enums.Feature -LIBGIT2_VER: tuple[int, int, int] - -def init_repository( - path: StrOrBytesPath | None, - bare: bool = False, - flags: enums.RepositoryInitFlag = ..., - mode: int | enums.RepositoryInitMode = ..., - workdir_path: str | None = None, - description: str | None = None, - template_path: str | None = None, - initial_head: str | None = None, - origin_url: str | None = None, -) -> Repository: ... -def clone_repository( - url: str, - path: str, - bare: bool = False, - repository: Callable[[str, bool], Repository] | None = None, - remote: Callable[[Repository, str, str], Remote] | None = None, - checkout_branch: str | None = None, - callbacks: RemoteCallbacks | None = None, - depth: int = 0, -) -> Repository: ... - -tree_entry_key: Callable[[Object], SupportsAllComparisons] # functools.cmp_to_key(tree_entry_cmp) -settings: Settings diff --git a/stubs/pygit2/pygit2/_build.pyi b/stubs/pygit2/pygit2/_build.pyi deleted file mode 100644 index 5935b7452..000000000 --- a/stubs/pygit2/pygit2/_build.pyi +++ /dev/null @@ -1,5 +0,0 @@ -from pathlib import Path - -__version__: str - -def get_libgit2_paths() -> tuple[Path, dict[str, list[str]]]: ... diff --git a/stubs/pygit2/pygit2/_libgit2.pyi b/stubs/pygit2/pygit2/_libgit2.pyi deleted file mode 100644 index d31354b1b..000000000 --- a/stubs/pygit2/pygit2/_libgit2.pyi +++ /dev/null @@ -1,4 +0,0 @@ -from _cffi_backend import FFI, Lib - -ffi: FFI -lib: Lib diff --git a/stubs/pygit2/pygit2/_pygit2.pyi b/stubs/pygit2/pygit2/_pygit2.pyi deleted file mode 100644 index 4dfdab534..000000000 --- a/stubs/pygit2/pygit2/_pygit2.pyi +++ /dev/null @@ -1,763 +0,0 @@ -from _typeshed import StrOrBytesPath -from collections.abc import Iterator -from io import IOBase -from typing import Any, Literal, final, overload -from typing_extensions import TypeAlias - -from . import Index -from .enums import ( - ApplyLocation, - BranchType, - DiffFind, - DiffFlag, - DiffOption, - DiffStatsFormat, - FileMode, - FileStatus, - MergeAnalysis, - MergePreference, - ObjectType, - Option, - ReferenceFilter, - ReferenceType, - ResetMode, - SortMode, -) -from .filter import Filter - -GIT_APPLY_LOCATION_BOTH: int -GIT_APPLY_LOCATION_INDEX: int -GIT_APPLY_LOCATION_WORKDIR: int -GIT_BLAME_FIRST_PARENT: int -GIT_BLAME_IGNORE_WHITESPACE: int -GIT_BLAME_NORMAL: int -GIT_BLAME_TRACK_COPIES_ANY_COMMIT_COPIES: int -GIT_BLAME_TRACK_COPIES_SAME_COMMIT_COPIES: int -GIT_BLAME_TRACK_COPIES_SAME_COMMIT_MOVES: int -GIT_BLAME_TRACK_COPIES_SAME_FILE: int -GIT_BLAME_USE_MAILMAP: int -GIT_BLOB_FILTER_ATTRIBUTES_FROM_COMMIT: int -GIT_BLOB_FILTER_ATTRIBUTES_FROM_HEAD: int -GIT_BLOB_FILTER_CHECK_FOR_BINARY: int -GIT_BLOB_FILTER_NO_SYSTEM_ATTRIBUTES: int -GIT_BRANCH_ALL: int -GIT_BRANCH_LOCAL: int -GIT_BRANCH_REMOTE: int -GIT_CHECKOUT_ALLOW_CONFLICTS: int -GIT_CHECKOUT_CONFLICT_STYLE_DIFF3: int -GIT_CHECKOUT_CONFLICT_STYLE_MERGE: int -GIT_CHECKOUT_CONFLICT_STYLE_ZDIFF3: int -GIT_CHECKOUT_DISABLE_PATHSPEC_MATCH: int -GIT_CHECKOUT_DONT_OVERWRITE_IGNORED: int -GIT_CHECKOUT_DONT_REMOVE_EXISTING: int -GIT_CHECKOUT_DONT_UPDATE_INDEX: int -GIT_CHECKOUT_DONT_WRITE_INDEX: int -GIT_CHECKOUT_DRY_RUN: int -GIT_CHECKOUT_FORCE: int -GIT_CHECKOUT_NONE: int -GIT_CHECKOUT_NO_REFRESH: int -GIT_CHECKOUT_RECREATE_MISSING: int -GIT_CHECKOUT_REMOVE_IGNORED: int -GIT_CHECKOUT_REMOVE_UNTRACKED: int -GIT_CHECKOUT_SAFE: int -GIT_CHECKOUT_SKIP_LOCKED_DIRECTORIES: int -GIT_CHECKOUT_SKIP_UNMERGED: int -GIT_CHECKOUT_UPDATE_ONLY: int -GIT_CHECKOUT_USE_OURS: int -GIT_CHECKOUT_USE_THEIRS: int -GIT_CONFIG_HIGHEST_LEVEL: int -GIT_CONFIG_LEVEL_APP: int -GIT_CONFIG_LEVEL_WORKTREE: int -GIT_CONFIG_LEVEL_GLOBAL: int -GIT_CONFIG_LEVEL_LOCAL: int -GIT_CONFIG_LEVEL_PROGRAMDATA: int -GIT_CONFIG_LEVEL_SYSTEM: int -GIT_CONFIG_LEVEL_XDG: int -GIT_DELTA_ADDED: int -GIT_DELTA_CONFLICTED: int -GIT_DELTA_COPIED: int -GIT_DELTA_DELETED: int -GIT_DELTA_IGNORED: int -GIT_DELTA_MODIFIED: int -GIT_DELTA_RENAMED: int -GIT_DELTA_TYPECHANGE: int -GIT_DELTA_UNMODIFIED: int -GIT_DELTA_UNREADABLE: int -GIT_DELTA_UNTRACKED: int -GIT_DESCRIBE_ALL: int -GIT_DESCRIBE_DEFAULT: int -GIT_DESCRIBE_TAGS: int -GIT_DIFF_BREAK_REWRITES: int -GIT_DIFF_BREAK_REWRITES_FOR_RENAMES_ONLY: int -GIT_DIFF_DISABLE_PATHSPEC_MATCH: int -GIT_DIFF_ENABLE_FAST_UNTRACKED_DIRS: int -GIT_DIFF_FIND_ALL: int -GIT_DIFF_FIND_AND_BREAK_REWRITES: int -GIT_DIFF_FIND_BY_CONFIG: int -GIT_DIFF_FIND_COPIES: int -GIT_DIFF_FIND_COPIES_FROM_UNMODIFIED: int -GIT_DIFF_FIND_DONT_IGNORE_WHITESPACE: int -GIT_DIFF_FIND_EXACT_MATCH_ONLY: int -GIT_DIFF_FIND_FOR_UNTRACKED: int -GIT_DIFF_FIND_IGNORE_LEADING_WHITESPACE: int -GIT_DIFF_FIND_IGNORE_WHITESPACE: int -GIT_DIFF_FIND_REMOVE_UNMODIFIED: int -GIT_DIFF_FIND_RENAMES: int -GIT_DIFF_FIND_RENAMES_FROM_REWRITES: int -GIT_DIFF_FIND_REWRITES: int -GIT_DIFF_FLAG_BINARY: int -GIT_DIFF_FLAG_EXISTS: int -GIT_DIFF_FLAG_NOT_BINARY: int -GIT_DIFF_FLAG_VALID_ID: int -GIT_DIFF_FLAG_VALID_SIZE: int -GIT_DIFF_FORCE_BINARY: int -GIT_DIFF_FORCE_TEXT: int -GIT_DIFF_IGNORE_BLANK_LINES: int -GIT_DIFF_IGNORE_CASE: int -GIT_DIFF_IGNORE_FILEMODE: int -GIT_DIFF_IGNORE_SUBMODULES: int -GIT_DIFF_IGNORE_WHITESPACE: int -GIT_DIFF_IGNORE_WHITESPACE_CHANGE: int -GIT_DIFF_IGNORE_WHITESPACE_EOL: int -GIT_DIFF_INCLUDE_CASECHANGE: int -GIT_DIFF_INCLUDE_IGNORED: int -GIT_DIFF_INCLUDE_TYPECHANGE: int -GIT_DIFF_INCLUDE_TYPECHANGE_TREES: int -GIT_DIFF_INCLUDE_UNMODIFIED: int -GIT_DIFF_INCLUDE_UNREADABLE: int -GIT_DIFF_INCLUDE_UNREADABLE_AS_UNTRACKED: int -GIT_DIFF_INCLUDE_UNTRACKED: int -GIT_DIFF_INDENT_HEURISTIC: int -GIT_DIFF_MINIMAL: int -GIT_DIFF_NORMAL: int -GIT_DIFF_PATIENCE: int -GIT_DIFF_RECURSE_IGNORED_DIRS: int -GIT_DIFF_RECURSE_UNTRACKED_DIRS: int -GIT_DIFF_REVERSE: int -GIT_DIFF_SHOW_BINARY: int -GIT_DIFF_SHOW_UNMODIFIED: int -GIT_DIFF_SHOW_UNTRACKED_CONTENT: int -GIT_DIFF_SKIP_BINARY_CHECK: int -GIT_DIFF_STATS_FULL: int -GIT_DIFF_STATS_INCLUDE_SUMMARY: int -GIT_DIFF_STATS_NONE: int -GIT_DIFF_STATS_NUMBER: int -GIT_DIFF_STATS_SHORT: int -GIT_DIFF_UPDATE_INDEX: int -GIT_FILEMODE_BLOB: int -GIT_FILEMODE_BLOB_EXECUTABLE: int -GIT_FILEMODE_COMMIT: int -GIT_FILEMODE_LINK: int -GIT_FILEMODE_TREE: int -GIT_FILEMODE_UNREADABLE: int -GIT_FILTER_ALLOW_UNSAFE: int -GIT_FILTER_ATTRIBUTES_FROM_COMMIT: int -GIT_FILTER_ATTRIBUTES_FROM_HEAD: int -GIT_FILTER_CLEAN: int -GIT_FILTER_DEFAULT: int -GIT_FILTER_DRIVER_PRIORITY: int -GIT_FILTER_NO_SYSTEM_ATTRIBUTES: int -GIT_FILTER_SMUDGE: int -GIT_FILTER_TO_ODB: int -GIT_FILTER_TO_WORKTREE: int -GIT_MERGE_ANALYSIS_FASTFORWARD: int -GIT_MERGE_ANALYSIS_NONE: int -GIT_MERGE_ANALYSIS_NORMAL: int -GIT_MERGE_ANALYSIS_UNBORN: int -GIT_MERGE_ANALYSIS_UP_TO_DATE: int -GIT_MERGE_PREFERENCE_FASTFORWARD_ONLY: int -GIT_MERGE_PREFERENCE_NONE: int -GIT_MERGE_PREFERENCE_NO_FASTFORWARD: int -GIT_OBJECT_ANY: int -GIT_OBJECT_BLOB: int -GIT_OBJECT_COMMIT: int -GIT_OBJECT_INVALID: int -GIT_OBJECT_OFS_DELTA: int -GIT_OBJECT_REF_DELTA: int -GIT_OBJECT_TAG: int -GIT_OBJECT_TREE: int -GIT_OID_HEXSZ: int -GIT_OID_HEX_ZERO: str -GIT_OID_MINPREFIXLEN: int -GIT_OID_RAWSZ: int -GIT_OPT_DISABLE_PACK_KEEP_FILE_CHECKS: int -GIT_OPT_ENABLE_CACHING: int -GIT_OPT_ENABLE_FSYNC_GITDIR: int -GIT_OPT_ENABLE_OFS_DELTA: int -GIT_OPT_ENABLE_STRICT_HASH_VERIFICATION: int -GIT_OPT_ENABLE_STRICT_OBJECT_CREATION: int -GIT_OPT_ENABLE_STRICT_SYMBOLIC_REF_CREATION: int -GIT_OPT_ENABLE_UNSAVED_INDEX_SAFETY: int -GIT_OPT_GET_CACHED_MEMORY: int -GIT_OPT_GET_MWINDOW_MAPPED_LIMIT: int -GIT_OPT_GET_MWINDOW_SIZE: int -GIT_OPT_GET_OWNER_VALIDATION: int -GIT_OPT_GET_PACK_MAX_OBJECTS: int -GIT_OPT_GET_SEARCH_PATH: int -GIT_OPT_GET_TEMPLATE_PATH: int -GIT_OPT_GET_USER_AGENT: int -GIT_OPT_GET_WINDOWS_SHAREMODE: int -GIT_OPT_SET_ALLOCATOR: int -GIT_OPT_SET_CACHE_MAX_SIZE: int -GIT_OPT_SET_CACHE_OBJECT_LIMIT: int -GIT_OPT_SET_MWINDOW_MAPPED_LIMIT: int -GIT_OPT_SET_MWINDOW_SIZE: int -GIT_OPT_SET_OWNER_VALIDATION: int -GIT_OPT_SET_PACK_MAX_OBJECTS: int -GIT_OPT_SET_SEARCH_PATH: int -GIT_OPT_SET_SSL_CERT_LOCATIONS: int -GIT_OPT_SET_SSL_CIPHERS: int -GIT_OPT_SET_TEMPLATE_PATH: int -GIT_OPT_SET_USER_AGENT: int -GIT_OPT_SET_WINDOWS_SHAREMODE: int -GIT_REFERENCES_ALL: int -GIT_REFERENCES_BRANCHES: int -GIT_REFERENCES_TAGS: int -GIT_RESET_HARD: int -GIT_RESET_MIXED: int -GIT_RESET_SOFT: int -GIT_REVSPEC_MERGE_BASE: int -GIT_REVSPEC_RANGE: int -GIT_REVSPEC_SINGLE: int -GIT_SORT_NONE: int -GIT_SORT_REVERSE: int -GIT_SORT_TIME: int -GIT_SORT_TOPOLOGICAL: int -GIT_STASH_APPLY_DEFAULT: int -GIT_STASH_APPLY_REINSTATE_INDEX: int -GIT_STASH_DEFAULT: int -GIT_STASH_INCLUDE_IGNORED: int -GIT_STASH_INCLUDE_UNTRACKED: int -GIT_STASH_KEEP_ALL: int -GIT_STASH_KEEP_INDEX: int -GIT_STATUS_CONFLICTED: int -GIT_STATUS_CURRENT: int -GIT_STATUS_IGNORED: int -GIT_STATUS_INDEX_DELETED: int -GIT_STATUS_INDEX_MODIFIED: int -GIT_STATUS_INDEX_NEW: int -GIT_STATUS_INDEX_RENAMED: int -GIT_STATUS_INDEX_TYPECHANGE: int -GIT_STATUS_WT_DELETED: int -GIT_STATUS_WT_MODIFIED: int -GIT_STATUS_WT_NEW: int -GIT_STATUS_WT_RENAMED: int -GIT_STATUS_WT_TYPECHANGE: int -GIT_STATUS_WT_UNREADABLE: int -GIT_SUBMODULE_IGNORE_ALL: int -GIT_SUBMODULE_IGNORE_DIRTY: int -GIT_SUBMODULE_IGNORE_NONE: int -GIT_SUBMODULE_IGNORE_UNSPECIFIED: int -GIT_SUBMODULE_IGNORE_UNTRACKED: int -GIT_SUBMODULE_STATUS_INDEX_ADDED: int -GIT_SUBMODULE_STATUS_INDEX_DELETED: int -GIT_SUBMODULE_STATUS_INDEX_MODIFIED: int -GIT_SUBMODULE_STATUS_IN_CONFIG: int -GIT_SUBMODULE_STATUS_IN_HEAD: int -GIT_SUBMODULE_STATUS_IN_INDEX: int -GIT_SUBMODULE_STATUS_IN_WD: int -GIT_SUBMODULE_STATUS_WD_ADDED: int -GIT_SUBMODULE_STATUS_WD_DELETED: int -GIT_SUBMODULE_STATUS_WD_INDEX_MODIFIED: int -GIT_SUBMODULE_STATUS_WD_MODIFIED: int -GIT_SUBMODULE_STATUS_WD_UNINITIALIZED: int -GIT_SUBMODULE_STATUS_WD_UNTRACKED: int -GIT_SUBMODULE_STATUS_WD_WD_MODIFIED: int -LIBGIT2_VERSION: str -LIBGIT2_VER_MAJOR: int -LIBGIT2_VER_MINOR: int -LIBGIT2_VER_REVISION: int - -_GIT_OBJ_BLOB: TypeAlias = Literal[3] -_GIT_OBJ_COMMIT: TypeAlias = Literal[1] -_GIT_OBJ_TAG: TypeAlias = Literal[4] -_GIT_OBJ_TREE: TypeAlias = Literal[2] - -class Object: - _pointer: bytes - filemode: FileMode - id: Oid - name: str | None - raw_name: bytes | None - short_id: str - type: Literal[_GIT_OBJ_COMMIT, _GIT_OBJ_TREE, _GIT_OBJ_TAG, _GIT_OBJ_BLOB] - type_str: Literal["commit", "tree", "tag", "blob"] - @overload - def peel(self, target_type: Literal[_GIT_OBJ_COMMIT]) -> Commit: ... - @overload - def peel(self, target_type: Literal[_GIT_OBJ_TREE]) -> Tree: ... - @overload - def peel(self, target_type: Literal[_GIT_OBJ_TAG]) -> Tag: ... - @overload - def peel(self, target_type: Literal[_GIT_OBJ_BLOB]) -> Blob: ... - @overload - def peel(self, target_type: None) -> Commit | Tree | Blob: ... - def read_raw(self) -> bytes: ... - def __eq__(self, other: object) -> bool: ... - def __ge__(self, other: object) -> bool: ... - def __gt__(self, other: object) -> bool: ... - def __hash__(self) -> int: ... - def __le__(self, other: object) -> bool: ... - def __lt__(self, other: object) -> bool: ... - def __ne__(self, other: object) -> bool: ... - -@final -class Reference: - name: str - raw_name: bytes - raw_shorthand: bytes - raw_target: Oid | bytes - shorthand: str - target: Oid | str - type: ReferenceType - @overload - def __init__(self, name: str, target: str) -> None: ... - @overload - def __init__(self, name: str, oid: Oid, peel: Oid) -> None: ... - def delete(self) -> None: ... - def log(self) -> Iterator[RefLogEntry]: ... - @overload - def peel(self, type: Literal[_GIT_OBJ_COMMIT]) -> Commit: ... - @overload - def peel(self, type: Literal[_GIT_OBJ_TREE]) -> Tree: ... - @overload - def peel(self, type: Literal[_GIT_OBJ_TAG]) -> Tag: ... - @overload - def peel(self, type: Literal[_GIT_OBJ_BLOB]) -> Blob: ... - @overload - def peel(self, type: None) -> Commit | Tree | Blob: ... - def rename(self, new_name: str) -> None: ... - def resolve(self) -> Reference: ... - def set_target(self, target: _OidArg, message: str = ...) -> None: ... - def __eq__(self, other: object) -> bool: ... - def __ge__(self, other: object) -> bool: ... - def __gt__(self, other: object) -> bool: ... - def __le__(self, other: object) -> bool: ... - def __lt__(self, other: object) -> bool: ... - def __ne__(self, other: object) -> bool: ... - -class AlreadyExistsError(ValueError): ... - -@final -class Blob(Object): - data: bytes - is_binary: bool - size: int - def diff(self, blob: Blob = ..., flag: int = ..., old_as_path: str = ..., new_as_path: str = ...) -> Patch: ... - def diff_to_buffer( - self, buffer: bytes | None = None, flag: DiffOption = ..., old_as_path: str = ..., buffer_as_path: str = ... - ) -> Patch: ... - -# This is not a real subclassing. Just ensuring type-checkers sees this type as compatible with _CDataBase -# pyright has no error code for subclassing final -@final -class Branch(Reference): # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] - branch_name: str - raw_branch_name: bytes - remote_name: str - upstream: Branch - upstream_name: str - def delete(self) -> None: ... - def is_checked_out(self) -> bool: ... - def is_head(self) -> bool: ... - def rename(self, name: str, force: bool = False) -> None: ... - -@final -class Commit(Object): - author: Signature - commit_time: int - commit_time_offset: int - committer: Signature - gpg_signature: tuple[bytes, bytes] - message: str - message_encoding: str - message_trailers: dict[str, str] - parent_ids: list[Oid] - parents: list[Commit] - raw_message: bytes - tree: Tree - tree_id: Oid - -class Diff: - deltas: Iterator[DiffDelta] - patch: str | None - patchid: Oid - stats: DiffStats - def find_similar( - self, - flags: DiffFind = ..., - rename_threshold: int = 50, - copy_threshold: int = 50, - rename_from_rewrite_threshold: int = 50, - break_rewrite_threshold: int = 60, - rename_limit: int = 1000, - ) -> None: ... - def merge(self, diff: Diff) -> None: ... - @staticmethod - def from_c(diff: bytes, repo: Repository) -> Diff: ... - @staticmethod - def parse_diff(git_diff: str | bytes) -> Diff: ... - def __getitem__(self, index: int) -> Patch: ... # Diff_getitem - def __iter__(self) -> Iterator[Patch]: ... # -> DiffIter - def __len__(self) -> int: ... - -@final -class DiffDelta: - flags: DiffFlag - is_binary: bool - nfiles: int - new_file: DiffFile - old_file: DiffFile - similarity: int - status: FileStatus - def status_char(self) -> str: ... - -@final -class DiffFile: - flags: DiffFlag - id: Oid - mode: FileMode - path: str - raw_path: bytes - size: int - @staticmethod - def from_c(ptr: bytes) -> DiffFile: ... - -class DiffHunk: - header: str - lines: list[DiffLine] - new_lines: int - new_start: int - old_lines: int - old_start: int - -@final -class DiffLine: - content: str - content_offset: int - new_lineno: int - num_lines: int - old_lineno: int - origin: str - raw_content: bytes - -class DiffStats: - deletions: int - files_changed: int - insertions: int - def format(self, format: DiffStatsFormat, width: int) -> str: ... - -@final -class FilterSource: - repo: Repository - path: str - filemode: int - oid: Oid - mode: int - flags: int - -class GitError(Exception): ... -class InvalidSpecError(ValueError): ... - -@final -class Mailmap: - def __init__(self) -> None: ... - def add_entry( - self, real_name: str = ..., real_email: str = ..., replace_name: str = ..., replace_email: str = ... - ) -> None: ... - @staticmethod - def from_buffer(buffer: str | bytes) -> Mailmap: ... - @staticmethod - def from_repository(repository: Repository) -> Mailmap: ... - def resolve(self, name: str, email: str) -> tuple[str, str]: ... - def resolve_signature(self, sig: Signature) -> Signature: ... - -@final -class Note: - annotated_id: Oid - id: Oid - message: str - def remove(self, author: Signature, committer: Signature, ref: str = "refs/notes/commits") -> None: ... - -@final -class Odb: - backends: Iterator[OdbBackend] - def __init__(self, path: StrOrBytesPath | None = None) -> None: ... - def add_backend(self, backend: OdbBackend, priority: int) -> None: ... - def add_disk_alternate(self, path: str) -> None: ... - def exists(self, oid: _OidArg) -> bool: ... - def read(self, oid: _OidArg) -> tuple[int, int, bytes]: ... - def write(self, type: int, data: bytes) -> Oid: ... - def __contains__(self, other: _OidArg) -> bool: ... - def __iter__(self) -> Iterator[Oid]: ... # Odb_as_iter - -class OdbBackend: - def __init__(self) -> None: ... - def exists(self, oid: _OidArg) -> bool: ... - def exists_prefix(self, partial_id: _OidArg) -> Oid: ... - def read(self, oid: _OidArg) -> tuple[int, bytes]: ... - def read_header(self, oid: _OidArg) -> tuple[int, int]: ... - def read_prefix(self, oid: _OidArg) -> tuple[int, bytes, Oid]: ... - def refresh(self) -> None: ... - def __iter__(self) -> Iterator[Oid]: ... # OdbBackend_as_iter - -@final -class OdbBackendLoose(OdbBackend): - def __init__( - self, objects_dir: StrOrBytesPath, compression_level: int, do_fsync: bool, dir_mode: int = 0, file_mode: int = 0 - ) -> None: ... - -@final -class OdbBackendPack(OdbBackend): - def __init__(self, path: StrOrBytesPath) -> None: ... - -@final -class Oid: - raw: bytes - def __init__(self, raw: bytes = ..., hex: str = ...) -> None: ... - def __eq__(self, other: object) -> bool: ... - def __ge__(self, other: object) -> bool: ... - def __gt__(self, other: object) -> bool: ... - def __hash__(self) -> int: ... - def __le__(self, other: object) -> bool: ... - def __lt__(self, other: object) -> bool: ... - def __ne__(self, other: object) -> bool: ... - -@final -class Patch: - data: bytes - delta: DiffDelta - hunks: list[DiffHunk] - line_stats: tuple[int, int, int] # context, additions, deletions - text: str | None - - @staticmethod - def create_from( - old: Blob | bytes | None, - new: Blob | bytes | None, - old_as_path: str = ..., - new_as_path: str = ..., - flag: DiffOption = ..., - context_lines: int = 3, - interhunk_lines: int = 0, - ) -> Patch: ... - -@final -class RefLogEntry: - committer: Signature - message: str - oid_new: Oid - oid_old: Oid - -@final -class Refdb: - def compress(self) -> None: ... - @staticmethod - def new(repo: Repository) -> Refdb: ... - @staticmethod - def open(repo: Repository) -> Refdb: ... - def set_backend(self, backend: RefdbBackend) -> None: ... - -class RefdbBackend: - def __init__(self) -> None: ... - def compress(self) -> None: ... - def delete(self, ref_name: str, old_id: _OidArg, old_target: str) -> None: ... - def ensure_log(self, ref_name: str) -> bool: ... - def exists(self, refname: str) -> bool: ... - def has_log(self, ref_name: str) -> bool: ... - def lookup(self, refname: str) -> Reference: ... - def rename(self, old_name: str, new_name: str, force: bool, who: Signature, message: str) -> Reference: ... - def write(self, ref: Reference, force: bool, who: Signature, message: str, old: _OidArg, old_target: str) -> None: ... - -@final -class RefdbFsBackend(RefdbBackend): - def __init__(self, repo: Repository) -> None: ... - -class Repository: - _pointer: bytes - default_signature: Signature - head: Reference - head_is_detached: bool - head_is_unborn: bool - is_bare: bool - is_empty: bool - is_shallow: bool - odb: Odb - path: str - refdb: Refdb - workdir: str - def __init__(self, backend: object | None = None) -> None: ... - def TreeBuilder(self, src: Tree | _OidArg = ...) -> TreeBuilder: ... - def _disown(self) -> None: ... - def _from_c(self, pointer: bytes, free: bool) -> None: ... - def add_worktree(self, name: str, path: str, ref: Reference = ...) -> Worktree: ... - def applies(self, diff: Diff, location: ApplyLocation = ..., raise_error: bool = False) -> bool: ... - def apply(self, diff: Diff, location: ApplyLocation = ...) -> None: ... - def cherrypick(self, id: _OidArg) -> None: ... - def compress_references(self) -> None: ... - def create_blob(self, data: bytes) -> Oid: ... - def create_blob_fromdisk(self, path: str) -> Oid: ... - def create_blob_fromiobase(self, iobase: IOBase) -> Oid: ... - def create_blob_fromworkdir(self, path: str) -> Oid: ... - def create_branch(self, name: str, commit: Commit, force: bool = False) -> Branch: ... - def create_commit( - self, - reference_name: str | None, - author: Signature, - committer: Signature, - message: str | bytes, - tree: _OidArg, - parents: list[_OidArg], - encoding: str = ..., - ) -> Oid: ... - def create_commit_string( - self, - author: Signature, - committer: Signature, - message: str | bytes, - tree: _OidArg, - parents: list[_OidArg], - encoding: str = ..., - ) -> Oid: ... - def create_commit_with_signature(self, content: str, signature: str, signature_field: str | None = None) -> Oid: ... - def create_note( - self, - message: str, - author: Signature, - committer: Signature, - annotated_id: str, - ref: str = "refs/notes/commits", - force: bool = False, - ) -> Oid: ... - def create_reference_direct(self, name: str, target: _OidArg, force: bool, message: str | None = None) -> Reference: ... - def create_reference_symbolic(self, name: str, target: str, force: bool, message: str | None = None) -> Reference: ... - def create_tag(self, name: str, oid: _OidArg, type: ObjectType, tagger: Signature, message: str) -> Oid: ... - def descendant_of(self, oid1: _OidArg, oid2: _OidArg) -> bool: ... - def expand_id(self, hex: str) -> Oid: ... - def free(self) -> None: ... - def git_object_lookup_prefix(self, oid: _OidArg) -> Object: ... - def list_worktrees(self) -> list[str]: ... - def listall_branches(self, flag: BranchType = ...) -> list[str]: ... - def listall_mergeheads(self) -> list[Oid]: ... - def listall_stashes(self) -> list[Stash]: ... - def listall_submodules(self) -> list[str]: ... - def lookup_branch(self, branch_name: str, branch_type: BranchType = ...) -> Branch: ... - def lookup_note(self, annotated_id: str, ref: str = "refs/notes/commits") -> Note: ... - def lookup_reference(self, name: str) -> Reference: ... - def lookup_reference_dwim(self, name: str) -> Reference: ... - def lookup_worktree(self, name: str) -> Worktree: ... - def merge_analysis(self, their_head: _OidArg, our_ref: str = "HEAD") -> tuple[MergeAnalysis, MergePreference]: ... - def merge_base(self, oid1: _OidArg, oid2: _OidArg) -> Oid: ... - def merge_base_many(self, oids: list[_OidArg]) -> Oid: ... - def merge_base_octopus(self, oids: list[_OidArg]) -> Oid: ... - def notes(self) -> Iterator[Note]: ... - def path_is_ignored(self, path: str) -> bool: ... - def raw_listall_branches(self, flag: BranchType = ...) -> list[bytes]: ... - def raw_listall_references(self) -> list[bytes]: ... - def references_iterator_init(self) -> Iterator[Reference]: ... - def references_iterator_next(self, iter: Iterator[Reference], references_return_type: ReferenceFilter = ...) -> Reference: ... - def reset(self, oid: _OidArg, reset_type: ResetMode) -> None: ... - def revparse(self, revspec: str) -> RevSpec: ... - def revparse_ext(self, revision: str) -> tuple[Object, Reference]: ... - def revparse_single(self, revision: str) -> Object: ... - def set_odb(self, odb: Odb) -> None: ... - def set_refdb(self, refdb: Refdb) -> None: ... - def status(self, untracked_files: str = "all", ignored: bool = False) -> dict[str, int]: ... - def status_file(self, path: str) -> int: ... - def walk(self, oid: _OidArg | None, sort_mode: SortMode = ...) -> Walker: ... - -class RevSpec: - flags: int - from_object: Object - to_object: Object - -@final -class Signature: - _encoding: str | None - _pointer: bytes - email: str - name: str - offset: int - raw_email: bytes - raw_name: bytes - time: int - def __init__(self, name: str, email: str, time: int = -1, offset: int = 0, encoding: str | None = None) -> None: ... - def __eq__(self, other: object) -> bool: ... - def __ge__(self, other: object) -> bool: ... - def __gt__(self, other: object) -> bool: ... - def __le__(self, other: object) -> bool: ... - def __lt__(self, other: object) -> bool: ... - def __ne__(self, other: object) -> bool: ... - -@final -class Stash: - commit_id: Oid - message: str - raw_message: bytes - def __eq__(self, other: object) -> bool: ... - def __ge__(self, other: object) -> bool: ... - def __gt__(self, other: object) -> bool: ... - def __le__(self, other: object) -> bool: ... - def __lt__(self, other: object) -> bool: ... - def __ne__(self, other: object) -> bool: ... - -@final -class Tag(Object): - message: str - name: str - raw_message: bytes - raw_name: bytes - tagger: Signature - target: Oid - def get_object(self) -> Object: ... - -class Tree(Object): - def diff_to_index(self, index: Index, flags: DiffOption = ..., context_lines: int = 3, interhunk_lines: int = 0) -> Diff: ... - def diff_to_tree( - self, tree: Tree = ..., flags: DiffOption = ..., context_lines: int = 3, interhunk_lines: int = 3, swap: bool = False - ) -> Diff: ... - def diff_to_workdir(self, flags: DiffOption = ..., context_lines: int = 3, interhunk_lines: int = 0) -> Diff: ... - def __contains__(self, other: str) -> bool: ... # Tree_contains - def __getitem__(self, index: str | int) -> Object: ... # Tree_subscript - def __iter__(self) -> Iterator[Object]: ... - def __len__(self) -> int: ... # Tree_len - def __rtruediv__(self, other: str) -> Object: ... - def __truediv__(self, other: str) -> Object: ... # Tree_divide - -class TreeBuilder: - def clear(self) -> None: ... - def get(self, name: str) -> Object: ... - def insert(self, name: str, oid: _OidArg, attr: int) -> None: ... - def remove(self, name: str) -> None: ... - def write(self) -> Oid: ... - def __len__(self) -> int: ... - -@final -class Walker: - def hide(self, oid: _OidArg) -> None: ... - def push(self, oid: _OidArg) -> None: ... - def reset(self) -> None: ... - def simplify_first_parent(self) -> None: ... - def sort(self, mode: SortMode) -> None: ... - def __iter__(self) -> Iterator[Commit]: ... # Walker: ... - def __next__(self) -> Commit: ... - -@final -class Worktree: - is_prunable: bool - name: str - path: str - def prune(self, force: bool = False) -> None: ... - -def discover_repository(path: str, across_fs: bool = False, ceiling_dirs: str = ...) -> str: ... -def filter_register(name: str, filter_cls: type[Filter], priority: int = ...) -> None: ... -def filter_unregister(name: str) -> None: ... -def hash(data: bytes) -> Oid: ... -def hashfile(path: str) -> Oid: ... -def init_file_backend(path: str, flags: int = 0) -> object: ... -def option(opt: Option, *args: Any) -> int | str | tuple[int, int] | None: ... -def reference_is_valid_name(refname: str) -> bool: ... -def tree_entry_cmp(a: Object, b: Object) -> int: ... -def _cache_enums() -> None: ... # undocumented - -_OidArg: TypeAlias = str | Oid diff --git a/stubs/pygit2/pygit2/_run.pyi b/stubs/pygit2/pygit2/_run.pyi deleted file mode 100644 index 03e229995..000000000 --- a/stubs/pygit2/pygit2/_run.pyi +++ /dev/null @@ -1,15 +0,0 @@ -from _typeshed import Incomplete -from pathlib import Path - -from cffi import FFI - -dir_path: Path -h_files: list[str] -h_source: list[str] -h_file: Path -f: Incomplete -C_HEADER_SRC: str -C_PREAMBLE: str -_: Path -libgit2_kw: dict[str, list[str]] -ffi: FFI diff --git a/stubs/pygit2/pygit2/blame.pyi b/stubs/pygit2/pygit2/blame.pyi deleted file mode 100644 index c483d7107..000000000 --- a/stubs/pygit2/pygit2/blame.pyi +++ /dev/null @@ -1,34 +0,0 @@ -from collections.abc import Iterator - -from _cffi_backend import _CDataBase - -from ._pygit2 import Oid, Signature - -def wrap_signature(csig: _CDataBase) -> Signature: ... - -class BlameHunk: - @property - def lines_in_hunk(self) -> int: ... - @property - def boundary(self) -> bool: ... - @property - def final_start_line_number(self) -> int: ... - @property - def final_committer(self) -> Signature: ... - @property - def final_commit_id(self) -> Oid: ... - @property - def orig_start_line_number(self) -> int: ... - @property - def orig_committer(self) -> Signature: ... - @property - def orig_commit_id(self) -> Oid: ... - @property - def orig_path(self) -> str | None: ... - -class Blame: - def __del__(self) -> None: ... - def __len__(self) -> int: ... - def __getitem__(self, index: int) -> BlameHunk: ... - def for_line(self, line_no: int) -> BlameHunk: ... - def __iter__(self) -> Iterator[BlameHunk]: ... diff --git a/stubs/pygit2/pygit2/blob.pyi b/stubs/pygit2/pygit2/blob.pyi deleted file mode 100644 index 325ad3a8b..000000000 --- a/stubs/pygit2/pygit2/blob.pyi +++ /dev/null @@ -1,25 +0,0 @@ -import io -import types -from _typeshed import WriteableBuffer -from contextlib import AbstractContextManager - -from ._pygit2 import Blob, Oid -from .enums import BlobFilter - -class _BlobIO(io.RawIOBase): - def __init__(self, blob: Blob, as_path: str | None = None, flags: BlobFilter = ..., commit_id: Oid | None = None) -> None: ... - def __exit__( - self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: types.TracebackType | None - ) -> None: ... - def isatty() -> bool: ... # type: ignore[misc] - def readable(self) -> bool: ... - def writable(self) -> bool: ... - def seekable(self) -> bool: ... - def readinto(self, b: WriteableBuffer, /) -> int: ... - def close(self) -> None: ... - -class BlobIO(io.BufferedReader, AbstractContextManager[_BlobIO]): # type: ignore[misc] - def __init__(self, blob: Blob, as_path: str | None = None, flags: BlobFilter = ..., commit_id: Oid | None = None) -> None: ... - def __exit__( - self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: types.TracebackType | None - ) -> None: ... diff --git a/stubs/pygit2/pygit2/branches.pyi b/stubs/pygit2/pygit2/branches.pyi deleted file mode 100644 index 9aca921b0..000000000 --- a/stubs/pygit2/pygit2/branches.pyi +++ /dev/null @@ -1,17 +0,0 @@ -from collections.abc import Iterator - -from ._pygit2 import Branch, Commit, Oid -from .enums import BranchType -from .repository import BaseRepository - -class Branches: - local: Branches - remote: Branches - def __init__(self, repository: BaseRepository, flag: BranchType = ..., commit: Commit | Oid | None = None) -> None: ... - def __getitem__(self, name: str) -> Branch: ... - def get(self, key: str) -> Branch | None: ... - def __iter__(self) -> Iterator[str]: ... - def create(self, name: str, commit: Commit, force: bool = False) -> Branch: ... - def delete(self, name: str) -> None: ... - def with_commit(self, commit: Commit | Oid | None) -> Branches: ... - def __contains__(self, name: str) -> bool: ... diff --git a/stubs/pygit2/pygit2/callbacks.pyi b/stubs/pygit2/pygit2/callbacks.pyi deleted file mode 100644 index a42540a70..000000000 --- a/stubs/pygit2/pygit2/callbacks.pyi +++ /dev/null @@ -1,78 +0,0 @@ -from _typeshed import StrOrBytesPath -from collections.abc import Callable -from contextlib import AbstractContextManager -from typing import Protocol -from typing_extensions import ParamSpec, Self, TypeAlias - -from _cffi_backend import _CDataBase - -from ._pygit2 import DiffFile, Oid -from .enums import CheckoutNotify, CheckoutStrategy, CredentialType, StashApplyProgress -from .remotes import TransferProgress -from .utils import _IntoStrArray - -class Payload: - def __init__(self, **kw: object) -> None: ... - def check_error(self, error_code: int) -> None: ... - -# Upstream is not yet defining a concrete type for certificates, and no usage example is -# available either. -_Certificate: TypeAlias = None - -class _Credentials(Protocol): - @property - def credential_type(self) -> CredentialType: ... - @property - def credential_tuple(self) -> tuple[str, ...]: ... - def __call__(self, _url: str, _username: str | None, _allowed: CredentialType) -> Self: ... - -class RemoteCallbacks(Payload): - # Upstream code is broken: the credentials() method is shadowed if the constructor - # gets passed a non-None "credentials". - # credentials: _Credentials | None - certificate: _Certificate | None - def __init__(self, credentials: _Credentials | None = None, certificate: _Certificate | None = None) -> None: ... - def sideband_progress(self, string: str) -> None: ... - def credentials(self, url: str, username_from_url: str | None, allowed_types: CredentialType) -> _Credentials: ... - def certificate_check(self, certificate: _Certificate, valid: bool, host: str) -> bool: ... - def transfer_progress(self, stats: TransferProgress) -> None: ... - def update_tips(self, refname: str, old: Oid, new: Oid) -> None: ... - def push_update_reference(self, refname: str, message: str) -> None: ... - -class CheckoutCallbacks(Payload): - def __init__(self) -> None: ... - def checkout_notify_flags(self) -> CheckoutNotify: ... - def checkout_notify( - self, why: CheckoutNotify, path: str, baseline: DiffFile | None, target: DiffFile | None, workdir: DiffFile | None - ) -> None: ... - def checkout_progress(self, path: str, completed_steps: int, total_steps: int) -> None: ... - -class StashApplyCallbacks(CheckoutCallbacks): - def stash_apply_progress(self, progress: StashApplyProgress) -> None: ... - -def git_clone_options(payload: Payload, opts: _CDataBase | None = None) -> AbstractContextManager[Payload]: ... -def git_fetch_options(payload: Payload, opts: _CDataBase | None = None) -> AbstractContextManager[Payload]: ... -def git_push_options(payload: Payload, opts: _CDataBase | None = None) -> AbstractContextManager[Payload]: ... -def git_remote_callbacks(payload: Payload) -> AbstractContextManager[Payload]: ... - -_P = ParamSpec("_P") - -def libgit2_callback(f: Callable[_P, int]) -> Callable[_P, int]: ... -def libgit2_callback_void(f: Callable[_P, None]) -> Callable[_P, None]: ... - -_CredentialsFn: TypeAlias = Callable[[str | None, str | None, CredentialType], _Credentials] - -def get_credentials(fn: _CredentialsFn, url: _CDataBase, username: _CDataBase, allowed: CredentialType) -> _CDataBase: ... -def git_checkout_options( - callbacks: CheckoutCallbacks | None = None, - strategy: CheckoutStrategy | None = None, - directory: StrOrBytesPath | None = None, - paths: _IntoStrArray = None, -) -> AbstractContextManager[Payload]: ... -def git_stash_apply_options( - callbacks: StashApplyCallbacks | None = None, - reinstate_index: bool = False, - strategy: CheckoutStrategy | None = None, - directory: StrOrBytesPath | None = None, - paths: _IntoStrArray = None, -) -> AbstractContextManager[Payload]: ... diff --git a/stubs/pygit2/pygit2/config.pyi b/stubs/pygit2/pygit2/config.pyi deleted file mode 100644 index b1e515616..000000000 --- a/stubs/pygit2/pygit2/config.pyi +++ /dev/null @@ -1,59 +0,0 @@ -from _typeshed import StrOrBytesPath -from typing_extensions import Self - -from _cffi_backend import _CDataBase - -def str_to_bytes(value: str, name: object) -> bytes: ... - -class ConfigIterator: - def __init__(self, config: _CDataBase, ptr: _CDataBase) -> None: ... - def __del__(self) -> None: ... - def __iter__(self) -> Self: ... - def next(self) -> ConfigEntry: ... - def __next__(self) -> ConfigEntry: ... - -class ConfigMultivarIterator(ConfigIterator): - def __next__(self) -> str: ... # type: ignore[override] - -class Config: - def __init__(self, path: str | None = None) -> None: ... - @classmethod - def from_c(cls, repo: _CDataBase, ptr: _CDataBase) -> Config: ... - def __del__(self) -> None: ... - def __contains__(self, key: str) -> bool: ... - def __getitem__(self, key: str) -> str: ... - def __setitem__(self, key: str, value: bool | int | _CDataBase | StrOrBytesPath | None) -> None: ... - def __delitem__(self, key: str) -> None: ... - def __iter__(self) -> ConfigIterator: ... - def get_multivar(self, name: str, regex: str | None = None) -> ConfigMultivarIterator: ... - def set_multivar(self, name: str, regex: str, value: str) -> None: ... - def delete_multivar(self, name: str, regex: str) -> None: ... - def get_bool(self, key: str) -> bool: ... - def get_int(self, key: str) -> int: ... - def add_file(self, path: StrOrBytesPath, level: int = 0, force: int = 0) -> None: ... - def snapshot(self) -> Config: ... - @staticmethod - def parse_bool(text: _CDataBase | bytes | str | None) -> bool: ... - @staticmethod - def parse_int(text: _CDataBase | bytes | str | None) -> int: ... - @staticmethod - def get_system_config() -> Config: ... - @staticmethod - def get_global_config() -> Config: ... - @staticmethod - def get_xdg_config() -> Config: ... - -class ConfigEntry: - def __del__(self) -> None: ... - @property - def c_value(self) -> _CDataBase: ... - @property - def raw_name(self) -> bytes: ... - @property - def raw_value(self) -> bytes: ... - @property - def level(self) -> int: ... - @property - def name(self) -> str: ... - @property - def value(self) -> str: ... diff --git a/stubs/pygit2/pygit2/credentials.pyi b/stubs/pygit2/pygit2/credentials.pyi deleted file mode 100644 index 6e533735e..000000000 --- a/stubs/pygit2/pygit2/credentials.pyi +++ /dev/null @@ -1,34 +0,0 @@ -from typing_extensions import Self - -from .enums import CredentialType - -class Username: - def __init__(self, username: str) -> None: ... - @property - def credential_type(self) -> CredentialType: ... - @property - def credential_tuple(self) -> tuple[str]: ... - def __call__(self, _url: str, _username: str | None, _allowed: CredentialType) -> Self: ... - -class UserPass: - def __init__(self, username: str, password: str) -> None: ... - @property - def credential_type(self) -> CredentialType: ... - @property - def credential_tuple(self) -> tuple[str, str]: ... - def __call__(self, _url: str, _username: str | None, _allowed: CredentialType) -> Self: ... - -class Keypair: - def __init__(self, username: str, pubkey: str, privkey: str, passphrase: str) -> None: ... - @property - def credential_type(self) -> CredentialType: ... - @property - def credential_tuple(self) -> tuple[str, str, str, str]: ... - def __call__(self, _url: str, _username: str | None, _allowed: CredentialType) -> Self: ... - -class KeypairFromAgent(Keypair): - def __init__(self, username: str) -> None: ... - -class KeypairFromMemory(Keypair): - @property - def credential_type(self) -> CredentialType: ... diff --git a/stubs/pygit2/pygit2/enums.pyi b/stubs/pygit2/pygit2/enums.pyi deleted file mode 100644 index 140cb224e..000000000 --- a/stubs/pygit2/pygit2/enums.pyi +++ /dev/null @@ -1,394 +0,0 @@ -from enum import IntEnum, IntFlag - -class ApplyLocation(IntEnum): - WORKDIR = 0 - INDEX = 1 - BOTH = 2 - -class AttrCheck(IntFlag): - FILE_THEN_INDEX = 0x0 - INDEX_THEN_FILE = 0x1 - INDEX_ONLY = 0x2 - NO_SYSTEM = 0x4 - INCLUDE_HEAD = 0x8 - INCLUDE_COMMIT = 0x10 - -class BlameFlag(IntFlag): - NORMAL = 0x0 - TRACK_COPIES_SAME_FILE = 0x1 - TRACK_COPIES_SAME_COMMIT_MOVES = 0x2 - TRACK_COPIES_SAME_COMMIT_COPIES = 0x4 - TRACK_COPIES_ANY_COMMIT_COPIES = 0x8 - FIRST_PARENT = 0x10 - USE_MAILMAP = 0x20 - IGNORE_WHITESPACE = 0x40 - -class BlobFilter(IntFlag): - CHECK_FOR_BINARY = 0x1 - NO_SYSTEM_ATTRIBUTES = 0x2 - ATTRIBUTES_FROM_HEAD = 0x4 - ATTRIBUTES_FROM_COMMIT = 0x8 - -class BranchType(IntFlag): - LOCAL = 0x1 - REMOTE = 0x2 - ALL = 0x3 - -class CheckoutNotify(IntFlag): - NONE = 0x0 - CONFLICT = 0x1 - DIRTY = 0x2 - UPDATED = 0x4 - UNTRACKED = 0x8 - IGNORED = 0x10 - ALL = 0xFFFF - -class CheckoutStrategy(IntFlag): - NONE = 0x0 - SAFE = 0x1 - FORCE = 0x2 - RECREATE_MISSING = 0x4 - ALLOW_CONFLICTS = 0x10 - REMOVE_UNTRACKED = 0x20 - REMOVE_IGNORED = 0x40 - UPDATE_ONLY = 0x80 - DONT_UPDATE_INDEX = 0x100 - NO_REFRESH = 0x200 - SKIP_UNMERGED = 0x400 - USE_OURS = 0x800 - USE_THEIRS = 0x1000 - DISABLE_PATHSPEC_MATCH = 0x2000 - SKIP_LOCKED_DIRECTORIES = 0x40000 - DONT_OVERWRITE_IGNORED = 0x80000 - CONFLICT_STYLE_MERGE = 0x100000 - CONFLICT_STYLE_DIFF3 = 0x200000 - DONT_REMOVE_EXISTING = 0x400000 - DONT_WRITE_INDEX = 0x800000 - DRY_RUN = 0x1000000 - CONFLICT_STYLE_ZDIFF3 = 0x200000 - -class ConfigLevel(IntEnum): - PROGRAMDATA = 1 - SYSTEM = 2 - XDG = 3 - GLOBAL = 4 - LOCAL = 5 - WORKTREE = 6 - APP = 7 - HIGHEST_LEVEL = -1 - -class CredentialType(IntFlag): - USERPASS_PLAINTEXT = 0x1 - SSH_KEY = 0x2 - SSH_CUSTOM = 0x4 - DEFAULT = 0x8 - SSH_INTERACTIVE = 0x10 - USERNAME = 0x20 - SSH_MEMORY = 0x40 - -class DeltaStatus(IntEnum): - UNMODIFIED = 0 - ADDED = 1 - DELETED = 2 - MODIFIED = 3 - RENAMED = 4 - COPIED = 5 - IGNORED = 6 - UNTRACKED = 7 - TYPECHANGE = 8 - UNREADABLE = 9 - CONFLICTED = 10 - -class DescribeStrategy(IntEnum): - DEFAULT = 0 - TAGS = 1 - ALL = 2 - -class DiffFind(IntFlag): - FIND_BY_CONFIG = 0x0 - FIND_RENAMES = 0x1 - FIND_RENAMES_FROM_REWRITES = 0x2 - FIND_COPIES = 0x4 - FIND_COPIES_FROM_UNMODIFIED = 0x8 - FIND_REWRITES = 0x10 - BREAK_REWRITES = 0x20 - FIND_AND_BREAK_REWRITES = 0x30 - FIND_FOR_UNTRACKED = 0x40 - FIND_ALL = 0xFF - FIND_IGNORE_LEADING_WHITESPACE = 0x0 - FIND_IGNORE_WHITESPACE = 0x1000 - FIND_DONT_IGNORE_WHITESPACE = 0x2000 - FIND_EXACT_MATCH_ONLY = 0x4000 - BREAK_REWRITES_FOR_RENAMES_ONLY = 0x8000 - FIND_REMOVE_UNMODIFIED = 0x10000 - -class DiffFlag(IntFlag): - BINARY = 0x1 - NOT_BINARY = 0x2 - VALID_ID = 0x4 - EXISTS = 0x8 - VALID_SIZE = 0x10 - -class DiffOption(IntFlag): - NORMAL = 0x0 - REVERSE = 0x1 - INCLUDE_IGNORED = 0x2 - RECURSE_IGNORED_DIRS = 0x4 - INCLUDE_UNTRACKED = 0x8 - RECURSE_UNTRACKED_DIRS = 0x10 - INCLUDE_UNMODIFIED = 0x20 - INCLUDE_TYPECHANGE = 0x40 - INCLUDE_TYPECHANGE_TREES = 0x80 - IGNORE_FILEMODE = 0x100 - IGNORE_SUBMODULES = 0x200 - IGNORE_CASE = 0x400 - INCLUDE_CASECHANGE = 0x800 - DISABLE_PATHSPEC_MATCH = 0x1000 - SKIP_BINARY_CHECK = 0x2000 - ENABLE_FAST_UNTRACKED_DIRS = 0x4000 - UPDATE_INDEX = 0x8000 - INCLUDE_UNREADABLE = 0x10000 - INCLUDE_UNREADABLE_AS_UNTRACKED = 0x20000 - INDENT_HEURISTIC = 0x40000 - IGNORE_BLANK_LINES = 0x80000 - FORCE_TEXT = 0x100000 - FORCE_BINARY = 0x200000 - IGNORE_WHITESPACE = 0x400000 - IGNORE_WHITESPACE_CHANGE = 0x800000 - IGNORE_WHITESPACE_EOL = 0x1000000 - SHOW_UNTRACKED_CONTENT = 0x2000000 - SHOW_UNMODIFIED = 0x4000000 - PATIENCE = 0x10000000 - MINIMAL = 0x20000000 - SHOW_BINARY = 0x40000000 - -class DiffStatsFormat(IntFlag): - NONE = 0x0 - FULL = 0x1 - SHORT = 0x2 - NUMBER = 0x4 - INCLUDE_SUMMARY = 0x8 - -class Feature(IntFlag): - THREADS = 0x1 - HTTPS = 0x2 - SSH = 0x4 - NSEC = 0x8 - -class FetchPrune(IntEnum): - UNSPECIFIED = 0 - PRUNE = 1 - NO_PRUNE = 2 - -class FileMode(IntFlag): - UNREADABLE = 0x0 - TREE = 0x4000 - BLOB = 0x81A4 - BLOB_EXECUTABLE = 0x81ED - LINK = 0xA000 - COMMIT = 0xE000 - -class FileStatus(IntFlag): - CURRENT = 0x0 - INDEX_NEW = 0x1 - INDEX_MODIFIED = 0x2 - INDEX_DELETED = 0x4 - INDEX_RENAMED = 0x8 - INDEX_TYPECHANGE = 0x10 - WT_NEW = 0x80 - WT_MODIFIED = 0x100 - WT_DELETED = 0x200 - WT_TYPECHANGE = 0x400 - WT_RENAMED = 0x800 - WT_UNREADABLE = 0x1000 - IGNORED = 0x4000 - CONFLICTED = 0x8000 - -class FilterFlag(IntFlag): - DEFAULT = 0x0 - ALLOW_UNSAFE = 0x1 - NO_SYSTEM_ATTRIBUTES = 0x2 - ATTRIBUTES_FROM_HEAD = 0x4 - ATTRIBUTES_FROM_COMMIT = 0x8 - -class FilterMode(IntEnum): - TO_WORKTREE = 0 - SMUDGE = 0 - TO_ODB = 1 - CLEAN = 1 - -class MergeAnalysis(IntFlag): - NONE = 0x0 - NORMAL = 0x1 - UP_TO_DATE = 0x2 - FASTFORWARD = 0x4 - UNBORN = 0x8 - -class MergeFavor(IntEnum): - NORMAL = 0 - OURS = 1 - THEIRS = 2 - UNION = 3 - -class MergeFileFlag(IntFlag): - DEFAULT = 0x0 - STYLE_MERGE = 0x1 - STYLE_DIFF3 = 0x2 - SIMPLIFY_ALNUM = 0x4 - IGNORE_WHITESPACE = 0x8 - IGNORE_WHITESPACE_CHANGE = 0x10 - IGNORE_WHITESPACE_EOL = 0x20 - DIFF_PATIENCE = 0x40 - DIFF_MINIMAL = 0x80 - STYLE_ZDIFF3 = 0x100 - ACCEPT_CONFLICTS = 0x200 - -class MergeFlag(IntFlag): - FIND_RENAMES = 0x1 - FAIL_ON_CONFLICT = 0x2 - SKIP_REUC = 0x4 - NO_RECURSIVE = 0x8 - VIRTUAL_BASE = 0x10 - -class MergePreference(IntFlag): - NONE = 0x0 - NO_FASTFORWARD = 0x1 - FASTFORWARD_ONLY = 0x2 - -class ObjectType(IntEnum): - ANY = -2 - INVALID = -1 - COMMIT = 1 - TREE = 2 - BLOB = 3 - TAG = 4 - OFS_DELTA = 6 - REF_DELTA = 7 - -class Option(IntEnum): - GET_MWINDOW_SIZE = 0 - SET_MWINDOW_SIZE = 1 - GET_MWINDOW_MAPPED_LIMIT = 2 - SET_MWINDOW_MAPPED_LIMIT = 3 - GET_SEARCH_PATH = 4 - SET_SEARCH_PATH = 5 - SET_CACHE_OBJECT_LIMIT = 6 - SET_CACHE_MAX_SIZE = 7 - ENABLE_CACHING = 8 - GET_CACHED_MEMORY = 9 - GET_TEMPLATE_PATH = 10 - SET_TEMPLATE_PATH = 11 - SET_SSL_CERT_LOCATIONS = 12 - SET_USER_AGENT = 13 - ENABLE_STRICT_OBJECT_CREATION = 14 - ENABLE_STRICT_SYMBOLIC_REF_CREATION = 15 - SET_SSL_CIPHERS = 16 - GET_USER_AGENT = 17 - ENABLE_OFS_DELTA = 18 - ENABLE_FSYNC_GITDIR = 19 - GET_WINDOWS_SHAREMODE = 20 - SET_WINDOWS_SHAREMODE = 21 - ENABLE_STRICT_HASH_VERIFICATION = 22 - SET_ALLOCATOR = 23 - ENABLE_UNSAVED_INDEX_SAFETY = 24 - GET_PACK_MAX_OBJECTS = 25 - SET_PACK_MAX_OBJECTS = 26 - DISABLE_PACK_KEEP_FILE_CHECKS = 27 - GET_OWNER_VALIDATION = 35 - SET_OWNER_VALIDATION = 36 - -class ReferenceFilter(IntEnum): - ALL = 0 - BRANCHES = 1 - TAGS = 2 - -class ReferenceType(IntFlag): - INVALID = 0x0 - DIRECT = 0x1 - SYMBOLIC = 0x2 - ALL = 0x3 - -class RepositoryInitFlag(IntFlag): - BARE = 0x1 - NO_REINIT = 0x2 - NO_DOTGIT_DIR = 0x4 - MKDIR = 0x8 - MKPATH = 0x10 - EXTERNAL_TEMPLATE = 0x20 - RELATIVE_GITLINK = 0x40 - -class RepositoryInitMode(IntEnum): - SHARED_UMASK = 0 - SHARED_GROUP = 1533 - SHARED_ALL = 1535 - -class RepositoryOpenFlag(IntFlag): - DEFAULT = 0x0 - NO_SEARCH = 0x1 - CROSS_FS = 0x2 - BARE = 0x4 - NO_DOTGIT = 0x8 - FROM_ENV = 0x10 - -class RepositoryState(IntEnum): - NONE = 0 - MERGE = 1 - REVERT = 2 - REVERT_SEQUENCE = 3 - CHERRYPICK = 4 - CHERRYPICK_SEQUENCE = 5 - BISECT = 6 - REBASE = 7 - REBASE_INTERACTIVE = 8 - REBASE_MERGE = 9 - APPLY_MAILBOX = 10 - APPLY_MAILBOX_OR_REBASE = 11 - -class ResetMode(IntEnum): - SOFT = 1 - MIXED = 2 - HARD = 3 - -class RevSpecFlag(IntFlag): - SINGLE = 0x1 - RANGE = 0x2 - MERGE_BASE = 0x4 - -class SortMode(IntFlag): - NONE = 0x0 - TOPOLOGICAL = 0x1 - TIME = 0x2 - REVERSE = 0x4 - -class StashApplyProgress(IntEnum): - NONE = 0 - LOADING_STASH = 1 - ANALYZE_INDEX = 2 - ANALYZE_MODIFIED = 3 - ANALYZE_UNTRACKED = 4 - CHECKOUT_UNTRACKED = 5 - CHECKOUT_MODIFIED = 6 - DONE = 7 - -class SubmoduleIgnore(IntEnum): - UNSPECIFIED = -1 - NONE = 1 - UNTRACKED = 2 - DIRTY = 3 - ALL = 4 - -class SubmoduleStatus(IntFlag): - IN_HEAD = 0x1 - IN_INDEX = 0x2 - IN_CONFIG = 0x4 - IN_WD = 0x8 - INDEX_ADDED = 0x10 - INDEX_DELETED = 0x20 - INDEX_MODIFIED = 0x40 - WD_UNINITIALIZED = 0x80 - WD_ADDED = 0x100 - WD_DELETED = 0x200 - WD_MODIFIED = 0x400 - WD_INDEX_MODIFIED = 0x800 - WD_WD_MODIFIED = 0x1000 - WD_UNTRACKED = 0x2000 diff --git a/stubs/pygit2/pygit2/errors.pyi b/stubs/pygit2/pygit2/errors.pyi deleted file mode 100644 index eacc9daa2..000000000 --- a/stubs/pygit2/pygit2/errors.pyi +++ /dev/null @@ -1,6 +0,0 @@ -value_errors: set[int] - -def check_error(err: int, io: bool = False) -> None: ... - -class Passthrough(Exception): - def __init__(self) -> None: ... diff --git a/stubs/pygit2/pygit2/ffi.pyi b/stubs/pygit2/pygit2/ffi.pyi deleted file mode 100644 index e77356e2d..000000000 --- a/stubs/pygit2/pygit2/ffi.pyi +++ /dev/null @@ -1 +0,0 @@ -from ._libgit2 import ffi as ffi diff --git a/stubs/pygit2/pygit2/filter.pyi b/stubs/pygit2/pygit2/filter.pyi deleted file mode 100644 index 0f62b5ffd..000000000 --- a/stubs/pygit2/pygit2/filter.pyi +++ /dev/null @@ -1,11 +0,0 @@ -from collections.abc import Callable - -from ._pygit2 import FilterSource - -class Filter: - attributes: str - @classmethod - def nattrs(cls) -> int: ... - def check(self, src: FilterSource, attr_values: list[str | None]) -> None: ... - def write(self, data: bytes, src: FilterSource, write_next: Callable[[bytes], None]) -> None: ... - def close(self, write_next: Callable[[bytes], None]) -> None: ... diff --git a/stubs/pygit2/pygit2/index.pyi b/stubs/pygit2/pygit2/index.pyi deleted file mode 100644 index c241ea3d8..000000000 --- a/stubs/pygit2/pygit2/index.pyi +++ /dev/null @@ -1,59 +0,0 @@ -from _typeshed import StrOrBytesPath, StrPath -from collections.abc import Iterator -from typing_extensions import Self, deprecated - -from _cffi_backend import _CDataBase - -from ._pygit2 import Diff, Oid, Tree -from .enums import DiffOption, FileMode -from .repository import BaseRepository -from .utils import _IntoStrArray - -class Index: - def __init__(self, path: StrOrBytesPath | None = None) -> None: ... - @classmethod - def from_c(cls, repo: _CDataBase, ptr: _CDataBase) -> Index: ... - def __del__(self) -> None: ... - def __len__(self) -> int: ... - def __contains__(self, path: StrOrBytesPath | None) -> bool: ... - def __getitem__(self, key: StrPath | int) -> IndexEntry: ... - def __iter__(self) -> Iterator[IndexEntry]: ... - def read(self, force: bool = True) -> None: ... - def write(self) -> None: ... - def clear(self) -> None: ... - def read_tree(self, tree: str | Oid | Tree) -> None: ... - def write_tree(self, repo: BaseRepository | None = None) -> Oid: ... - def remove(self, path: StrOrBytesPath, level: int = 0) -> None: ... - def remove_all(self, pathspecs: _IntoStrArray) -> None: ... - def add_all(self, pathspecs: _IntoStrArray = None) -> None: ... - def add(self, path_or_entry: IndexEntry | StrPath) -> None: ... - def diff_to_workdir(self, flags: DiffOption = ..., context_lines: int = 3, interhunk_lines: int = 0) -> Diff: ... - def diff_to_tree(self, tree: Tree, flags: DiffOption = ..., context_lines: int = 3, interhunk_lines: int = 0) -> Diff: ... - @property - def conflicts(self) -> ConflictCollection | None: ... - -class IndexEntry: - path: str - id: Oid - mode: FileMode - def __init__(self, path: str, object_id: Oid, mode: FileMode) -> None: ... - @property - def oid(self) -> Oid: ... - @property - @deprecated("Use str(entry.id)") - def hex(self) -> str: ... - def __eq__(self, other: object) -> bool: ... - -class ConflictCollection: - def __init__(self, index: Index) -> None: ... - def __getitem__(self, path: StrOrBytesPath) -> tuple[IndexEntry, IndexEntry, IndexEntry]: ... - def __delitem__(self, path: StrOrBytesPath) -> None: ... - def __iter__(self) -> ConflictIterator: ... - def __contains__(self, path: StrOrBytesPath) -> bool: ... - -class ConflictIterator: - def __init__(self, index: Index) -> None: ... - def __del__(self) -> None: ... - def next(self) -> tuple[IndexEntry, IndexEntry, IndexEntry]: ... - def __next__(self) -> tuple[IndexEntry, IndexEntry, IndexEntry]: ... - def __iter__(self) -> Self: ... diff --git a/stubs/pygit2/pygit2/legacyenums.pyi b/stubs/pygit2/pygit2/legacyenums.pyi deleted file mode 100644 index 3359eea83..000000000 --- a/stubs/pygit2/pygit2/legacyenums.pyi +++ /dev/null @@ -1,62 +0,0 @@ -GIT_FEATURE_THREADS: int -GIT_FEATURE_HTTPS: int -GIT_FEATURE_SSH: int -GIT_FEATURE_NSEC: int -GIT_REPOSITORY_INIT_BARE: int -GIT_REPOSITORY_INIT_NO_REINIT: int -GIT_REPOSITORY_INIT_NO_DOTGIT_DIR: int -GIT_REPOSITORY_INIT_MKDIR: int -GIT_REPOSITORY_INIT_MKPATH: int -GIT_REPOSITORY_INIT_EXTERNAL_TEMPLATE: int -GIT_REPOSITORY_INIT_RELATIVE_GITLINK: int -GIT_REPOSITORY_INIT_SHARED_UMASK: int -GIT_REPOSITORY_INIT_SHARED_GROUP: int -GIT_REPOSITORY_INIT_SHARED_ALL: int -GIT_REPOSITORY_OPEN_NO_SEARCH: int -GIT_REPOSITORY_OPEN_CROSS_FS: int -GIT_REPOSITORY_OPEN_BARE: int -GIT_REPOSITORY_OPEN_NO_DOTGIT: int -GIT_REPOSITORY_OPEN_FROM_ENV: int -GIT_REPOSITORY_STATE_NONE: int -GIT_REPOSITORY_STATE_MERGE: int -GIT_REPOSITORY_STATE_REVERT: int -GIT_REPOSITORY_STATE_REVERT_SEQUENCE: int -GIT_REPOSITORY_STATE_CHERRYPICK: int -GIT_REPOSITORY_STATE_CHERRYPICK_SEQUENCE: int -GIT_REPOSITORY_STATE_BISECT: int -GIT_REPOSITORY_STATE_REBASE: int -GIT_REPOSITORY_STATE_REBASE_INTERACTIVE: int -GIT_REPOSITORY_STATE_REBASE_MERGE: int -GIT_REPOSITORY_STATE_APPLY_MAILBOX: int -GIT_REPOSITORY_STATE_APPLY_MAILBOX_OR_REBASE: int -GIT_ATTR_CHECK_FILE_THEN_INDEX: int -GIT_ATTR_CHECK_INDEX_THEN_FILE: int -GIT_ATTR_CHECK_INDEX_ONLY: int -GIT_ATTR_CHECK_NO_SYSTEM: int -GIT_ATTR_CHECK_INCLUDE_HEAD: int -GIT_ATTR_CHECK_INCLUDE_COMMIT: int -GIT_FETCH_PRUNE_UNSPECIFIED: int -GIT_FETCH_PRUNE: int -GIT_FETCH_NO_PRUNE: int -GIT_CHECKOUT_NOTIFY_NONE: int -GIT_CHECKOUT_NOTIFY_CONFLICT: int -GIT_CHECKOUT_NOTIFY_DIRTY: int -GIT_CHECKOUT_NOTIFY_UPDATED: int -GIT_CHECKOUT_NOTIFY_UNTRACKED: int -GIT_CHECKOUT_NOTIFY_IGNORED: int -GIT_CHECKOUT_NOTIFY_ALL: int -GIT_STASH_APPLY_PROGRESS_NONE: int -GIT_STASH_APPLY_PROGRESS_LOADING_STASH: int -GIT_STASH_APPLY_PROGRESS_ANALYZE_INDEX: int -GIT_STASH_APPLY_PROGRESS_ANALYZE_MODIFIED: int -GIT_STASH_APPLY_PROGRESS_ANALYZE_UNTRACKED: int -GIT_STASH_APPLY_PROGRESS_CHECKOUT_UNTRACKED: int -GIT_STASH_APPLY_PROGRESS_CHECKOUT_MODIFIED: int -GIT_STASH_APPLY_PROGRESS_DONE: int -GIT_CREDENTIAL_USERPASS_PLAINTEXT: int -GIT_CREDENTIAL_SSH_KEY: int -GIT_CREDENTIAL_SSH_CUSTOM: int -GIT_CREDENTIAL_DEFAULT: int -GIT_CREDENTIAL_SSH_INTERACTIVE: int -GIT_CREDENTIAL_USERNAME: int -GIT_CREDENTIAL_SSH_MEMORY: int diff --git a/stubs/pygit2/pygit2/packbuilder.pyi b/stubs/pygit2/pygit2/packbuilder.pyi deleted file mode 100644 index 5deec0289..000000000 --- a/stubs/pygit2/pygit2/packbuilder.pyi +++ /dev/null @@ -1,15 +0,0 @@ -from _typeshed import StrOrBytesPath - -from ._pygit2 import Oid -from .repository import BaseRepository - -class PackBuilder: - def __init__(self, repo: BaseRepository) -> None: ... - def __del__(self) -> None: ... - def __len__(self) -> int: ... - def add(self, oid: Oid) -> None: ... - def add_recur(self, oid: Oid) -> None: ... - def set_threads(self, n_threads: int) -> int: ... - def write(self, path: StrOrBytesPath | None = None) -> None: ... - @property - def written_objects_count(self) -> int: ... diff --git a/stubs/pygit2/pygit2/references.pyi b/stubs/pygit2/pygit2/references.pyi deleted file mode 100644 index 4e8a51d8e..000000000 --- a/stubs/pygit2/pygit2/references.pyi +++ /dev/null @@ -1,18 +0,0 @@ -from collections.abc import Iterator - -from ._pygit2 import Oid, Reference -from .enums import ReferenceFilter -from .repository import BaseRepository - -class References: - def __init__(self, repository: BaseRepository) -> None: ... - def __getitem__(self, name: str) -> Reference: ... - def get(self, key: str) -> Reference | None: ... - def __iter__(self) -> Iterator[Reference]: ... - def iterator(self, references_return_type: ReferenceFilter = ...) -> Iterator[Reference]: ... - def create(self, name: str, target: Oid | str, force: bool = False) -> Reference: ... - def delete(self, name: str) -> None: ... - def __contains__(self, name: str) -> bool: ... - @property - def objects(self) -> list[Reference]: ... - def compress(self) -> None: ... diff --git a/stubs/pygit2/pygit2/refspec.pyi b/stubs/pygit2/pygit2/refspec.pyi deleted file mode 100644 index 89a22a2e2..000000000 --- a/stubs/pygit2/pygit2/refspec.pyi +++ /dev/null @@ -1,18 +0,0 @@ -from _cffi_backend import _CDataBase - -class Refspec: - def __init__(self, owner: _CDataBase, ptr: _CDataBase) -> None: ... - @property - def src(self) -> str: ... - @property - def dst(self) -> str: ... - @property - def force(self) -> bool: ... - @property - def string(self) -> str: ... - @property - def direction(self) -> int: ... - def src_matches(self, ref: str) -> bool: ... - def dst_matches(self, ref: str) -> bool: ... - def transform(self, ref: str) -> str: ... - def rtransform(self, ref: str) -> str: ... diff --git a/stubs/pygit2/pygit2/remotes.pyi b/stubs/pygit2/pygit2/remotes.pyi deleted file mode 100644 index 9f086fefc..000000000 --- a/stubs/pygit2/pygit2/remotes.pyi +++ /dev/null @@ -1,84 +0,0 @@ -from collections.abc import Iterator -from typing import Literal, TypedDict -from typing_extensions import TypeAlias - -from _cffi_backend import _CDataBase - -from ._pygit2 import Oid -from .callbacks import RemoteCallbacks -from .enums import FetchPrune -from .refspec import Refspec -from .repository import BaseRepository -from .utils import _IntoStrArray - -class TransferProgress: - total_objects: int - indexed_objects: int - received_objects: int - local_objects: int - total_deltas: int - indexed_deltas: int - received_bytes: int - def __init__(self, tp: _CDataBase) -> None: ... - -_ProxySpec: TypeAlias = Literal[True] | str | None - -class _LsRemotesResultEntry(TypedDict): - local: bool - loid: Oid | None - name: str | None - symref_target: str | None - oid: Oid - -class Remote: - def __init__(self, repo: BaseRepository, ptr: _CDataBase) -> None: ... - def __del__(self) -> None: ... - @property - def name(self) -> str | None: ... - @property - def url(self) -> str | None: ... - @property - def push_url(self) -> str | None: ... - def connect(self, callbacks: RemoteCallbacks | None = None, direction: int = 0, proxy: _ProxySpec = None) -> None: ... - def fetch( - self, - refspecs: _IntoStrArray = None, - message: bytes | str | None = None, - callbacks: RemoteCallbacks | None = None, - prune: FetchPrune = ..., - proxy: _ProxySpec = None, - depth: int = 0, - ) -> TransferProgress: ... - def ls_remotes(self, callbacks: RemoteCallbacks | None = None, proxy: _ProxySpec = None) -> list[_LsRemotesResultEntry]: ... - def prune(self, callbacks: RemoteCallbacks | None = None) -> None: ... - @property - def refspec_count(self) -> int: ... - def get_refspec(self, n: int) -> Refspec: ... - @property - def fetch_refspecs(self) -> list[str]: ... - @property - def push_refspecs(self) -> list[str]: ... - def push( - self, - specs: _IntoStrArray, - callbacks: RemoteCallbacks | None = None, - proxy: _ProxySpec = None, - push_options: _IntoStrArray | None = None, - ) -> None: ... - -_RemoteName: TypeAlias = bytes | str - -class RemoteCollection: - def __init__(self, repo: BaseRepository) -> None: ... - def __len__(self) -> int: ... - def __iter__(self) -> Iterator[Remote]: ... - def __getitem__(self, name: int | _RemoteName) -> Remote: ... - def names(self) -> Iterator[str | None]: ... - def create(self, name: _RemoteName, url: bytes | str, fetch: bytes | str | None = None) -> Remote: ... - def create_anonymous(self, url: bytes | str) -> Remote: ... - def rename(self, name: _RemoteName, new_name: bytes | str) -> list[str]: ... - def delete(self, name: _RemoteName) -> None: ... - def set_url(self, name: _RemoteName, url: bytes | str) -> None: ... - def set_push_url(self, name: _RemoteName, url: bytes | str) -> None: ... - def add_fetch(self, name: _RemoteName, refspec: bytes | str) -> None: ... - def add_push(self, name: _RemoteName, refspec: bytes | str) -> None: ... diff --git a/stubs/pygit2/pygit2/repository.pyi b/stubs/pygit2/pygit2/repository.pyi deleted file mode 100644 index 221b96b66..000000000 --- a/stubs/pygit2/pygit2/repository.pyi +++ /dev/null @@ -1,211 +0,0 @@ -from _typeshed import StrOrBytesPath -from collections.abc import Callable, Iterator -from tarfile import TarInfo -from typing import IO, Any, Protocol -from typing_extensions import TypeAlias - -from ._pygit2 import Blob, Commit, Diff, Object, Oid, Reference, Repository as _Repository, Signature, Tree, _OidArg -from .blame import Blame -from .branches import Branches -from .callbacks import CheckoutCallbacks, StashApplyCallbacks -from .config import Config -from .enums import ( - AttrCheck, - BlameFlag, - BranchType as BranchType, - CheckoutStrategy, - DescribeStrategy, - DiffOption, - MergeFavor, - MergeFileFlag, - MergeFlag, - RepositoryOpenFlag, - RepositoryState, -) -from .index import Index, IndexEntry -from .packbuilder import PackBuilder -from .references import References -from .remotes import RemoteCollection -from .submodules import SubmoduleCollection -from .utils import _IntoStrArray - -_PackDelegate: TypeAlias = Callable[[PackBuilder], None] - -class _SupportsAddfile(Protocol): - def addfile(self, tarinfo: TarInfo, fileobj: IO[bytes] | None = None) -> None: ... - -class BaseRepository(_Repository): - branches: Branches - references: References - remotes: RemoteCollection - submodules: SubmoduleCollection - - def __init__(self, *args: Any, **kwargs: Any) -> None: ... # not meant for direct use - def read(self, oid: _OidArg) -> tuple[int, int, bytes]: ... - def write(self, type: int, data: bytes) -> Oid: ... - def pack( - self, path: StrOrBytesPath | None = None, pack_delegate: _PackDelegate | None = None, n_threads: int | None = None - ) -> int: ... - def __iter__(self) -> Iterator[Oid]: ... - def get(self, key: _OidArg, default: Object | None = None) -> Object | None: ... - def __getitem__(self, key: _OidArg) -> Object: ... - def __contains__(self, key: _OidArg) -> bool: ... - @property - def config(self) -> Config: ... - @property - def config_snapshot(self) -> Config: ... - def create_reference(self, name: str, target: _OidArg, force: bool = False, message: str | None = None) -> Reference: ... - def listall_references(self) -> list[str]: ... - def listall_reference_objects(self) -> list[Reference]: ... - def resolve_refish(self, refish: str) -> tuple[Commit, Reference]: ... - def checkout_head( - self, - *, - callbacks: CheckoutCallbacks | None = None, - strategy: CheckoutStrategy | None = None, - directory: str | None = None, - paths: _IntoStrArray = None, - ) -> None: ... - def checkout_index( - self, - index: Index | None = None, - *, - callbacks: CheckoutCallbacks | None = None, - strategy: CheckoutStrategy | None = None, - directory: str | None = None, - paths: _IntoStrArray = None, - ) -> None: ... - def checkout_tree( - self, - treeish: Object, - *, - callbacks: CheckoutCallbacks | None = None, - strategy: CheckoutStrategy | None = None, - directory: str | None = None, - paths: _IntoStrArray = None, - ) -> None: ... - def checkout( - self, - refname: str | Reference | None = None, - *, - callbacks: CheckoutCallbacks | None = None, - strategy: CheckoutStrategy | None = None, - directory: str | None = None, - paths: _IntoStrArray = None, - ) -> None: ... - def set_head(self, target: _OidArg) -> None: ... - def diff( - self, - a: bytes | str | Oid | Blob | Tree | None = None, - b: bytes | str | Oid | Blob | Tree | None = None, - cached: bool = False, - flags: DiffOption = ..., - context_lines: int = 3, - interhunk_lines: int = 0, - ) -> Diff: ... - def state(self) -> RepositoryState: ... - def state_cleanup(self) -> None: ... - def blame( - self, - path: StrOrBytesPath, - flags: BlameFlag = ..., - min_match_characters: int | None = None, - newest_commit: _OidArg | None = None, - oldest_commit: _OidArg | None = None, - min_line: int | None = None, - max_line: int | None = None, - ) -> Blame: ... - @property - def index(self) -> Index: ... - def merge_file_from_index(self, ancestor: IndexEntry | None, ours: IndexEntry | None, theirs: IndexEntry | None) -> str: ... - def merge_commits( - self, - ours: str | Oid | Commit, - theirs: str | Oid | Commit, - favor: MergeFavor = ..., - flags: MergeFlag = ..., - file_flags: MergeFileFlag = ..., - ) -> Index: ... - def merge_trees( - self, - ancestor: str | Oid | Tree, - ours: str | Oid | Tree, - theirs: str | Oid | Tree, - favor: MergeFavor = ..., - flags: MergeFlag = ..., - file_flags: MergeFileFlag = ..., - ) -> Index: ... - def merge(self, id: Oid | str, favor: MergeFavor = ..., flags: MergeFlag = ..., file_flags: MergeFileFlag = ...) -> None: ... - @property - def raw_message(self) -> bytes: ... - @property - def message(self) -> str: ... - def remove_message(self) -> None: ... - def describe( - self, - committish: str | Reference | Commit | None = None, - max_candidates_tags: int | None = None, - describe_strategy: DescribeStrategy = ..., - pattern: str | None = None, - only_follow_first_parent: bool | None = None, - show_commit_oid_as_fallback: bool | None = None, - abbreviated_size: int | None = None, - always_use_long_format: bool | None = None, - dirty_suffix: str | None = None, - ) -> str: ... - def stash( - self, - stasher: Signature, - message: str | None = None, - keep_index: bool = False, - include_untracked: bool = False, - include_ignored: bool = False, - keep_all: bool = False, - paths: list[str] | None = None, - ) -> Oid: ... - def stash_apply( - self, - index: int = 0, - *, - callbacks: StashApplyCallbacks | None = None, - reinstate_index: bool = False, - strategy: CheckoutStrategy | None = None, - directory: str | None = None, - paths: _IntoStrArray = None, - ) -> None: ... - def stash_drop(self, index: int = 0) -> None: ... - def stash_pop( - self, - index: int = 0, - *, - callbacks: StashApplyCallbacks | None = None, - reinstate_index: bool = False, - strategy: CheckoutStrategy | None = None, - directory: str | None = None, - paths: _IntoStrArray = None, - ) -> None: ... - def write_archive( - self, treeish: _OidArg | Tree, archive: _SupportsAddfile, timestamp: int | None = None, prefix: str = "" - ) -> None: ... - def ahead_behind(self, local: _OidArg, upstream: _OidArg) -> tuple[int, int]: ... - def get_attr( - self, path: StrOrBytesPath, name: str | bytes, flags: AttrCheck = ..., commit: Oid | str | None = None - ) -> bool | None | str: ... - @property - def ident(self) -> tuple[str, str]: ... - def set_ident(self, name: bytes | str | None, email: bytes | str | None) -> None: ... - def revert(self, commit: Commit) -> None: ... - def revert_commit(self, revert_commit: Commit, our_commit: Commit, mainline: int = 0) -> Index: ... - def amend_commit( - self, - commit: Commit | _OidArg, - refname: Reference | str | None, - author: Signature | None = None, - committer: Signature | None = None, - message: bytes | str | None = None, - tree: Tree | _OidArg | None = None, - encoding: str = "UTF-8", - ) -> Oid: ... - -class Repository(BaseRepository): - def __init__(self, path: str | None = None, flags: RepositoryOpenFlag = ...) -> None: ... diff --git a/stubs/pygit2/pygit2/settings.pyi b/stubs/pygit2/pygit2/settings.pyi deleted file mode 100644 index 3630c8198..000000000 --- a/stubs/pygit2/pygit2/settings.pyi +++ /dev/null @@ -1,37 +0,0 @@ -import pygit2.enums - -class SearchPathList: - def __getitem__(self, key: int) -> str: ... - def __setitem__(self, key: int, value: bytes | str) -> None: ... - -class Settings: - def __init__(self) -> None: ... - @property - def search_path(self) -> SearchPathList: ... - @property - def mwindow_size(self) -> int: ... - @mwindow_size.setter - def mwindow_size(self, value: int) -> None: ... - @property - def mwindow_mapped_limit(self) -> int: ... - @mwindow_mapped_limit.setter - def mwindow_mapped_limit(self, value: int) -> None: ... - @property - def cached_memory(self) -> tuple[int, int]: ... - def enable_caching(self, value: bool = True) -> None: ... - def disable_pack_keep_file_checks(self, value: bool = True) -> None: ... - def cache_max_size(self, value: int) -> None: ... - def cache_object_limit(self, object_type: pygit2.enums.ObjectType, value: int) -> None: ... - @property - def ssl_cert_file(self) -> bytes | str: ... - @ssl_cert_file.setter - def ssl_cert_file(self, value: bytes | str) -> None: ... - @ssl_cert_file.deleter - def ssl_cert_file(self) -> None: ... - @property - def ssl_cert_dir(self) -> bytes | str: ... - @ssl_cert_dir.setter - def ssl_cert_dir(self, value: bytes | str) -> None: ... - @ssl_cert_dir.deleter - def ssl_cert_dir(self) -> None: ... - def set_ssl_cert_locations(self, cert_file: bytes | str, cert_dir: bytes | str) -> None: ... diff --git a/stubs/pygit2/pygit2/submodules.pyi b/stubs/pygit2/pygit2/submodules.pyi deleted file mode 100644 index 4c3c8a245..000000000 --- a/stubs/pygit2/pygit2/submodules.pyi +++ /dev/null @@ -1,44 +0,0 @@ -from collections.abc import Iterable, Iterator - -from ._pygit2 import Oid -from .callbacks import RemoteCallbacks -from .enums import SubmoduleIgnore, SubmoduleStatus -from .repository import BaseRepository, Repository - -class Submodule: - def __del__(self) -> None: ... - def open(self) -> Repository: ... - def init(self, overwrite: bool = False) -> None: ... - def update(self, init: bool = False, callbacks: RemoteCallbacks | None = None, depth: int = 0) -> None: ... - def reload(self, force: bool = False) -> None: ... - @property - def name(self) -> str: ... - @property - def path(self) -> str: ... - @property - def url(self) -> str | None: ... - @property - def branch(self) -> str: ... - @property - def head_id(self) -> Oid | None: ... - -class SubmoduleCollection: - def __init__(self, repository: BaseRepository) -> None: ... - def __getitem__(self, name: str) -> Submodule: ... - def __contains__(self, name: str) -> bool: ... - def __iter__(self) -> Iterator[Submodule]: ... - def get(self, name: str) -> Submodule | None: ... - def add( - self, url: str, path: str, link: bool = True, callbacks: RemoteCallbacks | None = None, depth: int = 0 - ) -> Submodule: ... - def init(self, submodules: Iterable[str] | None = None, overwrite: bool = False) -> None: ... - def update( - self, - submodules: Iterable[str] | None = None, - init: bool = False, - callbacks: RemoteCallbacks | None = None, - depth: int = 0, - ) -> None: ... - def status(self, name: str, ignore: SubmoduleIgnore = ...) -> SubmoduleStatus: ... - def cache_all(self) -> None: ... - def cache_clear(self) -> None: ... diff --git a/stubs/pygit2/pygit2/utils.pyi b/stubs/pygit2/pygit2/utils.pyi deleted file mode 100644 index 22f4fe9aa..000000000 --- a/stubs/pygit2/pygit2/utils.pyi +++ /dev/null @@ -1,49 +0,0 @@ -import contextlib -import types -from _typeshed import StrOrBytesPath, StrPath -from collections.abc import Generator -from typing import Generic, TypeVar -from typing_extensions import TypeAlias - -from _cffi_backend import _CDataBase - -def maybe_string(ptr: _CDataBase) -> str | None: ... -def to_bytes(s: _CDataBase | StrOrBytesPath | None, encoding: str = "utf-8", errors: str = "strict") -> _CDataBase | bytes: ... -def to_str(s: StrOrBytesPath) -> str: ... -def ptr_to_bytes(ptr_cdata: _CDataBase) -> bytes: ... -@contextlib.contextmanager -def new_git_strarray() -> Generator[_GitStrArray]: ... -def strarray_to_strings(arr: _GitStrArray) -> list[str]: ... - -# Actual type: _cffi_backend.__CDataOwn -# This is not a real subclassing. Just ensuring type-checkers sees this type as compatible with _CDataBase -# pyright has no error code for subclassing final -class _GitStrArray(_CDataBase): # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] - count: int - strings: _CDataBase # - -_IntoStrArray: TypeAlias = list[StrPath] | tuple[StrPath] | None - -class StrArray: - def __init__(self, l: _IntoStrArray) -> None: ... - def __enter__(self) -> _CDataBase: ... - def __exit__( - self, type: type[BaseException] | None, value: BaseException | None, traceback: types.TracebackType | None - ) -> None: ... - @property - def ptr(self) -> _CDataBase | _GitStrArray: ... - def assign_to(self, git_strarray: _GitStrArray) -> None: ... - -_T = TypeVar("_T") - -class _GenericContainer(Generic[_T]): - def __len__(self) -> int: ... - def __getitem__(self, idx: int) -> _T: ... - -class GenericIterator(Generic[_T]): - container: _GenericContainer[_T] - length: int - idx: int - def __init__(self, container: _GenericContainer[_T]) -> None: ... - def next(self) -> _T: ... - def __next__(self) -> _T: ...