##// END OF EJS Templates
python3: another 2to3 pass
super-admin -
r1054:545da466 python3
parent child Browse files
Show More
@@ -132,7 +132,7 b' class JsonFormatter(ExceptionAwareFormat'
132 self.json_ensure_ascii = kwargs.pop("json_ensure_ascii", True)
132 self.json_ensure_ascii = kwargs.pop("json_ensure_ascii", True)
133 self.prefix = kwargs.pop("prefix", "")
133 self.prefix = kwargs.pop("prefix", "")
134 reserved_attrs = kwargs.pop("reserved_attrs", RESERVED_ATTRS)
134 reserved_attrs = kwargs.pop("reserved_attrs", RESERVED_ATTRS)
135 self.reserved_attrs = dict(zip(reserved_attrs, reserved_attrs))
135 self.reserved_attrs = dict(list(zip(reserved_attrs, reserved_attrs)))
136 self.timestamp = kwargs.pop("timestamp", True)
136 self.timestamp = kwargs.pop("timestamp", True)
137
137
138 # super(JsonFormatter, self).__init__(*args, **kwargs)
138 # super(JsonFormatter, self).__init__(*args, **kwargs)
@@ -141,8 +141,8 b' class JsonFormatter(ExceptionAwareFormat'
141 self.json_encoder = JsonEncoder
141 self.json_encoder = JsonEncoder
142
142
143 self._required_fields = self.parse()
143 self._required_fields = self.parse()
144 self._skip_fields = dict(zip(self._required_fields,
144 self._skip_fields = dict(list(zip(self._required_fields,
145 self._required_fields))
145 self._required_fields)))
146 self._skip_fields.update(self.reserved_attrs)
146 self._skip_fields.update(self.reserved_attrs)
147
147
148 def _str_to_fn(self, fn_as_str):
148 def _str_to_fn(self, fn_as_str):
@@ -45,7 +45,7 b' class LRUDict(LRUCache):'
45 del self.data[key]
45 del self.data[key]
46
46
47 def keys(self):
47 def keys(self):
48 return self.data.keys()
48 return list(self.data.keys())
49
49
50
50
51 class LRUDictDebug(LRUDict):
51 class LRUDictDebug(LRUDict):
@@ -53,7 +53,7 b' class LRUDictDebug(LRUDict):'
53 Wrapper to provide some debug options
53 Wrapper to provide some debug options
54 """
54 """
55 def _report_keys(self):
55 def _report_keys(self):
56 elems_cnt = '%s/%s' % (len(self.keys()), self.size)
56 elems_cnt = '%s/%s' % (len(list(self.keys())), self.size)
57 # trick for pformat print it more nicely
57 # trick for pformat print it more nicely
58 fmt = '\n'
58 fmt = '\n'
59 for cnt, elem in enumerate(self.keys()):
59 for cnt, elem in enumerate(self.keys()):
@@ -153,7 +153,7 b' class FileNamespaceBackend(PickleSeriali'
153
153
154 with self._dbm_file(True) as dbm:
154 with self._dbm_file(True) as dbm:
155 try:
155 try:
156 return filter(cond, dbm.keys())
156 return list(filter(cond, list(dbm.keys())))
157 except Exception:
157 except Exception:
158 log.error('Failed to fetch DBM keys from DB: %s', self.get_store())
158 log.error('Failed to fetch DBM keys from DB: %s', self.get_store())
159 raise
159 raise
@@ -162,7 +162,7 b' def get_or_create_region(region_name, re'
162 if not region_obj:
162 if not region_obj:
163 raise EnvironmentError(
163 raise EnvironmentError(
164 'Region `{}` not in configured: {}.'.format(
164 'Region `{}` not in configured: {}.'.format(
165 region_name, region_meta.dogpile_cache_regions.keys()))
165 region_name, list(region_meta.dogpile_cache_regions.keys())))
166
166
167 region_uid_name = '{}:{}'.format(region_name, region_namespace)
167 region_uid_name = '{}:{}'.format(region_name, region_namespace)
168 if isinstance(region_obj.actual_backend, FileNamespaceBackend):
168 if isinstance(region_obj.actual_backend, FileNamespaceBackend):
@@ -283,7 +283,7 b' class SvnRemote(RemoteBase):'
283 return _node_properties(repo_id, path, revision)
283 return _node_properties(repo_id, path, revision)
284
284
285 def file_annotate(self, wire, path, revision):
285 def file_annotate(self, wire, path, revision):
286 abs_path = 'file://' + urllib.pathname2url(
286 abs_path = 'file://' + urllib.request.pathname2url(
287 vcspath.join(wire['path'], path))
287 vcspath.join(wire['path'], path))
288 file_uri = svn.core.svn_path_canonicalize(abs_path)
288 file_uri = svn.core.svn_path_canonicalize(abs_path)
289
289
@@ -57,8 +57,8 b' class ContextINI(object):'
57 self.new_path, file_error=True, write_empty_values=True)
57 self.new_path, file_error=True, write_empty_values=True)
58
58
59 for data in self.ini_params:
59 for data in self.ini_params:
60 section, ini_params = data.items()[0]
60 section, ini_params = list(data.items())[0]
61 key, val = ini_params.items()[0]
61 key, val = list(ini_params.items())[0]
62 if section not in config:
62 if section not in config:
63 config[section] = {}
63 config[section] = {}
64 config[section][key] = val
64 config[section][key] = val
@@ -79,7 +79,7 b' class TestGitFetch(object):'
79 mock_fetch.side_effect = side_effect
79 mock_fetch.side_effect = side_effect
80 self.remote_git.pull(
80 self.remote_git.pull(
81 wire={}, url='/tmp/', apply_refs=False,
81 wire={}, url='/tmp/', apply_refs=False,
82 refs=selected_refs.keys())
82 refs=list(selected_refs.keys()))
83 determine_wants = self.mock_repo.object_store.determine_wants_all
83 determine_wants = self.mock_repo.object_store.determine_wants_all
84 assert determine_wants.call_count == 0
84 assert determine_wants.call_count == 0
85
85
@@ -21,7 +21,7 b' from vcsserver.utils import ascii_bytes,'
21
21
22 @pytest.mark.parametrize('given, expected', [
22 @pytest.mark.parametrize('given, expected', [
23 ('a', b'a'),
23 ('a', b'a'),
24 (u'a', b'a'),
24 ('a', b'a'),
25 ])
25 ])
26 def test_ascii_bytes(given, expected):
26 def test_ascii_bytes(given, expected):
27 assert ascii_bytes(given) == expected
27 assert ascii_bytes(given) == expected
@@ -44,9 +44,9 b' def test_ascii_str(given, expected):'
44
44
45
45
46 @pytest.mark.parametrize('given', [
46 @pytest.mark.parametrize('given', [
47 u'a',
47 'a',
48 'å'.encode('utf8'),
48 'å'.encode('utf8'),
49 u'å'
49 'å'
50 ])
50 ])
51 def test_ascii_str_raises(given):
51 def test_ascii_str_raises(given):
52 with pytest.raises(ValueError):
52 with pytest.raises(ValueError):
General Comments 0
You need to be logged in to leave comments. Login now