Hello,
as announced a long time ago with
<
https://www.redhat.com/archives/libvir-list/2018-November/msg00291.html>
and recently refreshed with
<
https://www.redhat.com/archives/libvir-list/2020-April/msg00892.html>
I'm working on adding PEP 484 type hints
<
https://www.python.org/dev/peps/pep-0484/> to the Python binding of
libvirt.
I have finished this work now and have a working version at
<
https://github.com/univention/libvirt-python/tree/typing> which
consists of 90 patches in total as I has to go over evry file to
understand and fix all things.
As that patch bomb is quiet large I'm going to submit them in smaller
chunks to make them more reviewable. Today I start with the first round
consisting of "real" bugs in the current code:
Philipp Hahn (5):
generator: Fix undefined variables file
generator: Fix string formatting
generator: Fix domainSnapshot.listAllChildren()
qemu-api: Fix return type
libvirtaio: Fix return types of callback
generator.py | 6 +++---
libvirt-override-virDomainSnapshot.py | 2 +-
libvirt-qemu-override-api.xml | 4 ++--
libvirtaio.py | 18 ++++++++++++------
4 files changed, 18 insertions(+), 12 deletions(-)
After that I plan to continue with:
2. fix examples/ to work with Python 3
3. Cleanup code tree-wide
4. Cleanup generator.py
5. Cleanup sanitytest.py
6. Teach generator.py to add PEP 484 annotation
7. Assorted cleanups
(the order and chunking is not final yet)
examples/domipaddrs: Convert to python 3 print()
examples/domipaddrs: Fix Python 2 dict.iteritems()
examples/*: Remove stray semicolon
example/dhcp*: Fix None comparison
examples/event-test: Remove unneeded global statement
examples/event-test: Work with old version of python-libvirt
examples/event-test: Use atexit for Python 3
examples/esxlist: Fix Python 2 raw_input()
examples/consolecallback: Add var to save callback
examples/consolecallback: Fix assorted errors
examples: Add missing return values
libvirtaio: Drop object(*args, **kwargs)
libvirtaio: Fix return type
libvirtaio: assert callback type
Do not use bare except
Cleanup imports
Fix white space
Remove legacy libvirtError arguments
stream: Fix exception traceback handling
override: Simplify exception handling
generator: Simplify exception handling
generator: Change type of quiet to bool
generator: Remove unneeded line continuation
generator: Convert to 'not in' and 'is not'
generator: Remove dead variable assignments
generator: Remove skipped_modules
generator: Remove useless sort key
generator: Fix return type on failure
generator: Merge now identical if-elif-else cases
generator: Use more string formatting
generator: Simplify string concatentaion
generator: Use enumerate()
generator: Use increment assignment
generator: Use string concatenation
generator: Remove global declarations
generator: Initialize function_classes directly
generator: Check contained in hash
generator: Use dict.item() to walk keys and values
generator: Walk only the values
generator: Directly get dict length
generator: Just walk the dict
generator: Use splitlines()
generator: Open file with context manager
generator: Refactor parser creation
generator: Remove unused SAX content handler methods
generator: Use SAX method names
generator: Use string formatting
generator: Convert in_function to boolean
generator: Simplify XML attribute fetching
generator: Initialize with empty strings
generator: Expand tuple to names in for loop
generator: Store arguments and return as tuple
generator: Fixed writing cached=None
generator: Simplify sorting
generator: Simplify loop break
generator: Simplify boolean condition
generator: Convert dict() to set()
generator: Converto to defaultdict()
generator: Add PEP 484 type annotations
override: Add manual PEP 484 type annotations
sanitytest: Skip type annotations
stream: Simplify boolean condition
domain: Fix None comparison
stream: no type change
stream: Convert type() to isinstance()
stream: Return None from callback
connect: Just clear all event handlers
override: no type change
sanitytest: Do not re-declare set
sanitytest: Drop else:pass
sanitytest: Drop Python 2 compatibility
sanitytest: Add PEP 484 type annotations
sanitytest: Use 3-tuple for basicklassmap
sanitytest: Use 3-tuple for finalklassmap
sanitytest: Use set for tracking used functions
sanitytest: Use str.startswith() instead of str[0]
generator: Generate PEP 484 type annotation
override: Catch type error
generator: Special handling for virStoragePool.listAllVolumes
generator: Merge code for __init__ genration
generator: Use empty string instead of None
generator: break lines in generated code
generator: Expand tuple to names in for loop
generator: Work around type change
generator: use pointer wrapper for all objects
examples: Add/fix PEP 484 type annotation
--
2.20.1