diff options
author | Calum Lind <calumlind+deluge@gmail.com> | 2015-11-04 11:12:21 +0000 |
---|---|---|
committer | Calum Lind <calumlind+deluge@gmail.com> | 2015-11-04 11:54:15 +0000 |
commit | cde17925fc2323fcddcf4e608ab7e51d948b1ba5 (patch) | |
tree | c255615339f1127fd5111d1eb679bebaafd5b897 /deluge/ui/common.py | |
parent | 05ab06e3a51f526893e736544ba3b3e524a8e271 (diff) | |
download | deluge-cde17925fc2323fcddcf4e608ab7e51d948b1ba5.tar.gz deluge-cde17925fc2323fcddcf4e608ab7e51d948b1ba5.tar.bz2 deluge-cde17925fc2323fcddcf4e608ab7e51d948b1ba5.zip |
[Lint] Autopep8 aggressive run
* Uses isinstance() instead of type()
* Uses sorted() where possible
Diffstat (limited to 'deluge/ui/common.py')
-rw-r--r-- | deluge/ui/common.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/deluge/ui/common.py b/deluge/ui/common.py index 28f9ecc6e..a4bf424bd 100644 --- a/deluge/ui/common.py +++ b/deluge/ui/common.py @@ -127,7 +127,7 @@ class TorrentInfo(object): file_tree.walk(walk) else: def walk(path, item): - if type(item) is dict: + if isinstance(item, dict): return item return [paths[path]["index"], paths[path]["length"], True] @@ -363,7 +363,7 @@ class FileTree(object): :rtype: dictionary """ def to_tuple(path, item): - if type(item) is dict: + if isinstance(item, dict): return item return tuple(item) self.walk(to_tuple) @@ -382,7 +382,7 @@ class FileTree(object): def walk(directory, parent_path): for path in directory.keys(): full_path = os.path.join(parent_path, path) - if type(directory[path]) is dict: + if isinstance(directory[path], dict): directory[path] = callback(full_path, directory[path]) or directory[path] walk(directory[path], full_path) else: @@ -395,7 +395,7 @@ class FileTree(object): def write(path, item): depth = path.count("/") path = os.path.basename(path) - path = type(item) is dict and path + "/" or path + path = isinstance(item, dict) and path + "/" or path lines.append(" " * depth + path) self.walk(write) return "\n".join(lines) |