Bug 1547730 - Do six.itervalues instead of dict.itervalues r=glandium

Differential Revision: https://phabricator.services.mozilla.com/D28104

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Justin Wood 2019-05-28 14:23:54 +00:00
Родитель df3ad8c98b
Коммит ac0c66355b
3 изменённых файлов: 9 добавлений и 9 удалений

Просмотреть файл

@ -435,7 +435,7 @@ class ConfigureSandbox(dict):
if path: if path:
self.include_file(path) self.include_file(path)
for option in self._options.itervalues(): for option in six.itervalues(self._options):
# All options must be referenced by some @depends function # All options must be referenced by some @depends function
if option not in self._seen: if option not in self._seen:
raise ConfigureError( raise ConfigureError(

Просмотреть файл

@ -519,5 +519,5 @@ class CommandLineHelper(object):
def __iter__(self): def __iter__(self):
for d in (self._args, self._extra_args): for d in (self._args, self._extra_args):
for arg, pos in d.itervalues(): for arg, pos in six.itervalues(d):
yield arg yield arg

Просмотреть файл

@ -75,7 +75,7 @@ class JarStruct(object):
an instance with empty fields. an instance with empty fields.
''' '''
assert self.MAGIC and isinstance(self.STRUCT, OrderedDict) assert self.MAGIC and isinstance(self.STRUCT, OrderedDict)
self.size_fields = set(t for t in self.STRUCT.itervalues() self.size_fields = set(t for t in six.itervalues(self.STRUCT)
if t not in JarStruct.TYPE_MAPPING) if t not in JarStruct.TYPE_MAPPING)
self._values = {} self._values = {}
if data: if data:
@ -381,7 +381,7 @@ class JarReader(object):
entries = self.entries entries = self.entries
if not entries: if not entries:
return JAR_STORED return JAR_STORED
return max(f['compression'] for f in entries.itervalues()) return max(f['compression'] for f in six.itervalues(entries))
@property @property
def entries(self): def entries(self):
@ -459,7 +459,7 @@ class JarReader(object):
for file in jarReader: for file in jarReader:
... ...
''' '''
for entry in self.entries.itervalues(): for entry in six.itervalues(self.entries):
yield self._getreader(entry) yield self._getreader(entry)
def __getitem__(self, name): def __getitem__(self, name):
@ -553,7 +553,7 @@ class JarWriter(object):
headers = {} headers = {}
preload_size = 0 preload_size = 0
# Prepare central directory entries # Prepare central directory entries
for entry, content in self._contents.itervalues(): for entry, content in six.itervalues(self._contents):
header = JarLocalFileHeader() header = JarLocalFileHeader()
for name in entry.STRUCT: for name in entry.STRUCT:
if name in header: if name in header:
@ -576,18 +576,18 @@ class JarWriter(object):
offset = end['cdir_size'] + end['cdir_offset'] + end.size offset = end['cdir_size'] + end['cdir_offset'] + end.size
preload_size += offset preload_size += offset
self._data.write(struct.pack('<I', preload_size)) self._data.write(struct.pack('<I', preload_size))
for entry, _ in self._contents.itervalues(): for entry, _ in six.itervalues(self._contents):
entry['offset'] += offset entry['offset'] += offset
self._data.write(entry.serialize()) self._data.write(entry.serialize())
self._data.write(end.serialize()) self._data.write(end.serialize())
# Store local file entries followed by compressed data # Store local file entries followed by compressed data
for entry, content in self._contents.itervalues(): for entry, content in six.itervalues(self._contents):
self._data.write(headers[entry].serialize()) self._data.write(headers[entry].serialize())
self._data.write(content) self._data.write(content)
# On non optimized archives, store the central directory entries. # On non optimized archives, store the central directory entries.
if not preload_size: if not preload_size:
end['cdir_offset'] = offset end['cdir_offset'] = offset
for entry, _ in self._contents.itervalues(): for entry, _ in six.itervalues(self._contents):
self._data.write(entry.serialize()) self._data.write(entry.serialize())
# Store the end of central directory. # Store the end of central directory.
self._data.write(end.serialize()) self._data.write(end.serialize())