Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Start adding types to Submodule, add py.typed to manifest#1282

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Byron merged 12 commits intogitpython-developers:mainfromYobmod:main
Jul 1, 2021
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
Show all changes
12 commits
Select commitHold shift + click to select a range
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
1 change: 1 addition & 0 deletionsMANIFEST.in
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -6,6 +6,7 @@ include README.md
include VERSION
include requirements.txt
include test-requirements.txt
include git/py.typed

recursive-include doc *
recursive-exclude test *
Expand Down
4 changes: 2 additions & 2 deletionsgit/cmd.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -342,11 +342,11 @@ def polish_url(cls, url: str, is_cygwin: Literal[False] = ...) -> str:

@overload
@classmethod
def polish_url(cls, url:PathLike, is_cygwin: Union[None, bool] = None) -> str:
def polish_url(cls, url:str, is_cygwin: Union[None, bool] = None) -> str:
...

@classmethod
def polish_url(cls, url:PathLike, is_cygwin: Union[None, bool] = None) -> PathLike:
def polish_url(cls, url:str, is_cygwin: Union[None, bool] = None) -> PathLike:
if is_cygwin is None:
is_cygwin = cls.is_cygwin()

Expand Down
14 changes: 11 additions & 3 deletionsgit/config.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -29,8 +29,6 @@

import configparser as cp

from pathlib import Path

# typing-------------------------------------------------------

from typing import Any, Callable, IO, List, Dict, Sequence, TYPE_CHECKING, Tuple, Union, cast, overload
Expand DownExpand Up@@ -330,7 +328,7 @@ def _acquire_lock(self) -> None:
"Write-ConfigParsers can operate on a single file only, multiple files have been passed")
# END single file check

if isinstance(self._file_or_files, (str,Path)): # cannot narrow by os._pathlike until 3.5 dropped
if isinstance(self._file_or_files, (str,os.PathLike)):
file_or_files = self._file_or_files
else:
file_or_files = cast(IO, self._file_or_files).name
Expand DownExpand Up@@ -696,6 +694,16 @@ def read_only(self) -> bool:
""":return: True if this instance may change the configuration file"""
return self._read_only

@overload
def get_value(self, section: str, option: str, default: str
) -> str:
...

@overload
def get_value(self, section: str, option: str, default: float
) -> float:
...

def get_value(self, section: str, option: str, default: Union[int, float, str, bool, None] = None
) -> Union[int, float, str, bool]:
# can default or return type include bool?
Expand Down
10 changes: 6 additions & 4 deletionsgit/index/base.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -3,7 +3,7 @@
#
# This module is part of GitPython and is released under
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
from git.refs.reference import Reference

import glob
from io import BytesIO
import os
Expand DownExpand Up@@ -74,6 +74,8 @@
if TYPE_CHECKING:
from subprocess import Popen
from git.repo import Repo
from git.refs.reference import Reference
from git.util import Actor


StageType = int
Expand DownExpand Up@@ -966,8 +968,8 @@ def move(self, items: Sequence[Union[PathLike, Blob, BaseIndexEntry, Submodule]]

return out

def commit(self, message: str, parent_commits=None, head: bool = True, author:str = None,
committer:str = None, author_date: str = None, commit_date: str = None,
def commit(self, message: str, parent_commits=None, head: bool = True, author:Union[None, 'Actor'] = None,
committer:Union[None, 'Actor'] = None, author_date: str = None, commit_date: str = None,
skip_hooks: bool = False) -> Commit:
"""Commit the current default index file, creating a commit object.
For more information on the arguments, see tree.commit.
Expand DownExpand Up@@ -1191,7 +1193,7 @@ def handle_stderr(proc: 'Popen[bytes]', iter_checked_out_files: Iterable[PathLik
assert "Should not reach this point"

@default_index
def reset(self, commit: Union[Commit, Reference, str] = 'HEAD', working_tree: bool = False,
def reset(self, commit: Union[Commit,'Reference', str] = 'HEAD', working_tree: bool = False,
paths: Union[None, Iterable[PathLike]] = None,
head: bool = False, **kwargs: Any) -> 'IndexFile':
"""Reset the index to reflect the tree at the given commit. This will not
Expand Down
9 changes: 5 additions & 4 deletionsgit/objects/base.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -17,15 +17,16 @@

from typing import Any, TYPE_CHECKING, Optional, Union

from git.types import PathLike
from git.types import PathLike, Commit_ish

if TYPE_CHECKING:
from git.repo import Repo
from gitdb.base import OStream
from .tree import Tree
from .blob import Blob
from .tag import TagObject
from .commit import Commit
from .submodule.base import Submodule

IndexObjUnion = Union['Tree', 'Blob', 'Submodule']

# --------------------------------------------------------------------------

Expand DownExpand Up@@ -71,7 +72,7 @@ def new(cls, repo: 'Repo', id): # @ReservedAssignment
return repo.rev_parse(str(id))

@classmethod
def new_from_sha(cls, repo: 'Repo', sha1: bytes) ->Union['Commit', 'TagObject', 'Tree', 'Blob']:
def new_from_sha(cls, repo: 'Repo', sha1: bytes) ->Commit_ish:
"""
:return: new object instance of a type appropriate to represent the given
binary sha1
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp