Skip to content

Commit aecb80c

Browse files
authored
Update symbolic.py
1 parent ea869bb commit aecb80c

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

git/refs/symbolic.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@
2525

2626
if TYPE_CHECKING:
2727
from git.repo import Repo
28-
from git.refs import Reference, Head, TagReference, RemoteReference
29-
from git.config import GitConfigParser
30-
from git.objects.commit import Actor
28+
from git.refs import Reference, Head, TagReference, RemoteReference # NOQA
29+
from git.config import GitConfigParser # NOQA
30+
from git.objects.commit import Actor # NOQA
3131

3232
T_References = TypeVar('T_References', bound='SymbolicReference')
3333

@@ -37,9 +37,9 @@
3737
__all__ = ["SymbolicReference"]
3838

3939

40-
def _git_dir(repo, path):
40+
def _git_dir(repo: 'Repo', path: PathLike) -> PathLike:
4141
""" Find the git dir that's appropriate for the path"""
42-
name = "%s" % (path,)
42+
name = f"{path}"
4343
if name in ['HEAD', 'ORIG_HEAD', 'FETCH_HEAD', 'index', 'logs']:
4444
return repo.git_dir
4545
return repo.common_dir
@@ -59,34 +59,35 @@ class SymbolicReference(object):
5959
_remote_common_path_default = "refs/remotes"
6060
_id_attribute_ = "name"
6161

62-
def __init__(self, repo: 'Repo', path: PathLike, check_path: bool = False):
62+
def __init__(self, repo: 'Repo', path: PathLike, check_path: bool = False) -> None:
6363
self.repo = repo
6464
self.path = str(path)
65+
self.ref = self._get_reference()
6566

6667
def __str__(self) -> str:
6768
return self.path
6869

69-
def __repr__(self):
70+
def __repr__(self) -> str:
7071
return '<git.%s "%s">' % (self.__class__.__name__, self.path)
7172

72-
def __eq__(self, other):
73+
def __eq__(self, other) -> bool:
7374
if hasattr(other, 'path'):
7475
return self.path == other.path
7576
return False
7677

77-
def __ne__(self, other):
78+
def __ne__(self, other) -> bool:
7879
return not (self == other)
7980

8081
def __hash__(self):
8182
return hash(self.path)
8283

8384
@property
84-
def name(self):
85+
def name(self) -> str:
8586
"""
8687
:return:
8788
In case of symbolic references, the shortest assumable name
8889
is the path itself."""
89-
return self.path
90+
return str(self.path)
9091

9192
@property
9293
def abspath(self):

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy