| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -42,8 +42,8 @@ | |||
| 42 | 42 | master_doc = 'index' | |
| 43 | 43 | ||
| 44 | 44 | # General information about the project. | |
| 45 | - project = u'GitPython' | ||
| 46 | - copyright = u'Copyright (C) 2008, 2009 Michael Trier and contributors, 2010-2015 Sebastian Thiel' | ||
| 45 | + project = 'GitPython' | ||
| 46 | + copyright = 'Copyright (C) 2008, 2009 Michael Trier and contributors, 2010-2015 Sebastian Thiel' | ||
| 47 | 47 | ||
| 48 | 48 | # The version info for the project you're documenting, acts as replacement for | |
| 49 | 49 | # |version| and |release|, also used in various other places throughout the | |
@@ -174,8 +174,8 @@ | |||
| 174 | 174 | # Grouping the document tree into LaTeX files. List of tuples | |
| 175 | 175 | # (source start file, target name, title, author, document class [howto/manual]). | |
| 176 | 176 | latex_documents = [ | |
| 177 | - ('index', 'GitPython.tex', ur'GitPython Documentation', | ||
| 178 | - ur'Michael Trier', 'manual'), | ||
| 177 | + ('index', 'GitPython.tex', r'GitPython Documentation', | ||
| 178 | + r'Michael Trier', 'manual'), | ||
| 179 | 179 | ] | |
| 180 | 180 | ||
| 181 | 181 | # The name of an image file (relative to this directory) to place at the top of | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -55,5 +55,5 @@ def _init_externals(): | |||
| 55 | 55 | ||
| 56 | 56 | #} END imports | |
| 57 | 57 | ||
| 58 | - __all__ = [name for name, obj in locals().items() | ||
| 58 | + __all__ = [name for name, obj in list(locals().items()) | ||
| 59 | 59 | if not (name.startswith('_') or inspect.ismodule(obj))] | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -24,7 +24,7 @@ | |||
| 24 | 24 | force_bytes, | |
| 25 | 25 | PY3, | |
| 26 | 26 | # just to satisfy flake8 on py3 | |
| 27 | - unicode, | ||
| 27 | + str, | ||
| 28 | 28 | safe_decode, | |
| 29 | 29 | is_posix, | |
| 30 | 30 | is_win, | |
@@ -128,7 +128,7 @@ def slots_to_dict(self, exclude=()): | |||
| 128 | 128 | ||
| 129 | 129 | ||
| 130 | 130 | def dict_to_slots_and__excluded_are_none(self, d, excluded=()): | |
| 131 | - for k, v in d.items(): | ||
| 131 | + for k, v in list(d.items()): | ||
| 132 | 132 | setattr(self, k, v) | |
| 133 | 133 | for k in excluded: | |
| 134 | 134 | setattr(self, k, None) | |
@@ -381,7 +381,7 @@ def readlines(self, size=-1): | |||
| 381 | 381 | def __iter__(self): | |
| 382 | 382 | return self | |
| 383 | 383 | ||
| 384 | - def next(self): | ||
| 384 | + def __next__(self): | ||
| 385 | 385 | line = self.readline() | |
| 386 | 386 | if not line: | |
| 387 | 387 | raise StopIteration | |
@@ -714,7 +714,7 @@ def update_environment(self, **kwargs): | |||
| 714 | 714 | :return: dict that maps environment variables to their old values | |
| 715 | 715 | """ | |
| 716 | 716 | old_env = {} | |
| 717 | - for key, value in kwargs.items(): | ||
| 717 | + for key, value in list(kwargs.items()): | ||
| 718 | 718 | # set value if it is None | |
| 719 | 719 | if value is not None: | |
| 720 | 720 | old_env[key] = self._environment.get(key) | |
@@ -763,8 +763,8 @@ def transform_kwarg(self, name, value, split_single_char_options): | |||
| 763 | 763 | def transform_kwargs(self, split_single_char_options=True, **kwargs): | |
| 764 | 764 | """Transforms Python style kwargs into git command line options.""" | |
| 765 | 765 | args = list() | |
| 766 | - kwargs = OrderedDict(sorted(kwargs.items(), key=lambda x: x[0])) | ||
| 767 | - for k, v in kwargs.items(): | ||
| 766 | + kwargs = OrderedDict(sorted(list(kwargs.items()), key=lambda x: x[0])) | ||
| 767 | + for k, v in list(kwargs.items()): | ||
| 768 | 768 | if isinstance(v, (list, tuple)): | |
| 769 | 769 | for value in v: | |
| 770 | 770 | args += self.transform_kwarg(k, value, split_single_char_options) | |
@@ -777,15 +777,15 @@ def __unpack_args(cls, arg_list): | |||
| 777 | 777 | if not isinstance(arg_list, (list, tuple)): | |
| 778 | 778 | # This is just required for unicode conversion, as subprocess can't handle it | |
| 779 | 779 | # However, in any other case, passing strings (usually utf-8 encoded) is totally fine | |
| 780 | - if not PY3 and isinstance(arg_list, unicode): | ||
| 780 | + if not PY3 and isinstance(arg_list, str): | ||
| 781 | 781 | return [arg_list.encode(defenc)] | |
| 782 | 782 | return [str(arg_list)] | |
| 783 | 783 | ||
| 784 | 784 | outlist = list() | |
| 785 | 785 | for arg in arg_list: | |
| 786 | 786 | if isinstance(arg_list, (list, tuple)): | |
| 787 | 787 | outlist.extend(cls.__unpack_args(arg)) | |
| 788 | - elif not PY3 and isinstance(arg_list, unicode): | ||
| 788 | + elif not PY3 and isinstance(arg_list, str): | ||
| 789 | 789 | outlist.append(arg_list.encode(defenc)) | |
| 790 | 790 | # END recursion | |
| 791 | 791 | else: | |
@@ -840,8 +840,8 @@ def _call_process(self, method, *args, **kwargs): | |||
| 840 | 840 | :return: Same as ``execute``""" | |
| 841 | 841 | # Handle optional arguments prior to calling transform_kwargs | |
| 842 | 842 | # otherwise these'll end up in args, which is bad. | |
| 843 | - exec_kwargs = dict((k, v) for k, v in kwargs.items() if k in execute_kwargs) | ||
| 844 | - opts_kwargs = dict((k, v) for k, v in kwargs.items() if k not in execute_kwargs) | ||
| 843 | + exec_kwargs = dict((k, v) for k, v in list(kwargs.items()) if k in execute_kwargs) | ||
| 844 | + opts_kwargs = dict((k, v) for k, v in list(kwargs.items()) if k not in execute_kwargs) | ||
| 845 | 845 | ||
| 846 | 846 | insert_after_this_arg = opts_kwargs.pop('insert_kwargs_after', None) | |
| 847 | 847 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -43,10 +43,10 @@ def bchr(n): | |||
| 43 | 43 | return bytes([n]) | |
| 44 | 44 | ||
| 45 | 45 | def mviter(d): | |
| 46 | - return d.values() | ||
| 46 | + return list(d.values()) | ||
| 47 | 47 | ||
| 48 | 48 | range = xrange # @ReservedAssignment | |
| 49 | - unicode = str | ||
| 49 | + str = str | ||
| 50 | 50 | binary_type = bytes | |
| 51 | 51 | else: | |
| 52 | 52 | FileType = file # @UndefinedVariable on PY3 | |
@@ -56,17 +56,17 @@ def mviter(d): | |||
| 56 | 56 | defenc = 'utf-8' | |
| 57 | 57 | byte_ord = ord | |
| 58 | 58 | bchr = chr | |
| 59 | - unicode = unicode | ||
| 59 | + str = str | ||
| 60 | 60 | binary_type = str | |
| 61 | 61 | range = xrange # @ReservedAssignment | |
| 62 | 62 | ||
| 63 | 63 | def mviter(d): | |
| 64 | - return d.itervalues() | ||
| 64 | + return iter(d.values()) | ||
| 65 | 65 | ||
| 66 | 66 | ||
| 67 | 67 | def safe_decode(s): | |
| 68 | 68 | """Safely decodes a binary string to unicode""" | |
| 69 | - if isinstance(s, unicode): | ||
| 69 | + if isinstance(s, str): | ||
| 70 | 70 | return s | |
| 71 | 71 | elif isinstance(s, bytes): | |
| 72 | 72 | return s.decode(defenc, 'surrogateescape') | |
@@ -76,7 +76,7 @@ def safe_decode(s): | |||
| 76 | 76 | ||
| 77 | 77 | def safe_encode(s): | |
| 78 | 78 | """Safely decodes a binary string to unicode""" | |
| 79 | - if isinstance(s, unicode): | ||
| 79 | + if isinstance(s, str): | ||
| 80 | 80 | return s.encode(defenc) | |
| 81 | 81 | elif isinstance(s, bytes): | |
| 82 | 82 | return s | |
@@ -86,7 +86,7 @@ def safe_encode(s): | |||
| 86 | 86 | ||
| 87 | 87 | def win_encode(s): | |
| 88 | 88 | """Encode unicodes for process arguments on Windows.""" | |
| 89 | - if isinstance(s, unicode): | ||
| 89 | + if isinstance(s, str): | ||
| 90 | 90 | return s.encode(locale.getpreferredencoding(False)) | |
| 91 | 91 | elif isinstance(s, bytes): | |
| 92 | 92 | return s | |
@@ -155,7 +155,7 @@ def b(data): | |||
| 155 | 155 | _unichr = chr | |
| 156 | 156 | bytes_chr = lambda code: bytes((code,)) | |
| 157 | 157 | else: | |
| 158 | - _unichr = unichr | ||
| 158 | + _unichr = chr | ||
| 159 | 159 | bytes_chr = chr | |
| 160 | 160 | ||
| 161 | 161 | def surrogateescape_handler(exc): | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -28,7 +28,7 @@ | |||
| 28 | 28 | ||
| 29 | 29 | ||
| 30 | 30 | try: | |
| 31 | - import ConfigParser as cp | ||
| 31 | + import configparser as cp | ||
| 32 | 32 | except ImportError: | |
| 33 | 33 | # PY3 | |
| 34 | 34 | import configparser as cp | |
@@ -441,15 +441,15 @@ def _write(self, fp): | |||
| 441 | 441 | git compatible format""" | |
| 442 | 442 | def write_section(name, section_dict): | |
| 443 | 443 | fp.write(("[%s]\n" % name).encode(defenc)) | |
| 444 | - for (key, value) in section_dict.items(): | ||
| 444 | + for (key, value) in list(section_dict.items()): | ||
| 445 | 445 | if key != "__name__": | |
| 446 | 446 | fp.write(("\t%s = %s\n" % (key, self._value_to_string(value).replace('\n', '\n\t'))).encode(defenc)) | |
| 447 | 447 | # END if key is not __name__ | |
| 448 | 448 | # END section writing | |
| 449 | 449 | ||
| 450 | 450 | if self._defaults: | |
| 451 | 451 | write_section(cp.DEFAULTSECT, self._defaults) | |
| 452 | - for name, value in self._sections.items(): | ||
| 452 | + for name, value in list(self._sections.items()): | ||
| 453 | 453 | write_section(name, value) | |
| 454 | 454 | ||
| 455 | 455 | def items(self, section_name): | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -31,7 +31,7 @@ class CommandError(UnicodeMixin, Exception): | |||
| 31 | 31 | #: A unicode print-format with 2 `%s for `<cmdline>` and the rest, | |
| 32 | 32 | #: e.g. | |
| 33 | 33 | #: u"'%s' failed%s" | |
| 34 | - _msg = u"Cmd('%s') failed%s" | ||
| 34 | + _msg = "Cmd('%s') failed%s" | ||
| 35 | 35 | ||
| 36 | 36 | def __init__(self, command, status=None, stderr=None, stdout=None): | |
| 37 | 37 | if not isinstance(command, (tuple, list)): | |
@@ -40,19 +40,19 @@ def __init__(self, command, status=None, stderr=None, stdout=None): | |||
| 40 | 40 | self.status = status | |
| 41 | 41 | if status: | |
| 42 | 42 | if isinstance(status, Exception): | |
| 43 | - status = u"%s('%s')" % (type(status).__name__, safe_decode(str(status))) | ||
| 43 | + status = "%s('%s')" % (type(status).__name__, safe_decode(str(status))) | ||
| 44 | 44 | else: | |
| 45 | 45 | try: | |
| 46 | - status = u'exit code(%s)' % int(status) | ||
| 46 | + status = 'exit code(%s)' % int(status) | ||
| 47 | 47 | except: | |
| 48 | 48 | s = safe_decode(str(status)) | |
| 49 | - status = u"'%s'" % s if isinstance(status, string_types) else s | ||
| 49 | + status = "'%s'" % s if isinstance(status, string_types) else s | ||
| 50 | 50 | ||
| 51 | 51 | self._cmd = safe_decode(command[0]) | |
| 52 | - self._cmdline = u' '.join(safe_decode(i) for i in command) | ||
| 53 | - self._cause = status and u" due to: %s" % status or "!" | ||
| 54 | - self.stdout = stdout and u"\n stdout: '%s'" % safe_decode(stdout) or '' | ||
| 55 | - self.stderr = stderr and u"\n stderr: '%s'" % safe_decode(stderr) or '' | ||
| 52 | + self._cmdline = ' '.join(safe_decode(i) for i in command) | ||
| 53 | + self._cause = status and " due to: %s" % status or "!" | ||
| 54 | + self.stdout = stdout and "\n stdout: '%s'" % safe_decode(stdout) or '' | ||
| 55 | + self.stderr = stderr and "\n stderr: '%s'" % safe_decode(stderr) or '' | ||
| 56 | 56 | ||
| 57 | 57 | def __unicode__(self): | |
| 58 | 58 | return (self._msg + "\n cmdline: %s%s%s") % ( | |
@@ -64,7 +64,7 @@ class GitCommandNotFound(CommandError): | |||
| 64 | 64 | the GIT_PYTHON_GIT_EXECUTABLE environment variable""" | |
| 65 | 65 | def __init__(self, command, cause): | |
| 66 | 66 | super(GitCommandNotFound, self).__init__(command, cause) | |
| 67 | - self._msg = u"Cmd('%s') not found%s" | ||
| 67 | + self._msg = "Cmd('%s') not found%s" | ||
| 68 | 68 | ||
| 69 | 69 | ||
| 70 | 70 | class GitCommandError(CommandError): | |
@@ -114,7 +114,7 @@ class HookExecutionError(CommandError): | |||
| 114 | 114 | ||
| 115 | 115 | def __init__(self, command, status, stderr=None, stdout=None): | |
| 116 | 116 | super(HookExecutionError, self).__init__(command, status, stderr, stdout) | |
| 117 | - self._msg = u"Hook('%s') failed%s" | ||
| 117 | + self._msg = "Hook('%s') failed%s" | ||
| 118 | 118 | ||
| 119 | 119 | ||
| 120 | 120 | class RepositoryDirtyError(Exception): | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,6 +1,6 @@ | |||
| 1 | 1 | """Initialize the index package""" | |
| 2 | 2 | # flake8: noqa | |
| 3 | - from __future__ import absolute_import | ||
| 3 | + | ||
| 4 | 4 | ||
| 5 | 5 | from .base import * | |
| 6 | 6 | from .typ import * | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -171,7 +171,7 @@ def _deserialize(self, stream): | |||
| 171 | 171 | ||
| 172 | 172 | def _entries_sorted(self): | |
| 173 | 173 | """:return: list of entries, in a sorted fashion, first by path, then by stage""" | |
| 174 | - return sorted(self.entries.values(), key=lambda e: (e.path, e.stage)) | ||
| 174 | + return sorted(list(self.entries.values()), key=lambda e: (e.path, e.stage)) | ||
| 175 | 175 | ||
| 176 | 176 | def _serialize(self, stream, ignore_extension_data=False): | |
| 177 | 177 | entries = self._entries_sorted() | |
@@ -280,7 +280,7 @@ def new(cls, repo, *tree_sha): | |||
| 280 | 280 | ||
| 281 | 281 | inst = cls(repo) | |
| 282 | 282 | # convert to entries dict | |
| 283 | - entries = dict(izip(((e.path, e.stage) for e in base_entries), | ||
| 283 | + entries = dict(zip(((e.path, e.stage) for e in base_entries), | ||
| 284 | 284 | (IndexEntry.from_base(e) for e in base_entries))) | |
| 285 | 285 | ||
| 286 | 286 | inst.entries = entries | |
@@ -915,7 +915,7 @@ def move(self, items, skip_errors=False, **kwargs): | |||
| 915 | 915 | ||
| 916 | 916 | # parse result - first 0:n/2 lines are 'checking ', the remaining ones | |
| 917 | 917 | # are the 'renaming' ones which we parse | |
| 918 | - for ln in xrange(int(len(mvlines) / 2), len(mvlines)): | ||
| 918 | + for ln in range(int(len(mvlines) / 2), len(mvlines)): | ||
| 919 | 919 | tokens = mvlines[ln].split(' to ') | |
| 920 | 920 | assert len(tokens) == 2, "Too many tokens in %s" % mvlines[ln] | |
| 921 | 921 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2,7 +2,7 @@ | |||
| 2 | 2 | Import all submodules main classes into the package space | |
| 3 | 3 | """ | |
| 4 | 4 | # flake8: noqa | |
| 5 | - from __future__ import absolute_import | ||
| 5 | + | ||
| 6 | 6 | ||
| 7 | 7 | import inspect | |
| 8 | 8 | ||
@@ -22,5 +22,5 @@ | |||
| 22 | 22 | ||
| 23 | 23 | # must come after submodule was made available | |
| 24 | 24 | ||
| 25 | - __all__ = [name for name, obj in locals().items() | ||
| 25 | + __all__ = [name for name, obj in list(locals().items()) | ||
| 26 | 26 | if not (name.startswith('_') or inspect.ismodule(obj))] | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -22,7 +22,7 @@ def tree_to_stream(entries, write): | |||
| 22 | 22 | ||
| 23 | 23 | for binsha, mode, name in entries: | |
| 24 | 24 | mode_str = b'' | |
| 25 | - for i in xrange(6): | ||
| 25 | + for i in range(6): | ||
| 26 | 26 | mode_str = bchr(((mode >> (i * 3)) & bit_mask) + ord_zero) + mode_str | |
| 27 | 27 | # END for each 8 octal value | |
| 28 | 28 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments