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

Fix type hint for `SymbolicReference.reference` property by emmanuel-ferdman · Pull Request #2074 · gitpython-developers/GitPython · GitHub

Repository navigation

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (1) 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
7 changes: 4 additions & 3 deletions git/refs/symbolic.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 @@ -40,6 +40,7 @@
from git.config import GitConfigParser
from git.objects.commit import Actor
from git.refs.log import RefLogEntry
from git.refs.reference import Reference
from git.repo import Repo


Expand Down Expand Up @@ -404,7 +405,7 @@ def object(self) -> AnyGitObject:
def object(self, object: Union[AnyGitObject, "SymbolicReference", str]) -> "SymbolicReference":
return self.set_object(object)

def _get_reference(self) -> "SymbolicReference":
def _get_reference(self) -> "Reference":
"""
:return:
:class:`~git.refs.reference.Reference` object we point to
Expand All @@ -416,7 +417,7 @@ def _get_reference(self) -> "SymbolicReference":
sha, target_ref_path = self._get_ref_info(self.repo, self.path)
if target_ref_path is None:
raise TypeError("%s is a detached symbolic reference as it points to %r" % (self, sha))
return self.from_path(self.repo, target_ref_path)
return cast("Reference", self.from_path(self.repo, target_ref_path))

def set_reference(
self,
Expand Down Expand Up @@ -502,7 +503,7 @@ def set_reference(

# Aliased reference
@property
def reference(self) -> "SymbolicReference":
def reference(self) -> "Reference":
return self._get_reference()

@reference.setter
Expand Down
Loading

Back | FazBrowse Home | New Git URL