VirtualBox

Ignore:
Timestamp:
Mar 7, 2017 1:00:36 PM (8 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
113806
Message:

testmanager/core: pylint 2.0.0 fixes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/testmanager/core/base.py

    r65214 r65980  
    233233        # Perform deep conversion on ModelDataBase object and lists of them.
    234234        #
    235         elif isinstance(oValue, list) and len(oValue) > 0 and isinstance(oValue[0], ModelDataBase):
     235        elif isinstance(oValue, list) and oValue and isinstance(oValue[0], ModelDataBase):
    236236            oValue = copy.copy(oValue);
    237237            for i, _ in enumerate(oValue):
     
    269269        # Perform deep conversion on ModelDataBase object and lists of them.
    270270        #
    271         elif isinstance(oValue, list) and len(oValue) > 0 and isinstance(oValue[0], ModelDataBase):
     271        elif isinstance(oValue, list) and oValue and isinstance(oValue[0], ModelDataBase):
    272272            oValue = copy.copy(oValue);
    273273            for i, _ in enumerate(oValue):
     
    316316                                                    lMax = getattr(self, 'klMax_' + sAttr, None));
    317317        elif sPrefix == 'f':
    318             if oValue is '' and not fAllowNull: oValue = '0'; # HACK ALERT! Checkboxes are only added when checked.
     318            if not oValue and not fAllowNull: oValue = '0'; # HACK ALERT! Checkboxes are only added when checked.
    319319            (oNewValue, sError) = self.validateBool(oValue, aoNilValues = aoNilValues, fAllowNull = fAllowNull);
    320320        elif sPrefix == 'ts':
     
    743743    def validateListOfSomething(asValues, aoNilValues = tuple([[], None]), fAllowNull = True):
    744744        """ Validate a list of some uniform values. Returns a copy of the list (if list it is). """
    745         if asValues in aoNilValues  or  (len(asValues) == 0 and not fAllowNull):
     745        if asValues in aoNilValues  or  (not asValues and not fAllowNull):
    746746            return (asValues, None if fAllowNull else 'Mandatory.')
    747747
     
    750750
    751751        asValues = list(asValues); # copy the list.
    752         if len(asValues) > 0:
     752        if asValues:
    753753            oType = type(asValues[0]);
    754754            for i in range(1, len(asValues)):
     
    764764        (asValues, sError) = ModelDataBase.validateListOfSomething(asValues, aoNilValues, fAllowNull);
    765765
    766         if sError is None  and asValues not in aoNilValues  and  len(asValues) > 0:
     766        if sError is None  and  asValues not in aoNilValues  and  asValues:
    767767            if not utils.isString(asValues[0]):
    768768                return (asValues, 'Invalid item data type.');
     
    793793        (asValues, sError) = ModelDataBase.validateListOfSomething(asValues, aoNilValues, fAllowNull);
    794794
    795         if sError is None  and asValues not in aoNilValues  and  len(asValues) > 0:
     795        if sError is None  and  asValues not in aoNilValues  and  asValues:
    796796            for i, _ in enumerate(asValues):
    797797                sValue = asValues[i];
     
    10891089
    10901090    def testNullConversion(self):
    1091         if len(self.aoSamples[0].getDataAttributes()) == 0:
     1091        if not self.aoSamples[0].getDataAttributes():
    10921092            return;
    10931093        for oSample in self.aoSamples:
     
    12611261        else:
    12621262            assert False;
    1263         if len(oCriterion.aoSelected) > 0:
     1263        if oCriterion.aoSelected:
    12641264            oCriterion.sState = FilterCriterion.ksState_Selected;
    12651265        else:
Note: See TracChangeset for help on using the changeset viewer.

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