| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -129,7 +129,7 @@ class Head(Reference): | |||
| 129 | 129 | k_config_remote_ref = "merge" # branch to merge from remote | |
| 130 | 130 | ||
| 131 | 131 | @classmethod | |
| 132 | - def delete(cls, repo: 'Repo', *heads: 'Head', force: bool = False, **kwargs: Any) -> None: | ||
| 132 | + def delete(cls, repo: 'Repo', *heads: 'Union[Head, str]', force: bool = False, **kwargs: Any) -> None: | ||
| 133 | 133 | """Delete the given heads | |
| 134 | 134 | ||
| 135 | 135 | :param force: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -37,8 +37,13 @@ def iter_items(cls, repo: 'Repo', common_path: Union[PathLike, None] = None, | |||
| 37 | 37 | # super is Reference | |
| 38 | 38 | return super(RemoteReference, cls).iter_items(repo, common_path) | |
| 39 | 39 | ||
| 40 | + # The Head implementation of delete also accepts strs, but this | ||
| 41 | + # implementation does not. mypy doesn't have a way of representing | ||
| 42 | + # tightening the types of arguments in subclasses and recommends Any or | ||
| 43 | + # "type: ignore". (See https://github.com/python/typing/issues/241) | ||
| 40 | 44 | @ classmethod | |
| 41 | - def delete(cls, repo: 'Repo', *refs: 'RemoteReference', **kwargs: Any) -> None: | ||
| 45 | + def delete(cls, repo: 'Repo', *refs: 'RemoteReference', # type: ignore | ||
| 46 | + **kwargs: Any) -> None: | ||
| 42 | 47 | """Delete the given remote references | |
| 43 | 48 | ||
| 44 | 49 | :note: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -665,7 +665,9 @@ def create(cls, repo: 'Repo', name: str, url: str, **kwargs: Any) -> 'Remote': | |||
| 665 | 665 | return cls(repo, name) | |
| 666 | 666 | ||
| 667 | 667 | # add is an alias | |
| 668 | - add = create | ||
| 668 | + @ classmethod | ||
| 669 | + def add(cls, repo: 'Repo', name: str, url: str, **kwargs: Any) -> 'Remote': | ||
| 670 | + return cls.create(repo, name, url, **kwargs) | ||
| 669 | 671 | ||
| 670 | 672 | @ classmethod | |
| 671 | 673 | def remove(cls, repo: 'Repo', name: str) -> str: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -429,7 +429,7 @@ def create_head(self, path: PathLike, commit: str = 'HEAD', | |||
| 429 | 429 | :return: newly created Head Reference""" | |
| 430 | 430 | return Head.create(self, path, commit, logmsg, force) | |
| 431 | 431 | ||
| 432 | - def delete_head(self, *heads: 'Head', **kwargs: Any) -> None: | ||
| 432 | + def delete_head(self, *heads: 'Union[str, Head]', **kwargs: Any) -> None: | ||
| 433 | 433 | """Delete the given heads | |
| 434 | 434 | ||
| 435 | 435 | :param kwargs: Additional keyword arguments to be passed to git-branch""" | |
| Back | FazBrowse Home | New Git URL |
0 commit comments