Fix typos found by codespell.

This commit is contained in:
auouymous 2023-07-19 02:29:37 -06:00
parent e362d36ac6
commit 375a94a139
4 changed files with 26 additions and 26 deletions

View File

@ -539,7 +539,7 @@ class DownloadTask(object):
of downloading data, this can take a while when the Internet is
busy).
The "status_changed" attribute gets set to True everytime the
The "status_changed" attribute gets set to True every time the
"status" attribute changes its value. After you get the value of
the "status_changed" attribute, it is always reset to False:

View File

@ -2414,7 +2414,7 @@ class gPodder(BuilderWidget, dbus.service.Object):
if episode is None:
logger.info('Invalid episode at path %s', str(path))
continue
except TypeError as te:
except TypeError as e:
logger.error('Invalid episode at path %s', str(path))
continue
@ -2447,7 +2447,7 @@ class gPodder(BuilderWidget, dbus.service.Object):
if task is None:
logger.info('Invalid task at path %s', str(path))
continue
except TypeError as te:
except TypeError as e:
logger.error('Invalid task at path %s', str(path))
continue

View File

@ -543,10 +543,10 @@ def format_date(timestamp):
yesterday = time.localtime(time.time() - seconds_in_a_day)[:3]
try:
timestamp_date = time.localtime(timestamp)[:3]
except ValueError as ve:
except ValueError as e:
logger.warning('Cannot convert timestamp', exc_info=True)
return None
except TypeError as te:
except TypeError as e:
logger.warning('Cannot convert timestamp', exc_info=True)
return None
@ -679,7 +679,7 @@ def remove_html_tags(html):
return result.strip()
class HyperlinkExtracter(object):
class HyperlinkExtractor(object):
def __init__(self):
self.parts = []
self.target_stack = [None]
@ -773,9 +773,9 @@ class HyperlinkExtracter(object):
class ExtractHyperlinkedText(object):
def __call__(self, document):
self.extracter = HyperlinkExtracter()
self.extractor = HyperlinkExtractor()
self.visit(document)
return self.extracter.get_result()
return self.extractor.get_result()
def visit(self, element):
# skip functions generated by html5lib for comments in the HTML
@ -784,42 +784,42 @@ class ExtractHyperlinkedText(object):
NS = '{http://www.w3.org/1999/xhtml}'
tag_name = (element.tag[len(NS):] if element.tag.startswith(NS) else element.tag).lower()
self.extracter.handle_starttag(tag_name, list(element.items()))
self.extractor.handle_starttag(tag_name, list(element.items()))
if element.text is not None:
self.extracter.handle_data(element.text)
self.extractor.handle_data(element.text)
for child in element:
self.visit(child)
if child.tail is not None:
self.extracter.handle_data(child.tail)
self.extractor.handle_data(child.tail)
self.extracter.handle_endtag(tag_name)
self.extractor.handle_endtag(tag_name)
class ExtractHyperlinkedTextHTMLParser(HTMLParser):
def __call__(self, html):
self.extracter = HyperlinkExtracter()
self.extractor = HyperlinkExtractor()
self.target_stack = [None]
self.feed(html)
self.close()
return self.extracter.get_result()
return self.extractor.get_result()
def handle_starttag(self, tag, attrs):
self.extracter.handle_starttag(tag, attrs)
self.extractor.handle_starttag(tag, attrs)
def handle_endtag(self, tag):
self.extracter.handle_endtag(tag)
self.extractor.handle_endtag(tag)
def handle_data(self, data):
self.extracter.handle_data(data)
self.extractor.handle_data(data)
def handle_entityref(self, name):
self.extracter.handle_entityref(name)
self.extractor.handle_entityref(name)
def handle_charref(self, name):
self.extracter.handle_charref(name)
self.extractor.handle_charref(name)
def extract_hyperlinked_text(html):
@ -1002,7 +1002,7 @@ def filename_from_url(url):
http://server/get.jsp?file=/episode0815.MOV => ("episode0815", ".mov")
http://s/redirect.mp4?http://serv2/test.mp4 => ("test", ".mp4")
"""
(scheme, netloc, path, para, query, fragid) = urllib.parse.urlparse(url)
(scheme, netloc, path, params, query, fragment) = urllib.parse.urlparse(url)
(filename, extension) = os.path.splitext(
os.path.basename(urllib.parse.unquote(path)))
@ -1536,7 +1536,7 @@ def format_seconds_to_hour_min_sec(seconds):
def http_request(url, method='HEAD'):
(scheme, netloc, path, parms, qry, fragid) = urllib.parse.urlparse(url)
(scheme, netloc, path, params, query, fragment) = urllib.parse.urlparse(url)
if scheme == 'https':
conn = http.client.HTTPSConnection(netloc)
else:

View File

@ -83,11 +83,11 @@ def checksums():
m = hashlib.md5()
s = hashlib.sha256()
with open(archive, "rb") as f:
bloc = f.read(4096)
while bloc:
m.update(bloc)
s.update(bloc)
bloc = f.read(4096)
block = f.read(4096)
while block:
m.update(block)
s.update(block)
block = f.read(4096)
ret[os.path.basename(archive)] = dict(md5=m.hexdigest(), sha256=s.hexdigest())
return ret