Skip to content

Commit

Permalink
pep8 fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
tshirtman committed May 12, 2018
1 parent fc2c382 commit b39c84b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
15 changes: 10 additions & 5 deletions kivy/core/camera/camera_picamera.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,11 @@ def raw_buffer_size(self):
'''Round buffer size up to 32x16 blocks.
See https://picamera.readthedocs.io/en/release-1.13/recipes2.html#capturing-to-a-numpy-array
'''
return (ceil(self.resolution[0] / 32.) * 32, ceil(self.resolution[1] / 16.) * 16)
''' # noqa
return (
ceil(self.resolution[0] / 32.) * 32,
ceil(self.resolution[1] / 16.) * 16
)

def _update(self, dt):
if self.stopped:
Expand All @@ -63,19 +66,21 @@ def _update(self, dt):

try:
bufsize = self.raw_buffer_size()
output = numpy.empty((bufsize[0] * bufsize[1] * 3,), dtype=numpy.uint8)
output = numpy.empty(
(bufsize[0] * bufsize[1] * 3,), dtype=numpy.uint8)
self._camera.capture(output, self._format, use_video_port=True)

# Trim the buffer to fit the actual requested resolution.
# TODO: Is there a simpler way to do all this reshuffling?
output = output.reshape((bufsize[0], bufsize[1], 3))
output = output[:self.resolution[0], :self.resolution[1], :]
self._buffer = output.reshape((self.resolution[0] * self.resolution[1] * 3,))
self._buffer = output.reshape(
(self.resolution[0] * self.resolution[1] * 3,))

self._copy_to_gpu()
except KeyboardInterrupt:
raise
except:
except Exception:
Logger.exception('PiCamera: Couldn\'t get image from Camera')

def start(self):
Expand Down
4 changes: 2 additions & 2 deletions kivy/uix/widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -1345,8 +1345,8 @@ def dec_disabled(self):
.. versionchanged:: 1.10.1
:attr:`disabled` was changed from a
:class:`~kivy.properties.BooleanProperty` to an
:attr:`disabled` was changed from a
:class:`~kivy.properties.BooleanProperty` to an
:class:`~kivy.properties.AliasProperty` to allow access to its
previous state when a parent's disabled state is changed.
'''

0 comments on commit b39c84b

Please sign in to comment.