[PATCH 08/10] DNFPayload: initial version.
Ales Kozumplik
akozumpl at redhat.com
Tue Aug 20 11:59:11 UTC 2013
On 08/19/2013 06:00 PM, Vratislav Podzimek wrote:
>> >+ @property
>> >+ def spaceRequired(self):
>> >+ if self._base.transaction is None:
>> >+ return Size(spec="3000 MB")
>> >+
>> >+ installed_sizes = [tsi.installed.installsize \
>> >+ for tsi in self._base.transaction]
>> >+ size = reduce(operator.add, installed_sizes)
> Why not use 'sum(installed_sizes)'? Or you could use generator
> expression and this:
>
> size = sum(tsi.installed.installsize for tsi in self._base.transaction)
>
> Or use the temporary variable, but make it a generator by using
> parentheses instead of square brackets. In either case, the backslash is
> not needed since the newline is inside the brackets.
Hi,
thanks for looking at the patches.
Does this look better?
@property
def spaceRequired(self):
transaction = self._base.transaction
if transaction is None:
return Size(spec="3000 MB")
size = sum(tsi.installed.installsize for tsi in transaction)
# add 35% to account for the fact that the above method is
laughably
# inaccurate:
size *= 1.35
return Size(size)
Ales
More information about the anaconda-patches
mailing list