Re: [PATCH v2 10/11] tools/kvm_stat: sort '-f help' output

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 11.12.2017 13:20, Janosch Frank wrote:
> On 11.12.2017 12:25, Stefan Raspl wrote:
>> From: Stefan Raspl <stefan.raspl@xxxxxxxxxx>
>>
>> Sort the fields returned by specifying '-f help' on the command line.
>> While at it, simplify the code a bit, indent the output and eliminate an
>> extra blank line at the beginning.
>>
>> Signed-off-by: Stefan Raspl <raspl@xxxxxxxxxxxxxxxxxx>
>> ---
>>  tools/kvm/kvm_stat/kvm_stat | 18 ++++++++----------
>>  1 file changed, 8 insertions(+), 10 deletions(-)
>>
>> diff --git a/tools/kvm/kvm_stat/kvm_stat b/tools/kvm/kvm_stat/kvm_stat
>> index 42c34b8818f7..929c8379d82a 100755
>> --- a/tools/kvm/kvm_stat/kvm_stat
>> +++ b/tools/kvm/kvm_stat/kvm_stat
>> @@ -33,6 +33,7 @@ import resource
>>  import struct
>>  import re
>>  import subprocess
>> +from sets import Set
> 
> What's the reason for this import, shouldn't set be built in from at
> least 2.7 on? It even seems to be 2.4. The module should be deprecated
> from 2.6 on.

without that line:
$ python --version
Python 2.7.12
$ ./kvm_stat -f help
Traceback (most recent call last):
  File "./kvm_stat", line 1600, in <module>
    main()
  File "./kvm_stat", line 1588, in main
    sys.stdout.write('  ' + '\n  '.join(sorted(Set(event_list))) + '\n')
NameError: global name 'Set' is not defined
>> +        event_list.sort()
>> +        sys.stdout.write('  ' + '\n  '.join(sorted(Set(event_list))) + '\n')
> 
> You just sorted the list, why do you need a set and why do you sort it
> again?

Oooops - my bad, we can drop the first sort.

Thx!




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux