summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorNathaniel <natemaia10@gmail.com>2018-07-07 19:07:30 -0700
committerGitHub <noreply@github.com>2018-07-07 19:07:30 -0700
commit0e4577ea8ac0ea99e2c44164e2e81182d1ec4d07 (patch)
treec9f844ff884eae13d2c3220ec31c12ea918a65bc
parent58bcf8691d522d658e8b4a1c0389d5bb53c3d1aa (diff)
downloadranger-0e4577ea8ac0ea99e2c44164e2e81182d1ec4d07.tar.gz
import order and break long lines
-rw-r--r--examples/plugin_pmount.py20
1 files changed, 12 insertions, 8 deletions
diff --git a/examples/plugin_pmount.py b/examples/plugin_pmount.py
index f7e1bd3c..3079b5a3 100644
--- a/examples/plugin_pmount.py
+++ b/examples/plugin_pmount.py
@@ -15,8 +15,8 @@
 
 from __future__ import (absolute_import, division, print_function)
 
-import ranger.api
 import subprocess
+import ranger.api
 
 MOUNT_KEY = '<alt>m'
 UMOUNT_KEY = '<alt>M'
@@ -27,13 +27,15 @@ def hook_init(fm):
     fm.execute_console("map {key} shell -p lsblk".format(key=LIST_MOUNTS_KEY))
 
     diskcmd = "lsblk -lno NAME | grep -w 'sd[a-z]' | sed 's/sd//'"
-    disks = subprocess.check_output(diskcmd, shell=True).decode('utf-8').replace('\r', '').replace('\n', '')
+    disks = subprocess.check_output(
+        diskcmd, shell=True).decode('utf-8').replace('\r', '').replace('\n', '')
 
     for disk in disks:
         partcmd = "lsblk -lno NAME /dev/sd{0} | sed 's/sd{0}//' | tail -n 1".format(disk)
 
         try:
-            numparts = int(subprocess.check_output(partcmd, shell=True).decode('utf-8').replace('\r', '').replace('\n', ''))
+            numparts = int(subprocess.check_output(
+                partcmd, shell=True).decode('utf-8').replace('\r', '').replace('\n', ''))
         except ValueError:
             numparts = 0
 
@@ -43,19 +45,21 @@ def hook_init(fm):
                 disk, key=MOUNT_KEY))
             fm.execute_console("map {key}{0} chain cd; chain shell pumount sd{0}".format(
                 disk, key=UMOUNT_KEY))
-            
+
         elif numparts == 1:
             # only one partition, mount the partition
-            fm.execute_console("map {key}{0} chain shell pmount sd{0}1; cd /media/sd{0}1".format(
-                disk, key=MOUNT_KEY))
+            fm.execute_console(
+                "map {key}{0} chain shell pmount sd{0}1; cd /media/sd{0}1".format(
+                    disk, key=MOUNT_KEY))
             fm.execute_console("map {key}{0} chain cd; shell pumount sd{0}1".format(
                 disk, key=UMOUNT_KEY))
 
         else:
             # use range start 1, /dev/sd{device}0 doesn't exist
             for part in range(1, numparts + 1):
-                fm.execute_console("map {key}{0}{1} chain shell pmount sd{0}{1}; cd /media/sd{0}{1}".format(
-                    disk, part, key=MOUNT_KEY))
+                fm.execute_console(
+                    "map {key}{0}{1} chain shell pmount sd{0}{1}; cd /media/sd{0}{1}".format(
+                        disk, part, key=MOUNT_KEY))
                 fm.execute_console("map {key}{0}{1} chain cd; shell pumount sd{0}{1}".format(
                     disk, part, key=UMOUNT_KEY))