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 of downloading data, this can take a while when the Internet is
busy). 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 "status" attribute changes its value. After you get the value of
the "status_changed" attribute, it is always reset to False: 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: if episode is None:
logger.info('Invalid episode at path %s', str(path)) logger.info('Invalid episode at path %s', str(path))
continue continue
except TypeError as te: except TypeError as e:
logger.error('Invalid episode at path %s', str(path)) logger.error('Invalid episode at path %s', str(path))
continue continue
@ -2447,7 +2447,7 @@ class gPodder(BuilderWidget, dbus.service.Object):
if task is None: if task is None:
logger.info('Invalid task at path %s', str(path)) logger.info('Invalid task at path %s', str(path))
continue continue
except TypeError as te: except TypeError as e:
logger.error('Invalid task at path %s', str(path)) logger.error('Invalid task at path %s', str(path))
continue continue

View File

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

View File

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