From 5ac91cd4f94a822c81bd0bc55a2f7034b31eee7a Mon Sep 17 00:00:00 2001 From: Brolf Date: Wed, 20 Feb 2019 00:45:27 +0100 Subject: Refactor {black,white}list into {block,allow}list Closes #96 --- libmat2/torrent.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'libmat2/torrent.py') diff --git a/libmat2/torrent.py b/libmat2/torrent.py index c006f9c..6021d75 100644 --- a/libmat2/torrent.py +++ b/libmat2/torrent.py @@ -6,7 +6,7 @@ from . import abstract class TorrentParser(abstract.AbstractParser): mimetypes = {'application/x-bittorrent', } - whitelist = {b'announce', b'announce-list', b'info'} + allowlist = {b'announce', b'announce-list', b'info'} def __init__(self, filename): super().__init__(filename) @@ -18,14 +18,14 @@ class TorrentParser(abstract.AbstractParser): def get_meta(self) -> Dict[str, Union[str, dict]]: metadata = {} for key, value in self.dict_repr.items(): - if key not in self.whitelist: + if key not in self.allowlist: metadata[key.decode('utf-8')] = value return metadata def remove_all(self) -> bool: cleaned = dict() for key, value in self.dict_repr.items(): - if key in self.whitelist: + if key in self.allowlist: cleaned[key] = value with open(self.output_filename, 'wb') as f: f.write(_BencodeHandler().bencode(cleaned)) -- cgit v1.3