Skip to content

Commit 775d234

Browse files
Removing linter warnings
1 parent 1c83111 commit 775d234

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

mbed/mbed.py

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ def remove_readonly(func, path, _):
303303
shutil.rmtree(directory, onerror=remove_readonly)
304304

305305
def sizeof_fmt(num, suffix='B'):
306-
for unit in ['','K','M','G','T','P','E','Z']:
306+
for unit in ['', 'K', 'M', 'G', 'T', 'P', 'E', 'Z']:
307307
if abs(num) < 1024.0:
308308
return "%3.1f%s%s" % (num, unit, suffix)
309309
num /= 1024.0
@@ -1454,7 +1454,7 @@ def cache_lock(self, url):
14541454
## Linux: <type 'exceptions.OSError'> 17 [Errno 17] File exists: 'testing'
14551455
## or when concurrent & virtualbox 71, OSError(71, 'Protocol error')
14561456
## or when full: 28, OSError(28, 'No space left on device')
1457-
if e.errno in (17,13,71,28):
1457+
if e.errno in (17, 13, 71, 28):
14581458
continue
14591459
else:
14601460
raise e
@@ -1984,8 +1984,10 @@ def formaturl(url, format="default"):
19841984
url = 'https://%s%s%s/%s' % (m.group(2) or '', m.group(6), m.group(8) or '', m.group(9))
19851985
else:
19861986
m = re.match(regex_repo_url, url)
1987-
if m and m.group(1) == '': # no protocol specified, probably ssh string like "[email protected]:ARMmbed/mbed-os.git"
1988-
url = 'ssh://%s%s%s/%s' % (m.group(2) or 'git@', m.group(6), m.group(7) or '', m.group(8)) # convert to common ssh URL-like format
1987+
if m and m.group(1) == '':
1988+
# No protocol specified, probably ssh string like "[email protected]:ARMmbed/mbed-os.git"
1989+
# convert to common ssh URL-like format
1990+
url = 'ssh://%s%s%s/%s' % (m.group(2) or 'git@', m.group(6), m.group(7) or '', m.group(8))
19891991
m = re.match(regex_repo_url, url)
19901992

19911993
if m:
@@ -1997,20 +1999,24 @@ def formaturl(url, format="default"):
19971999
url = 'https://%s%s%s/%s' % (m.group(2) if (m.group(2) and (m.group(5) or m.group(3) != 'git')) else '', m.group(6), m.group(7) or '', m.group(8))
19982000
return url
19992001

2000-
# Wrapper for the MbedTermnal functionality
2002+
2003+
# Wrapper for the MbedTerminal functionality
20012004
def mbed_sterm(port, baudrate=9600, echo=True, reset=False, sterm=False):
20022005
try:
20032006
from .mbed_terminal import MbedTerminal
2004-
except(ValueError): # relative import fails on Python 2 in non-package mode
2007+
except ValueError: # relative import fails on Python 2 in non-package mode
20052008
from mbed_terminal import MbedTerminal
20062009
except (IOError, ImportError, OSError):
2007-
error("The serial terminal functionality requires that the 'mbed-terminal' python module is installed.\nYou can install mbed-terminal by running 'pip install mbed-terminal'.", 1)
2010+
error("The serial terminal functionality requires that the 'mbed-terminal' python module is installed.\n"
2011+
"You can install mbed-terminal by running 'pip install mbed-terminal'.", 1)
20082012

20092013
mbed_serial = MbedTerminal(port, baudrate=baudrate, echo=echo)
20102014
if mbed_serial.serial:
20112015
if reset:
20122016
if not mbed_serial.reset():
2013-
error("Unable to reset the target board connected to your system.\nThis might be caused by an old interface firmware.\nPlease check the board page for new firmware.", 1)
2017+
error("Unable to reset the target board connected to your system.\n"
2018+
"This might be caused by an old interface firmware.\n"
2019+
"Please check the board page for new firmware.", 1)
20142020
if sterm:
20152021
# Some boards will reset the COM port after SendBreak, e.g. STLink based
20162022
if not mbed_serial.serial.is_open:

0 commit comments

Comments
 (0)