From 183667a7f907f6d2ebc6abda4bbd774829ddffda Mon Sep 17 00:00:00 2001 From: totallylegit Date: Mon, 4 Jun 2018 20:39:27 +0200 Subject: [PATCH] Improve a bit the typing, again --- libmat2/abstract.py | 7 ++++--- libmat2/harmless.py | 2 +- libmat2/torrent.py | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/libmat2/abstract.py b/libmat2/abstract.py index e4838a9..9cb9320 100644 --- a/libmat2/abstract.py +++ b/libmat2/abstract.py @@ -1,12 +1,13 @@ import abc import os +from typing import Set class AbstractParser(abc.ABC): - meta_list = set() - mimetypes = set() + meta_list = set() # type: Set[str] + mimetypes = set() # type: Set[str] - def __init__(self, filename: str): + def __init__(self, filename: str) -> None: self.filename = filename fname, extension = os.path.splitext(filename) self.output_filename = fname + '.cleaned' + extension diff --git a/libmat2/harmless.py b/libmat2/harmless.py index aa00582..a63407f 100644 --- a/libmat2/harmless.py +++ b/libmat2/harmless.py @@ -5,7 +5,7 @@ class HarmlessParser(abstract.AbstractParser): """ This is the parser for filetypes that do not contain metadata. """ mimetypes = {'application/xml', 'text/plain'} - def __init__(self, filename: str): + def __init__(self, filename: str) -> None: super().__init__(filename) self.filename = filename self.output_filename = filename diff --git a/libmat2/torrent.py b/libmat2/torrent.py index cb4b5e3..3a819fb 100644 --- a/libmat2/torrent.py +++ b/libmat2/torrent.py @@ -2,7 +2,7 @@ from . import abstract class TorrentParser(abstract.AbstractParser): - mimetypes = {'application/x-bittorrent', } + mimetypes = {b'application/x-bittorrent', } whitelist = {b'announce', b'announce-list', b'info'} def get_meta(self) -> dict: