Linting
This commit is contained in:
37
workers.py
37
workers.py
@@ -156,7 +156,7 @@ def update_db(case_id: str, db: QSqlDatabase) -> int:
|
||||
assert isinstance(tmp, str)
|
||||
matches = re.match(r"(No.)?\s*(\d+[-A]\d+).*$", tmp)
|
||||
assert matches is not None
|
||||
print(matches,matches.groups())
|
||||
print(matches, matches.groups())
|
||||
docket_id = matches.group(2)
|
||||
print(f"Found {docket_id}")
|
||||
|
||||
@@ -188,13 +188,13 @@ def update_db(case_id: str, db: QSqlDatabase) -> int:
|
||||
assert isinstance(tr, Tag) and isinstance(tr.contents[1], Tag)
|
||||
td = tr.contents[1]
|
||||
assert isinstance(td, Tag)
|
||||
if td.string is None:
|
||||
tmp = datetime.datetime(year=1776, month=7, day=4)
|
||||
else:
|
||||
docket_date = td.string.strip()
|
||||
tmp = dateparser.parse(docket_date)
|
||||
assert isinstance(tmp, datetime.datetime)
|
||||
date = QDateTime.fromSecsSinceEpoch(int(tmp.timestamp()))
|
||||
docket_date = td.string
|
||||
if docket_date is None:
|
||||
docket_date = "July 7, 1776"
|
||||
|
||||
tmp = dateparser.parse(docket_date) # type: ignore[assignment]
|
||||
assert tmp is not None
|
||||
date = QDateTime.fromSecsSinceEpoch(int(tmp.timestamp())) # type: ignore[assignment, attr-defined]
|
||||
|
||||
#
|
||||
# linked case is row 3, column 0
|
||||
@@ -224,7 +224,7 @@ def update_db(case_id: str, db: QSqlDatabase) -> int:
|
||||
# If there is a linked case, we need to get the ID for that case.
|
||||
if linked is not None:
|
||||
linked = linked.replace("Linked with ", "")
|
||||
for did in linked.split(','):
|
||||
for did in linked.split(","):
|
||||
did = did.strip()
|
||||
query.prepare("SELECT * FROM cases WHERE docket_id = :did")
|
||||
query.bindValue(":did", linked)
|
||||
@@ -235,19 +235,22 @@ def update_db(case_id: str, db: QSqlDatabase) -> int:
|
||||
if linked_id <= 0:
|
||||
raise Exception(f"Unable to create linked case: {did}")
|
||||
else:
|
||||
linked_id = query.value('case_id')
|
||||
linked_id = query.value("case_id")
|
||||
#
|
||||
#
|
||||
#
|
||||
|
||||
query.prepare("SELECT * FROM cases_cases WHERE lhs = :lhs "
|
||||
"AND rhs = :rhs")
|
||||
query.bindValue(':lhs', case_id)
|
||||
query.bindValue(':rhs', linked_id)
|
||||
query.prepare(
|
||||
"SELECT * FROM cases_cases WHERE lhs = :lhs " "AND rhs = :rhs"
|
||||
)
|
||||
query.bindValue(":lhs", case_id)
|
||||
query.bindValue(":rhs", linked_id)
|
||||
if not query.exec():
|
||||
query_error(query)
|
||||
if not query.next():
|
||||
query.prepare("INSERT INTO cases_cases (lhs, rhs) "
|
||||
"VALUES ( :lhs, :rhs)")
|
||||
query.prepare(
|
||||
"INSERT INTO cases_cases (lhs, rhs) "
|
||||
"VALUES ( :lhs, :rhs)"
|
||||
)
|
||||
query.bindValue(":lhs", case_id)
|
||||
query.bindValue(":rhs", linked_id)
|
||||
if not query.exec():
|
||||
|
||||
Reference in New Issue
Block a user