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

Fix typing issues with delete_head and Remote.add#1346

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
Yobmod merged 1 commit intogitpython-developers:mainfromrra:type-fixes
Sep 24, 2021
Merged
Show file tree
Hide file tree
Changes fromall 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
2 changes: 1 addition & 1 deletiongit/refs/head.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -129,7 +129,7 @@ class Head(Reference):
k_config_remote_ref = "merge" # branch to merge from remote

@classmethod
def delete(cls, repo: 'Repo', *heads: 'Head', force: bool = False, **kwargs: Any) -> None:
def delete(cls, repo: 'Repo', *heads: 'Union[Head, str]', force: bool = False, **kwargs: Any) -> None:
"""Delete the given heads

:param force:
Expand Down
7 changes: 6 additions & 1 deletiongit/refs/remote.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -37,8 +37,13 @@ def iter_items(cls, repo: 'Repo', common_path: Union[PathLike, None] = None,
# super is Reference
return super(RemoteReference, cls).iter_items(repo, common_path)

# The Head implementation of delete also accepts strs, but this
# implementation does not. mypy doesn't have a way of representing
# tightening the types of arguments in subclasses and recommends Any or
# "type: ignore". (See https://github.com/python/typing/issues/241)
@ classmethod
def delete(cls, repo: 'Repo', *refs: 'RemoteReference', **kwargs: Any) -> None:
def delete(cls, repo: 'Repo', *refs: 'RemoteReference', # type: ignore
**kwargs: Any) -> None:
"""Delete the given remote references

:note:
Expand Down
4 changes: 3 additions & 1 deletiongit/remote.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -665,7 +665,9 @@ def create(cls, repo: 'Repo', name: str, url: str, **kwargs: Any) -> 'Remote':
return cls(repo, name)

# add is an alias
add = create
@ classmethod
def add(cls, repo: 'Repo', name: str, url: str, **kwargs: Any) -> 'Remote':
return cls.create(repo, name, url, **kwargs)

@ classmethod
def remove(cls, repo: 'Repo', name: str) -> str:
Expand Down
2 changes: 1 addition & 1 deletiongit/repo/base.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -429,7 +429,7 @@ def create_head(self, path: PathLike, commit: str = 'HEAD',
:return: newly created Head Reference"""
return Head.create(self, path, commit, logmsg, force)

def delete_head(self, *heads: 'Head', **kwargs: Any) -> None:
def delete_head(self, *heads: 'Union[str,Head]', **kwargs: Any) -> None:
"""Delete the given heads

:param kwargs: Additional keyword arguments to be passed to git-branch"""
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp