diff options
author | Yobmod <yobmod@gmail.com> | 2021-06-25 20:52:29 +0100 |
---|---|---|
committer | Yobmod <yobmod@gmail.com> | 2021-06-25 20:52:29 +0100 |
commit | 7b09003fffa8196277bcfaa9984a3e6833805a6d (patch) | |
tree | 6d5a58d9e98ee43e11ab71534e3bc9062f01e242 /git/refs/log.py | |
parent | dc8d23d3d6e735d70fd0a60641c58f6e44e17029 (diff) | |
download | gitpython-7b09003fffa8196277bcfaa9984a3e6833805a6d.tar.gz |
replace cast()s with asserts in remote.py
Diffstat (limited to 'git/refs/log.py')
-rw-r--r-- | git/refs/log.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/git/refs/log.py b/git/refs/log.py index 363c3c5d..f850ba24 100644 --- a/git/refs/log.py +++ b/git/refs/log.py @@ -82,23 +82,23 @@ class RefLogEntry(tuple): return RefLogEntry((oldhexsha, newhexsha, actor, (time, tz_offset), message)) @classmethod - def from_line(cls, line): + def from_line(cls, line: bytes) -> 'RefLogEntry': """:return: New RefLogEntry instance from the given revlog line. :param line: line bytes without trailing newline :raise ValueError: If line could not be parsed""" - line = line.decode(defenc) - fields = line.split('\t', 1) + line_str = line.decode(defenc) + fields = line_str.split('\t', 1) if len(fields) == 1: info, msg = fields[0], None elif len(fields) == 2: info, msg = fields else: raise ValueError("Line must have up to two TAB-separated fields." - " Got %s" % repr(line)) + " Got %s" % repr(line_str)) # END handle first split - oldhexsha = info[:40] # type: str - newhexsha = info[41:81] # type: str + oldhexsha = info[:40] + newhexsha = info[41:81] for hexsha in (oldhexsha, newhexsha): if not cls._re_hexsha_only.match(hexsha): raise ValueError("Invalid hexsha: %r" % (hexsha,)) |