aboutsummaryrefslogtreecommitdiff
path: root/wikiget/validations.py
diff options
context:
space:
mode:
authorclpo13 <clpo13@gmail.com>2023-09-26 12:09:07 -0700
committerGitHub <noreply@github.com>2023-09-26 12:09:07 -0700
commit602bbbb7e387f5c126d5130c6e7193f5ae906d9c (patch)
tree39d709c7117e05ed25cd4cc1ccd00cf15022448d /wikiget/validations.py
parent6d2acf3bba628f62fe91bb778b7bb92a1057969b (diff)
parentfbac39b1423475345b99c2da6a02be110c660d7a (diff)
downloadwikiget-602bbbb7e387f5c126d5130c6e7193f5ae906d9c.tar.gz
wikiget-602bbbb7e387f5c126d5130c6e7193f5ae906d9c.zip
Merge pull request #6 from clpo13/style-and-lint
Run linters with Hatch.
Diffstat (limited to 'wikiget/validations.py')
-rw-r--r--wikiget/validations.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/wikiget/validations.py b/wikiget/validations.py
index 5e7213f..dc70df4 100644
--- a/wikiget/validations.py
+++ b/wikiget/validations.py
@@ -31,7 +31,7 @@ def valid_file(search_string):
"""
# second group could also restrict to file extensions with three or more
# letters with ([^/\r\n\t\f\v]+\.\w{3,})
- file_regex = re.compile(r'(File:|Image:)([^/\r\n\t\f\v]+\.\w+)$', re.I)
+ file_regex = re.compile(r"(File:|Image:)([^/\r\n\t\f\v]+\.\w+)$", re.I)
return file_regex.search(search_string)
@@ -44,7 +44,7 @@ def valid_site(search_string):
:param search_string: string to validate
:returns: a regex Match object if there's a match or None otherwise
"""
- site_regex = re.compile(r'wiki[mp]edia\.org$', re.I)
+ site_regex = re.compile(r"wiki[mp]edia\.org$", re.I)
return site_regex.search(search_string)
@@ -55,8 +55,8 @@ def verify_hash(filename):
:param filename: name of the file to calculate a hash for
:return: hash digest
"""
- hasher = hashlib.sha1()
- with open(filename, 'rb') as dl:
+ hasher = hashlib.sha1() # noqa: S324
+ with open(filename, "rb") as dl:
buf = dl.read(BLOCKSIZE)
while len(buf) > 0:
hasher.update(buf)