Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xen-bugtool/make_inventory(): Py3: Update tuple lambda to for loop #21

Commits on Nov 6, 2023

  1. xen-bugtool/make_inventory(): Py3: Update tuple lambda to for loop

    Update this code to also work with Python3:
    
    The syntax for tuple parameters in lambda functions has been
    removed in Python3 and must be replaced:
    
    This code iterates over the inventory dictionary using the items()
    method and unpacks each key-value pair into k and v. Then, it calls
    the inventory_entry() function with the appropriate arguments.
    
    In general, map() is useful when you want to apply a function
    to every item of an iterable and return a list of the results.
    
    However, if you only need to iterate over the items of an iterable
    and perform some operation on each item, a for loop is often more
    readable and concise than using map().
    
    Replacing such map() loops with a for loop has already been established
    with the recently merged equivalent Python3 commit for xsconsole.
    
    The functionality of this code is already tested by each of the test
    cases in tests/integration/ as all of them validate the contents and
    XML schema of bugtool-output/inventory.xml
    
    Signed-off-by: Bernhard Kaindl <bernhard.kaindl@cloud.com>
    Bernhard Kaindl committed Nov 6, 2023
    Configuration menu
    Copy the full SHA
    aef3a07 View commit details
    Browse the repository at this point in the history