summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--MAT/mat.py2
-rw-r--r--MAT/misc.py12
2 files changed, 7 insertions, 7 deletions
diff --git a/MAT/mat.py b/MAT/mat.py
index 4954b47..092ef48 100644
--- a/MAT/mat.py
+++ b/MAT/mat.py
@@ -65,7 +65,7 @@ def list_supported_formats():
65 65
66 localy_supported = [] 66 localy_supported = []
67 for item in handler.list: 67 for item in handler.list:
68 if strippers.STRIPPERS.has_key(item['mimetype'].split(',')[0]): 68 if item['mimetype'].split(',')[0] in strippers.STRIPPERS:
69 localy_supported.append(item) 69 localy_supported.append(item)
70 70
71 return localy_supported 71 return localy_supported
diff --git a/MAT/misc.py b/MAT/misc.py
index b0c22f4..3f24ece 100644
--- a/MAT/misc.py
+++ b/MAT/misc.py
@@ -19,7 +19,7 @@ class TorrentStripper(parser.GenericParser):
19 ''' Get recursively all keys from a dict and 19 ''' Get recursively all keys from a dict and
20 its subdicts 20 its subdicts
21 ''' 21 '''
22 for (i,j) in dictionary.items(): 22 for (i,j) in list(dictionary.items()):
23 if isinstance(j, dict): 23 if isinstance(j, dict):
24 return set([i]).union(self.__get_key_recursively(j)) 24 return set([i]).union(self.__get_key_recursively(j))
25 return set([i]) 25 return set([i])
@@ -35,11 +35,11 @@ class TorrentStripper(parser.GenericParser):
35 ''' Get recursively all harmful metadata 35 ''' Get recursively all harmful metadata
36 ''' 36 '''
37 d = dict() 37 d = dict()
38 for(i,j) in dictionary.items(): 38 for(i,j) in list(dictionary.items()):
39 if i not in self.fields: 39 if i not in self.fields:
40 d[i] = j 40 d[i] = j
41 elif isinstance(j, dict): 41 elif isinstance(j, dict):
42 d = dict(d.items() + self.__get_meta_recursively(j).items()) 42 d = dict(d.items() + list(self.__get_meta_recursively(j).items()))
43 return d 43 return d
44 44
45 def get_meta(self): 45 def get_meta(self):
@@ -53,9 +53,9 @@ class TorrentStripper(parser.GenericParser):
53 ''' Remove recursively all compromizing fields 53 ''' Remove recursively all compromizing fields
54 ''' 54 '''
55 d = dict() 55 d = dict()
56 for(i,j) in filter(lambda i: i in self.fields, dictionary.items()): 56 for (i,j) in [i for i in list(dictionary.items()) if i in self.fields]:
57 if isinstance(j, dict): 57 if isinstance(j, dict):
58 d = dict(d.items() + self.__get_meta_recursively(j).items()) 58 d = dict(list(d.items()) + list(self.__get_meta_recursively(j).items()))
59 else: 59 else:
60 d[i] = j 60 d[i] = j
61 return d 61 return d
@@ -67,7 +67,7 @@ class TorrentStripper(parser.GenericParser):
67 with open(self.filename, 'r') as f: 67 with open(self.filename, 'r') as f:
68 decoded = bencode.bdecode(f.read()) 68 decoded = bencode.bdecode(f.read())
69 69
70 cleaned = {i:j for i,j in decoded.items() if i in self.fields} 70 cleaned = {i:j for i,j in list(decoded.items()) if i in self.fields}
71 71
72 with open(self.output, 'w') as f: # encode the decoded torrent 72 with open(self.output, 'w') as f: # encode the decoded torrent
73 f.write(bencode.bencode(cleaned)) # and write it in self.output 73 f.write(bencode.bencode(cleaned)) # and write it in self.output