forked from platformio/platformio-core
YAPF
This commit is contained in:
@ -71,18 +71,18 @@ class FileDownloader(object):
|
||||
return int(self._request.headers['content-length'])
|
||||
|
||||
def start(self):
|
||||
label = "Downloading"
|
||||
itercontent = self._request.iter_content(chunk_size=self.CHUNK_SIZE)
|
||||
f = open(self._destination, "wb")
|
||||
try:
|
||||
if app.is_disabled_progressbar() or self.get_size() == -1:
|
||||
click.echo("Downloading...")
|
||||
click.echo("%s..." % label)
|
||||
for chunk in itercontent:
|
||||
if chunk:
|
||||
f.write(chunk)
|
||||
else:
|
||||
chunks = int(ceil(self.get_size() / float(self.CHUNK_SIZE)))
|
||||
with click.progressbar(
|
||||
length=chunks, label="Downloading") as pb:
|
||||
with click.progressbar(length=chunks, label=label) as pb:
|
||||
for _ in pb:
|
||||
f.write(next(itercontent))
|
||||
except IOError as e:
|
||||
|
@ -315,8 +315,9 @@ def on_event(category, action, label=None, value=None, screen_name=None):
|
||||
def on_exception(e):
|
||||
skip_conditions = [
|
||||
isinstance(e, cls)
|
||||
for cls in (IOError, exception.AbortedByUser,
|
||||
exception.NotGlobalLibDir, exception.InternetIsOffline,
|
||||
for cls in (IOError, exception.ReturnErrorCode,
|
||||
exception.AbortedByUser, exception.NotGlobalLibDir,
|
||||
exception.InternetIsOffline,
|
||||
exception.NotPlatformIOProject,
|
||||
exception.UserSideException)
|
||||
]
|
||||
|
@ -13,9 +13,10 @@
|
||||
# limitations under the License.
|
||||
|
||||
import requests
|
||||
|
||||
from platformio import util
|
||||
|
||||
|
||||
def test_ping_internet_ips():
|
||||
for ip in util.PING_INTERNET_IPS:
|
||||
requests.get("http://%s" % ip, timeout=2)
|
||||
requests.get("http://%s" % ip, timeout=2)
|
||||
|
Reference in New Issue
Block a user