aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/wikiget/parse.py5
-rw-r--r--src/wikiget/validations.py7
-rw-r--r--src/wikiget/wikiget.py5
3 files changed, 10 insertions, 7 deletions
diff --git a/src/wikiget/parse.py b/src/wikiget/parse.py
index abe1419..99cb01c 100644
--- a/src/wikiget/parse.py
+++ b/src/wikiget/parse.py
@@ -15,10 +15,11 @@
# You should have received a copy of the GNU General Public License
# along with Wikiget. If not, see <https://www.gnu.org/licenses/>.
+from __future__ import annotations
+
import fileinput
import logging
from argparse import Namespace
-from typing import Dict
from urllib.parse import unquote, urlparse
import wikiget
@@ -59,7 +60,7 @@ def get_dest(dl: str, args: Namespace) -> File:
return File(filename, dest, site_name)
-def read_batch_file(batch_file: str) -> Dict[int, str]:
+def read_batch_file(batch_file: str) -> dict[int, str]:
dl_dict = {}
if batch_file == "-":
diff --git a/src/wikiget/validations.py b/src/wikiget/validations.py
index 6926f06..cfbc5ef 100644
--- a/src/wikiget/validations.py
+++ b/src/wikiget/validations.py
@@ -15,14 +15,15 @@
# You should have received a copy of the GNU General Public License
# along with Wikiget. If not, see <https://www.gnu.org/licenses/>.
+from __future__ import annotations
+
import hashlib
import re
-from typing import Optional
from wikiget import BLOCKSIZE
-def valid_file(search_string: str) -> Optional[re.Match]:
+def valid_file(search_string: str) -> re.Match | None:
"""
Determines if the given string contains a valid file name, defined as a string
ending with a '.' and at least one character, beginning with 'File:' or 'Image:',
@@ -39,7 +40,7 @@ def valid_file(search_string: str) -> Optional[re.Match]:
return file_regex.search(search_string)
-def valid_site(search_string: str) -> Optional[re.Match]:
+def valid_site(search_string: str) -> re.Match | None:
"""
Determines if the given string contains a valid site name, defined as a string
ending with 'wikipedia.org' or 'wikimedia.org'. This covers all subdomains of those
diff --git a/src/wikiget/wikiget.py b/src/wikiget/wikiget.py
index 690cbe2..06dc458 100644
--- a/src/wikiget/wikiget.py
+++ b/src/wikiget/wikiget.py
@@ -15,17 +15,18 @@
# You should have received a copy of the GNU General Public License
# along with Wikiget. If not, see <https://www.gnu.org/licenses/>.
+from __future__ import annotations
+
import argparse
import logging
import sys
-from typing import List
import wikiget
from wikiget.dl import process_download
from wikiget.logging import configure_logging
-def parse_args(argv: List[str]) -> argparse.Namespace:
+def parse_args(argv: list[str]) -> argparse.Namespace:
parser = argparse.ArgumentParser(
description="""
A tool for downloading files from MediaWiki sites using the file name or