python3: 2to3 fixes

This commit is contained in:
RhodeCode Admin 2023-03-06 23:40:40 +01:00
parent 4fb37095fb
commit 094d4466e2
2 changed files with 13 additions and 16 deletions

View file

@ -7,10 +7,7 @@ import hashlib
import hmac
import json
import logging
try:
import cPickle as pickle
except ImportError:
import pickle
import pickle
import sys
import threading
import time

View file

@ -32,8 +32,8 @@ import time
import collections
import difflib
import logging
import cPickle as pickle
from itertools import tee, imap
import pickle
from itertools import tee
from rhodecode.lib.vcs.exceptions import VCSError
from rhodecode.lib.vcs.nodes import FileNode, SubModuleNode
@ -430,10 +430,10 @@ class DiffProcessor(object):
lineiter = iter(chunk)
try:
while 1:
line = lineiter.next()
line = next(lineiter)
if line['action'] not in (
Action.UNMODIFIED, Action.CONTEXT):
nextline = lineiter.next()
nextline = next(lineiter)
if nextline['action'] in ['unmod', 'context'] or \
nextline['action'] == line['action']:
continue
@ -633,7 +633,7 @@ class DiffProcessor(object):
raw_diff = []
try:
line = diff_iter.next()
line = next(diff_iter)
while line:
raw_diff.append(line)
@ -665,7 +665,7 @@ class DiffProcessor(object):
'line': line,
})
line = diff_iter.next()
line = next(diff_iter)
while old_line < old_end or new_line < new_end:
command = ' '
@ -700,7 +700,7 @@ class DiffProcessor(object):
})
raw_diff.append(line)
line = diff_iter.next()
line = next(diff_iter)
if self._newline_marker.match(line):
# we need to append to lines, since this is not
@ -727,7 +727,7 @@ class DiffProcessor(object):
raw_diff = []
try:
line = diff_iter.next()
line = next(diff_iter)
while line:
raw_diff.append(line)
@ -759,7 +759,7 @@ class DiffProcessor(object):
old_end += old_line
new_end += new_line
line = diff_iter.next()
line = next(diff_iter)
while old_line < old_end or new_line < new_end:
command = ' '
@ -794,7 +794,7 @@ class DiffProcessor(object):
})
raw_diff.append(line)
line = diff_iter.next()
line = next(diff_iter)
if self._newline_marker.match(line):
# we need to append to lines, since this is not
@ -1066,7 +1066,7 @@ class DiffProcessor(object):
context_iter = iter(context)
for line_idx, line in enumerate(chunk):
try:
if _context_line(line) == context_iter.next():
if _context_line(line) == next(context_iter):
continue
except StopIteration:
matches.append((line_idx, chunk))
@ -1076,7 +1076,7 @@ class DiffProcessor(object):
# if we had a match at the end
line_idx += 1
try:
context_iter.next()
next(context_iter)
except StopIteration:
matches.append((line_idx, chunk))