diff options
| author | Cody Logan <cody@lokken.dev> | 2023-10-20 16:36:14 -0700 |
|---|---|---|
| committer | Cody Logan <cody@lokken.dev> | 2023-10-20 16:41:11 -0700 |
| commit | c1820026f97eaf671c29ab30f02879de0ac4df89 (patch) | |
| tree | 4a0d9edb5301b26d9dbd22ceb307a7e3b1db4820 /src/wikiget/validations.py | |
| parent | 3d37cf6f86eb6c48a3a0a094c42ade6d7aed1daf (diff) | |
| download | wikiget-c1820026f97eaf671c29ab30f02879de0ac4df89.tar.gz wikiget-c1820026f97eaf671c29ab30f02879de0ac4df89.zip | |
Add type annotations to source files
Diffstat (limited to 'src/wikiget/validations.py')
| -rw-r--r-- | src/wikiget/validations.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/wikiget/validations.py b/src/wikiget/validations.py index 2bce34e..c9e7bcf 100644 --- a/src/wikiget/validations.py +++ b/src/wikiget/validations.py @@ -17,11 +17,12 @@ import hashlib import re +from typing import Optional from wikiget import BLOCKSIZE -def valid_file(search_string): +def valid_file(search_string: str) -> Optional[re.Match]: """ 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:', @@ -38,7 +39,7 @@ def valid_file(search_string): return file_regex.search(search_string) -def valid_site(search_string): +def valid_site(search_string: str) -> Optional[re.Match]: """ 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 @@ -54,7 +55,7 @@ def valid_site(search_string): return site_regex.search(search_string) -def verify_hash(filename): +def verify_hash(filename: str) -> str: """ Calculates the SHA1 hash of the given file for comparison with a known value. |
