Improve a bit the typing, again
This commit is contained in:
parent
8143b63ee3
commit
183667a7f9
@ -1,12 +1,13 @@
|
|||||||
import abc
|
import abc
|
||||||
import os
|
import os
|
||||||
|
from typing import Set
|
||||||
|
|
||||||
|
|
||||||
class AbstractParser(abc.ABC):
|
class AbstractParser(abc.ABC):
|
||||||
meta_list = set()
|
meta_list = set() # type: Set[str]
|
||||||
mimetypes = set()
|
mimetypes = set() # type: Set[str]
|
||||||
|
|
||||||
def __init__(self, filename: str):
|
def __init__(self, filename: str) -> None:
|
||||||
self.filename = filename
|
self.filename = filename
|
||||||
fname, extension = os.path.splitext(filename)
|
fname, extension = os.path.splitext(filename)
|
||||||
self.output_filename = fname + '.cleaned' + extension
|
self.output_filename = fname + '.cleaned' + extension
|
||||||
|
@ -5,7 +5,7 @@ class HarmlessParser(abstract.AbstractParser):
|
|||||||
""" This is the parser for filetypes that do not contain metadata. """
|
""" This is the parser for filetypes that do not contain metadata. """
|
||||||
mimetypes = {'application/xml', 'text/plain'}
|
mimetypes = {'application/xml', 'text/plain'}
|
||||||
|
|
||||||
def __init__(self, filename: str):
|
def __init__(self, filename: str) -> None:
|
||||||
super().__init__(filename)
|
super().__init__(filename)
|
||||||
self.filename = filename
|
self.filename = filename
|
||||||
self.output_filename = filename
|
self.output_filename = filename
|
||||||
|
@ -2,7 +2,7 @@ from . import abstract
|
|||||||
|
|
||||||
|
|
||||||
class TorrentParser(abstract.AbstractParser):
|
class TorrentParser(abstract.AbstractParser):
|
||||||
mimetypes = {'application/x-bittorrent', }
|
mimetypes = {b'application/x-bittorrent', }
|
||||||
whitelist = {b'announce', b'announce-list', b'info'}
|
whitelist = {b'announce', b'announce-list', b'info'}
|
||||||
|
|
||||||
def get_meta(self) -> dict:
|
def get_meta(self) -> dict:
|
||||||
|
Loading…
Reference in New Issue
Block a user