VirtualBox

Ignore:
Timestamp:
Feb 20, 2023 12:55:13 PM (22 months ago)
Author:
vboxsync
Message:

ValKit/utils.py,tdUnitTest1.py: Added iteritems() wrapper to utils and use it to iterate keys+values of dictionaries.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/common/utils.py

    r98103 r98648  
    7474    xrange = range; # pylint: disable=redefined-builtin,invalid-name
    7575    long = int;     # pylint: disable=redefined-builtin,invalid-name
     76
     77
     78#
     79# Python 2/3 glue.
     80#
     81
     82if sys.version_info[0] >= 3:
     83    def iteritems(dDict):
     84        """
     85        Wrapper around dict.items() / dict.iteritems().
     86        """
     87        return iter(dDict.items());
     88else:
     89    def iteritems(dDict):
     90        """
     91        Wrapper around dict.items() / dict.iteritems().
     92        """
     93        return dDict.iteritems();
    7694
    7795
     
    22672285    # 20%+ speedup for python 2.7 and 15%+ speedup for python 3.5, both on windows skipping PDBs.
    22682286    #
    2269     if True is True: # pylint: disable=comparison-with-itself
     2287    if True is True: # pylint: disable=comparison-with-itself,comparison-of-constants
    22702288        __installShUtilHacks(shutil);
    22712289        global g_fTarCopyFileObjOverriddend;
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette