FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Fix typing issues with delete_head and Remote.add by rra · Pull Request #1346 · gitpython-developers/GitPython · GitHub

Repository navigation

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

Filter by extension

Filter by extension .py  (4) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
2 changes: 1 addition & 1 deletion git/refs/head.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff 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 deletion git/refs/remote.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff 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 deletion git/remote.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff 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 deletion git/repo/base.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff 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

Back | FazBrowse Home | New Git URL