aboutsummaryrefslogtreecommitdiff
path: root/src/wikiget/validations.py
diff options
context:
space:
mode:
authorCody Logan <cody@lokken.dev>2023-11-08 09:16:57 -0800
committerCody Logan <cody@lokken.dev>2023-11-08 09:16:57 -0800
commit088f0663e37bac29d0f5fa4f1261f1e7a211e28a (patch)
treefc2ac1f4480d404e91be6edbecedfa4a5f409194 /src/wikiget/validations.py
parent2e6f78062ed2e6c5a1767841874a009051d94ce4 (diff)
downloadwikiget-088f0663e37bac29d0f5fa4f1261f1e7a211e28a.tar.gz
wikiget-088f0663e37bac29d0f5fa4f1261f1e7a211e28a.zip
Revise type annotations per PEP 604
Diffstat (limited to 'src/wikiget/validations.py')
-rw-r--r--src/wikiget/validations.py7
1 files changed, 4 insertions, 3 deletions
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