Skip to content

Remove Python 2 compatibility shims #979

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 32 commits into from
Feb 8, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
ff57c04
Remove str import from builtins
Harmon758 Feb 7, 2020
e0bf255
Remove unnecessary check for sys.getfilesystemencoding
Harmon758 Feb 7, 2020
142c779
Remove and replace compat.FileType
Harmon758 Feb 7, 2020
584ab08
Remove compat.byte_ord
Harmon758 Feb 7, 2020
e564c2f
Remove and replace compat.bchr
Harmon758 Feb 7, 2020
5444787
Remove and replace compat.mviter
Harmon758 Feb 7, 2020
3f21cb1
Remove compat.range
Harmon758 Feb 7, 2020
d0d2a86
Remove and replace compat.xrange
Harmon758 Feb 7, 2020
91e91b2
Remove and replace compat.unicode
Harmon758 Feb 7, 2020
c30880d
Remove Python 2 check for compat.defenc
Harmon758 Feb 7, 2020
2c4d556
Remove and replace compat.binary_type
Harmon758 Feb 7, 2020
8e55323
Remove and replace compat._unichr
Harmon758 Feb 7, 2020
18fc6b2
Remove and replace compat.bytes_chr
Harmon758 Feb 7, 2020
9615ada
Remove surrogateescape error handler for Python 2
Harmon758 Feb 7, 2020
5549ffe
Remove and replace compat.UnicodeMixin
Harmon758 Feb 7, 2020
60c8dc2
Remove checks for Python 2 and/or 3
Harmon758 Feb 7, 2020
6005b89
Remove Python 2 test
Harmon758 Feb 7, 2020
952eaad
Remove compat.PY3
Harmon758 Feb 7, 2020
266187b
Remove and replace compat.MAXSIZE
Harmon758 Feb 7, 2020
8a8b24e
Remove and replace compat.izip
Harmon758 Feb 7, 2020
07df7c9
Remove and replace compat.string_types
Harmon758 Feb 7, 2020
2f31261
Remove and replace compat.text_type
Harmon758 Feb 7, 2020
369de3d
Remove no longer used compat imports
Harmon758 Feb 7, 2020
92348df
Remove no longer used imports in tests
Harmon758 Feb 7, 2020
ebcdb8b
Remove attempt to import ConfigParser for Python 2
Harmon758 Feb 7, 2020
7f250ca
Remove check for Python 2.7
Harmon758 Feb 7, 2020
21d56e2
Remove unnecessary check for logging.NullHandler for Python 2.6
Harmon758 Feb 7, 2020
d96688f
Improve setup.py python_requires
Harmon758 Feb 7, 2020
d0cd5bf
Remove unnecessary check for PermissionError for Python < 3.3
Harmon758 Feb 7, 2020
a611adc
Add to AUTHORS
Harmon758 Feb 7, 2020
d0899a0
Fix requirements.txt formatting
Harmon758 Feb 7, 2020
c5f5911
Remove now unused is_invoking_git variable in test
Harmon758 Feb 7, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remove and replace compat.mviter
  • Loading branch information
Harmon758 committed Feb 7, 2020
commit 544478714d2f02e8c63d0b660be2e265c60ef627
6 changes: 0 additions & 6 deletions git/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@
defenc = sys.getfilesystemencoding()

if PY3:
def mviter(d):
return d.values()

range = xrange # @ReservedAssignment
unicode = str
binary_type = bytes
Expand All @@ -46,9 +43,6 @@ def mviter(d):
binary_type = str
range = xrange # @ReservedAssignment

def mviter(d):
return d.itervalues()


def safe_decode(s):
"""Safely decodes a binary string to unicode"""
Expand Down
9 changes: 4 additions & 5 deletions git/index/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
string_types,
force_bytes,
defenc,
mviter,
)
from git.exc import (
GitCommandError,
Expand Down Expand Up @@ -442,7 +441,7 @@ def iter_blobs(self, predicate=lambda t: True):
Function(t) returning True if tuple(stage, Blob) should be yielded by the
iterator. A default filter, the BlobFilter, allows you to yield blobs
only if they match a given list of paths. """
for entry in mviter(self.entries):
for entry in self.entries.values():
blob = entry.to_blob(self.repo)
blob.size = entry.size
output = (entry.stage, blob)
Expand All @@ -467,7 +466,7 @@ def unmerged_blobs(self):
for stage, blob in self.iter_blobs(is_unmerged_blob):
path_map.setdefault(blob.path, []).append((stage, blob))
# END for each unmerged blob
for l in mviter(path_map):
for l in path_map.values():
l.sort()
return path_map

Expand Down Expand Up @@ -1086,7 +1085,7 @@ def handle_stderr(proc, iter_checked_out_files):
proc = self.repo.git.checkout_index(*args, **kwargs)
proc.wait()
fprogress(None, True, None)
rval_iter = (e.path for e in mviter(self.entries))
rval_iter = (e.path for e in self.entries.values())
handle_stderr(proc, rval_iter)
return rval_iter
else:
Expand Down Expand Up @@ -1117,7 +1116,7 @@ def handle_stderr(proc, iter_checked_out_files):
folder = co_path
if not folder.endswith('/'):
folder += '/'
for entry in mviter(self.entries):
for entry in self.entries.values():
if entry.path.startswith(folder):
p = entry.path
self._write_path_to_stdin(proc, p, p, make_exc,
Expand Down