Skip to content

Commit

Permalink
Fixed pep8 errors (#632)
Browse files Browse the repository at this point in the history
* Fixed pep8 errors

* fixed few more errors

* added Exception in except statement
  • Loading branch information
ljnath authored Jun 20, 2021
1 parent 43d8674 commit 27a611f
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 23 deletions.
45 changes: 25 additions & 20 deletions plyer/platforms/android/filechooser.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,20 +82,22 @@ class AndroidFileChooser(FileChooser):

# mime types
mime_type = {
"doc": "application/msword",
"docx": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
"ppt": "application/vnd.ms-powerpoint",
"pptx": "application/vnd.openxmlformats-officedocument.presentationml.presentation",
"xls": "application/vnd.ms-excel",
"xlsx": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
"text": "text/*",
"pdf": "application/pdf",
"zip": "application/zip",
"image": "image/*",
"video": "video/*",
"audio": "audio/*",
"application": "application/*"
}
"doc": "application/msword",
"docx": "application/vnd.openxmlformats-officedocument." +
"wordprocessingml.document",
"ppt": "application/vnd.ms-powerpoint",
"pptx": "application/vnd.openxmlformats-officedocument." +
"presentationml.presentation",
"xls": "application/vnd.ms-excel",
"xlsx": "application/vnd.openxmlformats-officedocument." +
"spreadsheetml.sheet",
"text": "text/*",
"pdf": "application/pdf",
"zip": "application/zip",
"image": "image/*",
"video": "video/*",
"audio": "audio/*",
"application": "application/*"}

selected_mime_type = None

Expand Down Expand Up @@ -131,11 +133,13 @@ def _open_file(self, **kwargs):
self._handle_selection = kwargs.pop(
'on_selection', self._handle_selection
)
self.selected_mime_type = kwargs.pop("filters")[0] if "filters" in kwargs else ""
self.selected_mime_type = \
kwargs.pop("filters")[0] if "filters" in kwargs else ""

# create Intent for opening
file_intent = Intent(Intent.ACTION_GET_CONTENT)
if not self.selected_mime_type or type(self.selected_mime_type) != str or\
if not self.selected_mime_type or \
type(self.selected_mime_type) != str or \
self.selected_mime_type not in self.mime_type:
file_intent.setType("*/*")
else:
Expand Down Expand Up @@ -175,13 +179,14 @@ def _on_activity_result(self, request_code, result_code, data):
return

selection = []
#Process multiple URI if multiple files selected
# Process multiple URI if multiple files selected
try:
for count in range(data.getClipData().getItemCount()):
ele = self._resolve_uri(data.getClipData().getItemAt(count).getUri()) or []
ele = self._resolve_uri(
data.getClipData().getItemAt(count).getUri()) or []
selection.append(ele)
except:
selection = [self._resolve_uri(data.getData()),]
except Exception:
selection = [self._resolve_uri(data.getData()), ]

# return value to object
self.selection = selection
Expand Down
4 changes: 2 additions & 2 deletions plyer/platforms/linux/wifi.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
import wifi
except ModuleNotFoundError as err:
raise ModuleNotFoundError(
"python-wifi not installed. try: `pip install --user wifi`."
) from err
"python-wifi not installed. try:" +
"`pip install --user wifi`.") from err


class NMCLIWifi(Wifi):
Expand Down
3 changes: 2 additions & 1 deletion plyer/platforms/win/screenshot.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ def _capture(self):
dest_ctx.BitBlt(
(0, 0), # start point (x, y)
(width, height), # size of rectangle
dev_ctx, ( # source device
dev_ctx, # source device
(
GetSystemMetrics(SM_XVIRTUALSCREEN),
GetSystemMetrics(SM_YVIRTUALSCREEN)
), # source rectangle, can be different monitor
Expand Down

0 comments on commit 27a611f

Please sign in to comment.