diff --git a/vcsserver/lib/_vendor/jsonlogger/__init__.py b/vcsserver/lib/_vendor/jsonlogger/__init__.py --- a/vcsserver/lib/_vendor/jsonlogger/__init__.py +++ b/vcsserver/lib/_vendor/jsonlogger/__init__.py @@ -132,7 +132,7 @@ class JsonFormatter(ExceptionAwareFormat self.json_ensure_ascii = kwargs.pop("json_ensure_ascii", True) self.prefix = kwargs.pop("prefix", "") reserved_attrs = kwargs.pop("reserved_attrs", RESERVED_ATTRS) - self.reserved_attrs = dict(zip(reserved_attrs, reserved_attrs)) + self.reserved_attrs = dict(list(zip(reserved_attrs, reserved_attrs))) self.timestamp = kwargs.pop("timestamp", True) # super(JsonFormatter, self).__init__(*args, **kwargs) @@ -141,8 +141,8 @@ class JsonFormatter(ExceptionAwareFormat self.json_encoder = JsonEncoder self._required_fields = self.parse() - self._skip_fields = dict(zip(self._required_fields, - self._required_fields)) + self._skip_fields = dict(list(zip(self._required_fields, + self._required_fields))) self._skip_fields.update(self.reserved_attrs) def _str_to_fn(self, fn_as_str): diff --git a/vcsserver/lib/memory_lru_dict.py b/vcsserver/lib/memory_lru_dict.py --- a/vcsserver/lib/memory_lru_dict.py +++ b/vcsserver/lib/memory_lru_dict.py @@ -45,7 +45,7 @@ class LRUDict(LRUCache): del self.data[key] def keys(self): - return self.data.keys() + return list(self.data.keys()) class LRUDictDebug(LRUDict): @@ -53,7 +53,7 @@ class LRUDictDebug(LRUDict): Wrapper to provide some debug options """ def _report_keys(self): - elems_cnt = '%s/%s' % (len(self.keys()), self.size) + elems_cnt = '%s/%s' % (len(list(self.keys())), self.size) # trick for pformat print it more nicely fmt = '\n' for cnt, elem in enumerate(self.keys()): diff --git a/vcsserver/lib/rc_cache/backends.py b/vcsserver/lib/rc_cache/backends.py --- a/vcsserver/lib/rc_cache/backends.py +++ b/vcsserver/lib/rc_cache/backends.py @@ -153,7 +153,7 @@ class FileNamespaceBackend(PickleSeriali with self._dbm_file(True) as dbm: try: - return filter(cond, dbm.keys()) + return list(filter(cond, list(dbm.keys()))) except Exception: log.error('Failed to fetch DBM keys from DB: %s', self.get_store()) raise diff --git a/vcsserver/lib/rc_cache/utils.py b/vcsserver/lib/rc_cache/utils.py --- a/vcsserver/lib/rc_cache/utils.py +++ b/vcsserver/lib/rc_cache/utils.py @@ -162,7 +162,7 @@ def get_or_create_region(region_name, re if not region_obj: raise EnvironmentError( 'Region `{}` not in configured: {}.'.format( - region_name, region_meta.dogpile_cache_regions.keys())) + region_name, list(region_meta.dogpile_cache_regions.keys()))) region_uid_name = '{}:{}'.format(region_name, region_namespace) if isinstance(region_obj.actual_backend, FileNamespaceBackend): diff --git a/vcsserver/remote/svn.py b/vcsserver/remote/svn.py --- a/vcsserver/remote/svn.py +++ b/vcsserver/remote/svn.py @@ -283,7 +283,7 @@ class SvnRemote(RemoteBase): return _node_properties(repo_id, path, revision) def file_annotate(self, wire, path, revision): - abs_path = 'file://' + urllib.pathname2url( + abs_path = 'file://' + urllib.request.pathname2url( vcspath.join(wire['path'], path)) file_uri = svn.core.svn_path_canonicalize(abs_path) diff --git a/vcsserver/tests/fixture.py b/vcsserver/tests/fixture.py --- a/vcsserver/tests/fixture.py +++ b/vcsserver/tests/fixture.py @@ -57,8 +57,8 @@ class ContextINI(object): self.new_path, file_error=True, write_empty_values=True) for data in self.ini_params: - section, ini_params = data.items()[0] - key, val = ini_params.items()[0] + section, ini_params = list(data.items())[0] + key, val = list(ini_params.items())[0] if section not in config: config[section] = {} config[section][key] = val diff --git a/vcsserver/tests/test_git.py b/vcsserver/tests/test_git.py --- a/vcsserver/tests/test_git.py +++ b/vcsserver/tests/test_git.py @@ -79,7 +79,7 @@ class TestGitFetch(object): mock_fetch.side_effect = side_effect self.remote_git.pull( wire={}, url='/tmp/', apply_refs=False, - refs=selected_refs.keys()) + refs=list(selected_refs.keys())) determine_wants = self.mock_repo.object_store.determine_wants_all assert determine_wants.call_count == 0 diff --git a/vcsserver/tests/test_utils.py b/vcsserver/tests/test_utils.py --- a/vcsserver/tests/test_utils.py +++ b/vcsserver/tests/test_utils.py @@ -21,7 +21,7 @@ from vcsserver.utils import ascii_bytes, @pytest.mark.parametrize('given, expected', [ ('a', b'a'), - (u'a', b'a'), + ('a', b'a'), ]) def test_ascii_bytes(given, expected): assert ascii_bytes(given) == expected @@ -44,9 +44,9 @@ def test_ascii_str(given, expected): @pytest.mark.parametrize('given', [ - u'a', + 'a', 'å'.encode('utf8'), - u'å' + 'å' ]) def test_ascii_str_raises(given): with pytest.raises(ValueError):