[libvirt] [PATCH 00/22] Python tweaks

Radostin Stoyanov posted 22 patches 6 years, 1 month ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20180317142340.11653-1-rstoyanov1@gmail.com
Test syntax-check passed
docs/apibuild.py                   | 643 +++++++++++++++++--------------------
docs/index.py                      |  54 ++--
src/esx/esx_vi_generator.py        | 179 +++++------
src/hyperv/hyperv_wmi_generator.py |  36 ++-
tests/cputestdata/cpu-cpuid.py     |   6 +-
tests/cputestdata/cpu-reformat.py  |   6 +-
6 files changed, 424 insertions(+), 500 deletions(-)
[libvirt] [PATCH 00/22] Python tweaks
Posted by Radostin Stoyanov 6 years, 1 month ago
These patches improve the code style of python code
by applying some PEP8 recommendations and simplifying
some functions.

Radostin Stoyanov (22):
  apibuild: Use isinctance for type checking
  apibuild: Split imports on separate lines
  apibuild: Remove whitespace before ',' and ':'
  python: Add whitespace around = and % operators
  esx_vi_generator: Simplify generate_helper_source
  esx_vi_generator: Simplify generate_helper_header
  esx_vi_generator: Simplify get_occurrence_comment
  esx_vi_generator: Simplify alignment function
  apibuild: Simplify conditional statements
  python: Remove space around = in keyword args
  WmiClass: Don't share "versions" between instances
  apibuild: Simplify uniq function
  apibuild: Avoid double sorting of ids
  python3: cpu-reformat: Use the print() function
  apibuild: Drop backslash between brackets
  apibuild: Fix indentation not multiple of 4
  apibuild: Simplify strip_lead_star()
  apibuild: Simplify parseTypeComment()
  apibuild: Simplify type checking of literals
  apibuild: Use list comprehension insteand of map
  apibuild: Simplify merging of preproc tokens
  apibuild: Simplify parsing string tokens

 docs/apibuild.py                   | 643 +++++++++++++++++--------------------
 docs/index.py                      |  54 ++--
 src/esx/esx_vi_generator.py        | 179 +++++------
 src/hyperv/hyperv_wmi_generator.py |  36 ++-
 tests/cputestdata/cpu-cpuid.py     |   6 +-
 tests/cputestdata/cpu-reformat.py  |   6 +-
 6 files changed, 424 insertions(+), 500 deletions(-)

-- 
2.14.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 00/22] Python tweaks
Posted by Daniel P. Berrangé 6 years, 1 month ago
On Sat, Mar 17, 2018 at 02:23:18PM +0000, Radostin Stoyanov wrote:
> These patches improve the code style of python code
> by applying some PEP8 recommendations and simplifying
> some functions.

How did you identify all the places that needed fixing ? I'm assuming you
were running via some automated tool. If so this series ought to ensure
that the tool is run as part of "make syntax-check", so that we don't
reintroduce the problems later.


Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 00/22] Python tweaks
Posted by Daniel P. Berrangé 6 years, 1 month ago
On Mon, Mar 19, 2018 at 10:36:28AM +0000, Daniel P. Berrangé wrote:
> On Sat, Mar 17, 2018 at 02:23:18PM +0000, Radostin Stoyanov wrote:
> > These patches improve the code style of python code
> > by applying some PEP8 recommendations and simplifying
> > some functions.
> 
> How did you identify all the places that needed fixing ? I'm assuming you
> were running via some automated tool. If so this series ought to ensure
> that the tool is run as part of "make syntax-check", so that we don't
> reintroduce the problems later.

Also, did you check whether the generated files are byte-for-byte identical
before & after applying this patch series, under both py2 & py3 ?


Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 00/22] Python tweaks
Posted by Radostin Stoyanov 6 years, 1 month ago

On 19/03/18 11:03, Daniel P. Berrangé wrote:
> On Mon, Mar 19, 2018 at 10:36:28AM +0000, Daniel P. Berrangé wrote:
>> On Sat, Mar 17, 2018 at 02:23:18PM +0000, Radostin Stoyanov wrote:
>>> These patches improve the code style of python code
>>> by applying some PEP8 recommendations and simplifying
>>> some functions.
>> How did you identify all the places that needed fixing ? I'm assuming you
>> were running via some automated tool. If so this series ought to ensure
>> that the tool is run as part of "make syntax-check", so that we don't
>> reintroduce the problems later.
I found the PEP8 places that needed fixing with pylint/pycodestyle and
while fixing them I noticed some other places that could have been
optimised.

> Also, did you check whether the generated files are byte-for-byte identical
> before & after applying this patch series, under both py2 & py3 ?
>
I checked the output of apibuild.py with:

cd docs/

Then

srcdir=. builddir=. /usr/bin/python2 ./apibuild.py; sha1sum *.xml | sha1sum

and

srcdir=. builddir=. /usr/bin/python3 ./apibuild.py; sha1sum *.xml | sha1sum

Before and after applying the patches both commands returned the same
hashsum (b068fa56c132fca35ba24302e0a394aa9f03be97) .
> Regards,
> Daniel
Radostin

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list