Skip to content

Commit

Permalink
Reformatted files using black
Browse files Browse the repository at this point in the history
Believe it is causing issues with getting CI to pass
  • Loading branch information
addisonElliott committed Sep 30, 2018
1 parent 9b09977 commit dd2906d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion imageio/core/fetching.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def _fetch_file(url, file_name, print_destination=True):
for tries in range(4):
try:
# Checking file size and displaying it alongside the download url
remote_file = urlopen(url, timeout=5.)
remote_file = urlopen(url, timeout=5.0)
file_size = int(remote_file.headers["Content-Length"].strip())
size_str = _sizeof_fmt(file_size)
print("Try %i. Download from %s (%s)" % (tries + 1, url, size_str))
Expand Down
8 changes: 6 additions & 2 deletions imageio/plugins/ffmpeg.py
Original file line number Diff line number Diff line change
Expand Up @@ -563,12 +563,16 @@ def _load_infos(self):
if self.request._video:
ffmpeg_err = (
"FFMPEG STDERR OUTPUT:\n"
+ self._stderr_catcher.get_text(.1)
+ self._stderr_catcher.get_text(0.1)
+ "\n"
)
if "darwin" in sys.platform:
if "Unknown input format: 'avfoundation'" in ffmpeg_err:
ffmpeg_err += "Try installing FFMPEG using " "home brew to get a version with " "support for cameras."
ffmpeg_err += (
"Try installing FFMPEG using "
"home brew to get a version with "
"support for cameras."
)
raise IndexError(
"No video4linux camera at %s.\n\n%s"
% (self.request._video, ffmpeg_err)
Expand Down
6 changes: 3 additions & 3 deletions imageio/plugins/pillow.py
Original file line number Diff line number Diff line change
Expand Up @@ -569,16 +569,16 @@ def pil_get_frame(im, is_gray=None, as_gray=None, mode=None, dtype=None):
# Create palette array
p = np.frombuffer(im.palette.getdata()[1], np.uint8)
# Restore the raw mode that was saved to be used to parse the palette
if hasattr(im.palette, 'rawmode_saved'):
if hasattr(im.palette, "rawmode_saved"):
im.palette.rawmode = im.palette.rawmode_saved
mode = im.palette.rawmode if im.palette.rawmode else im.palette.mode
nchannels = len(mode)
# Shape it.
p.shape = -1, nchannels
if p.shape[1] == 3 or (p.shape[1] == 4 and mode[-1] == 'X'):
if p.shape[1] == 3 or (p.shape[1] == 4 and mode[-1] == "X"):
p = np.column_stack((p[:, :3], 255 * np.ones(p.shape[0], p.dtype)))
# Swap the axes if the mode is in BGR and not RGB
if mode.startswith('BGR'):
if mode.startswith("BGR"):
p = p[:, [2, 1, 0]] if p.shape[1] == 3 else p[:, [2, 1, 0, 3]]
# Apply palette
frame_paletted = np.array(im, np.uint8)
Expand Down

0 comments on commit dd2906d

Please sign in to comment.