summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHarmon <Harmon758@gmail.com>2020-02-07 05:01:57 -0600
committerSebastian Thiel <sebastian.thiel@icloud.com>2020-02-08 10:55:50 +0800
commitec29b1562a3b7c2bf62e54e39dce18aebbb58959 (patch)
tree96ff14daa7d57328e7ec859cefadef144938e6d1
parent438d3e6e8171189cfdc0a3507475f7a42d91bf02 (diff)
downloadgitpython-ec29b1562a3b7c2bf62e54e39dce18aebbb58959.tar.gz
Remove compat.byte_ord
-rw-r--r--git/compat.py4
-rw-r--r--git/objects/fun.py9
2 files changed, 4 insertions, 9 deletions
diff --git a/git/compat.py b/git/compat.py
index 1ee4e2ee..ea441ec1 100644
--- a/git/compat.py
+++ b/git/compat.py
@@ -33,9 +33,6 @@ is_darwin = (os.name == 'darwin')
defenc = sys.getfilesystemencoding()
if PY3:
- def byte_ord(b):
- return b
-
def bchr(n):
return bytes([n])
@@ -48,7 +45,6 @@ if PY3:
else:
if defenc == 'ascii':
defenc = 'utf-8'
- byte_ord = ord
bchr = chr
unicode = unicode
binary_type = str
diff --git a/git/objects/fun.py b/git/objects/fun.py
index dc879fd2..34d8e5de 100644
--- a/git/objects/fun.py
+++ b/git/objects/fun.py
@@ -1,7 +1,6 @@
"""Module with functions which are supposed to be as fast as possible"""
from stat import S_ISDIR
from git.compat import (
- byte_ord,
safe_decode,
defenc,
xrange,
@@ -27,7 +26,7 @@ def tree_to_stream(entries, write):
# END for each 8 octal value
# git slices away the first octal if its zero
- if byte_ord(mode_str[0]) == ord_zero:
+ if mode_str[0] == ord_zero:
mode_str = mode_str[1:]
# END save a byte
@@ -57,10 +56,10 @@ def tree_entries_from_data(data):
# read mode
# Some git versions truncate the leading 0, some don't
# The type will be extracted from the mode later
- while byte_ord(data[i]) != space_ord:
+ while data[i] != space_ord:
# move existing mode integer up one level being 3 bits
# and add the actual ordinal value of the character
- mode = (mode << 3) + (byte_ord(data[i]) - ord_zero)
+ mode = (mode << 3) + (data[i] - ord_zero)
i += 1
# END while reading mode
@@ -70,7 +69,7 @@ def tree_entries_from_data(data):
# parse name, it is NULL separated
ns = i
- while byte_ord(data[i]) != 0:
+ while data[i] != 0:
i += 1
# END while not reached NULL