VirtualBox

Ignore:
Timestamp:
Nov 24, 2022 11:46:15 AM (2 years ago)
Author:
vboxsync
Message:

Validation Kit: Fixed lots of warnings, based on pylint 2.12.2.

Location:
trunk/src/VBox/ValidationKit/common
Files:
2 edited

Legend:

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

    r97672 r97673  
    224224        try:
    225225            # try /etc/lsb-release first to distinguish between Debian and Ubuntu
    226             with open('/etc/lsb-release') as oFile:
     226            with open('/etc/lsb-release') as oFile: # pylint: disable=unspecified-encoding
    227227                for sLine in oFile:
    228228                    oMatch = re.search(r'(?:DISTRIB_DESCRIPTION\s*=)\s*"*(.*)"', sLine);
     
    245245                if os.path.isfile(sFile):
    246246                    try:
    247                         with open(sFile) as oFile:
     247                        with open(sFile) as oFile: # pylint: disable=unspecified-encoding
    248248                            sLine = oFile.readline();
    249249                    except:
     
    258258        if os.path.isfile('/etc/release'):
    259259            try:
    260                 with open('/etc/release') as oFile:
     260                with open('/etc/release') as oFile: # pylint: disable=unspecified-encoding
    261261                    sLast = oFile.readlines()[-1];
    262262                sLast = sLast.strip();
     
    387387    uPythonVer = (sys.version_info[0] << 16) | (sys.version_info[1] & 0xffff);
    388388    if uPythonVer >= ((3 << 16) | 4):
    389         oFile = open(sFile, sMode);                             # pylint: disable=consider-using-with
     389        oFile = open(sFile, sMode);                             # pylint: disable=consider-using-with,unspecified-encoding
    390390    else:
    391391        try:
     
    397397                    offComma = sMode.find(',');
    398398                    if offComma < 0:
    399                         return open(sFile, sMode + 'N');        # pylint: disable=consider-using-with
    400                     return open(sFile,                          # pylint: disable=consider-using-with,bad-open-mode
     399                        return open(sFile, sMode + 'N');        # pylint: disable=consider-using-with,unspecified-encoding
     400                    return open(sFile,                          # pylint: disable=consider-using-with,unspecified-encoding,bad-open-mode
    401401                                sMode[:offComma] + 'N' + sMode[offComma:]);
    402402
    403403            # Just in case.
    404             return open(sFile, sMode);                          # pylint: disable=consider-using-with
    405 
    406         oFile = open(sFile, sMode);                             # pylint: disable=consider-using-with
     404            return open(sFile, sMode);                          # pylint: disable=consider-using-with,unspecified-encoding
     405
     406        oFile = open(sFile, sMode);                             # pylint: disable=consider-using-with,unspecified-encoding
    407407        #try:
    408408        fcntl(oFile, F_SETFD, fcntl(oFile, F_GETFD) | FD_CLOEXEC);
     
    464464        oFile = os.fdopen(fdFile, sMode);
    465465    else:
    466         oFile = open(sFile, sMode);                                     # pylint: disable=consider-using-with
     466        oFile = open(sFile, sMode);                                     # pylint: disable=consider-using-with,unspecified-encoding
    467467
    468468        # Python 3.4 and later automatically creates non-inherit handles. See PEP-0446.
     
    493493    Reads the entire file.
    494494    """
    495     with open(sFile, sMode) as oFile:
     495    with open(sFile, sMode) as oFile: # pylint: disable=unspecified-encoding
    496496        sRet = oFile.read();
    497497    return sRet;
     
    10201020            if oXcpt.winerror == winerror.ERROR_ACCESS_DENIED:
    10211021                fRc = True;
    1022         except Exception as oXcpt:
     1022        except:
    10231023            pass;
    10241024        else:
     
    13811381                sFull = os.path.join(sDir, sEntry);
    13821382                try:
    1383                     with open(sFull, 'r') as oFile:
     1383                    with open(sFull, 'r') as oFile: # pylint: disable=unspecified-encoding
    13841384                        sFirstLine = oFile.readline();
    13851385                except:
     
    24872487
    24882488    uCrc32 = 0;
    2489     with open(sFile, 'rb') as oFile:
     2489    with open(sFile, 'rb') as oFile: # pylint: disable=unspecified-encoding
    24902490        while True:
    24912491            oBuf = oFile.read(1024 * 1024);
  • trunk/src/VBox/ValidationKit/common/webutils.py

    r96407 r97673  
    173173                oOpener = urllib_build_opener();
    174174            else:
    175                 oOpener = urllib_build_opener(urllib_ProxyHandler(proxies = dict()));
     175                oOpener = urllib_build_opener(urllib_ProxyHandler(proxies = {} ));
    176176            oSrc = oOpener.open(sUrlFile);
    177177            oDst = utils.openNoInherit(sDstFile, 'wb');
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