diff options
author | Nathaniel <natemaia10@gmail.com> | 2018-07-07 19:01:13 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-07 19:01:13 -0700 |
commit | 58bcf8691d522d658e8b4a1c0389d5bb53c3d1aa (patch) | |
tree | 7f02abdc18984639082bd97abf97260f9fd26d8b | |
parent | 970d2ae77f7988e4af0dc604ff6444306f5d9be4 (diff) | |
download | ranger-58bcf8691d522d658e8b4a1c0389d5bb53c3d1aa.tar.gz |
Indentation and whitespace cleanup
-rw-r--r-- | examples/plugin_pmount.py | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/examples/plugin_pmount.py b/examples/plugin_pmount.py index feb54c83..f7e1bd3c 100644 --- a/examples/plugin_pmount.py +++ b/examples/plugin_pmount.py @@ -27,15 +27,13 @@ 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 @@ -48,18 +46,16 @@ def hook_init(fm): 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)) |