Hello! We are running our annual fundraising. Please consider making a donation if you value this freely available service or want to support people around the world working towards liberatory social change. https://riseup.net/donate.

Commit 183667a7 authored by totallylegit's avatar totallylegit
Browse files

Improve a bit the typing, again

parent 8143b63e
Pipeline #15648 failed with stages
in 43 seconds
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
......
......@@ -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
......
......@@ -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:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment