From 088f0663e37bac29d0f5fa4f1261f1e7a211e28a Mon Sep 17 00:00:00 2001 From: Cody Logan Date: Wed, 8 Nov 2023 09:16:57 -0800 Subject: Revise type annotations per PEP 604 --- src/wikiget/validations.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/wikiget/validations.py') 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 . +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 -- cgit v1.2.3