Moved import and added ignore to BeautifulSoup type annotation issues
This commit is contained in:
@@ -253,16 +253,16 @@ class BrickInstructions(object):
|
||||
|
||||
raw: list[tuple[str, str]] = []
|
||||
for a in soup.find_all('a', href=link_re):
|
||||
img = a.find('img', alt=True)
|
||||
if not img or set not in img['alt']:
|
||||
img = a.find('img', alt=True) # type: ignore
|
||||
if not img or set not in img['alt']: # type: ignore
|
||||
continue
|
||||
|
||||
# Turn the alt text into a slug
|
||||
alt_text = img['alt'].removeprefix('LEGO Building Instructions for ')
|
||||
alt_text = img['alt'].removeprefix('LEGO Building Instructions for ') # type: ignore
|
||||
slug = re.sub(r'[^A-Za-z0-9]+', '-', alt_text).strip('-')
|
||||
|
||||
# Build the absolute download URL
|
||||
download_url = urljoin('https://rebrickable.com', a['href'])
|
||||
download_url = urljoin('https://rebrickable.com', a['href']) # type: ignore
|
||||
raw.append((slug, download_url))
|
||||
|
||||
if not raw:
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import re
|
||||
from sqlite3 import Row
|
||||
from typing import Any, Generator, Generic, ItemsView, Self, TypeVar, TYPE_CHECKING
|
||||
|
||||
@@ -109,7 +110,6 @@ class BrickRecordList(Generic[T]):
|
||||
main_sql = BrickSQL().load_query(list_query, **count_context)
|
||||
|
||||
# Remove ORDER BY, LIMIT, OFFSET clauses for counting
|
||||
import re
|
||||
# Remove ORDER BY clause and everything after it that's not part of subqueries
|
||||
count_sql = re.sub(r'\s+ORDER\s+BY\s+[^)]*?(\s+LIMIT|\s+OFFSET|$)', r'\1', main_sql, flags=re.IGNORECASE)
|
||||
# Remove LIMIT and OFFSET
|
||||
|
||||
Reference in New Issue
Block a user