Changeset 97673 in vbox for trunk/src/VBox/ValidationKit/common
- Timestamp:
- Nov 24, 2022 11:46:15 AM (2 years ago)
- Location:
- trunk/src/VBox/ValidationKit/common
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/common/utils.py
r97672 r97673 224 224 try: 225 225 # 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 227 227 for sLine in oFile: 228 228 oMatch = re.search(r'(?:DISTRIB_DESCRIPTION\s*=)\s*"*(.*)"', sLine); … … 245 245 if os.path.isfile(sFile): 246 246 try: 247 with open(sFile) as oFile: 247 with open(sFile) as oFile: # pylint: disable=unspecified-encoding 248 248 sLine = oFile.readline(); 249 249 except: … … 258 258 if os.path.isfile('/etc/release'): 259 259 try: 260 with open('/etc/release') as oFile: 260 with open('/etc/release') as oFile: # pylint: disable=unspecified-encoding 261 261 sLast = oFile.readlines()[-1]; 262 262 sLast = sLast.strip(); … … 387 387 uPythonVer = (sys.version_info[0] << 16) | (sys.version_info[1] & 0xffff); 388 388 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 390 390 else: 391 391 try: … … 397 397 offComma = sMode.find(','); 398 398 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-mode399 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 401 401 sMode[:offComma] + 'N' + sMode[offComma:]); 402 402 403 403 # 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 407 407 #try: 408 408 fcntl(oFile, F_SETFD, fcntl(oFile, F_GETFD) | FD_CLOEXEC); … … 464 464 oFile = os.fdopen(fdFile, sMode); 465 465 else: 466 oFile = open(sFile, sMode); # pylint: disable=consider-using-with 466 oFile = open(sFile, sMode); # pylint: disable=consider-using-with,unspecified-encoding 467 467 468 468 # Python 3.4 and later automatically creates non-inherit handles. See PEP-0446. … … 493 493 Reads the entire file. 494 494 """ 495 with open(sFile, sMode) as oFile: 495 with open(sFile, sMode) as oFile: # pylint: disable=unspecified-encoding 496 496 sRet = oFile.read(); 497 497 return sRet; … … 1020 1020 if oXcpt.winerror == winerror.ERROR_ACCESS_DENIED: 1021 1021 fRc = True; 1022 except Exception as oXcpt:1022 except: 1023 1023 pass; 1024 1024 else: … … 1381 1381 sFull = os.path.join(sDir, sEntry); 1382 1382 try: 1383 with open(sFull, 'r') as oFile: 1383 with open(sFull, 'r') as oFile: # pylint: disable=unspecified-encoding 1384 1384 sFirstLine = oFile.readline(); 1385 1385 except: … … 2487 2487 2488 2488 uCrc32 = 0; 2489 with open(sFile, 'rb') as oFile: 2489 with open(sFile, 'rb') as oFile: # pylint: disable=unspecified-encoding 2490 2490 while True: 2491 2491 oBuf = oFile.read(1024 * 1024); -
trunk/src/VBox/ValidationKit/common/webutils.py
r96407 r97673 173 173 oOpener = urllib_build_opener(); 174 174 else: 175 oOpener = urllib_build_opener(urllib_ProxyHandler(proxies = dict()));175 oOpener = urllib_build_opener(urllib_ProxyHandler(proxies = {} )); 176 176 oSrc = oOpener.open(sUrlFile); 177 177 oDst = utils.openNoInherit(sDstFile, 'wb');
Note:
See TracChangeset
for help on using the changeset viewer.