Apply Ruff's flake8-bugbear (B) rules

This commit is contained in:
Adam Goldsmith 2024-08-07 14:29:52 -04:00
parent 256c56df04
commit 20fcac99a8
6 changed files with 10 additions and 7 deletions

View File

@ -152,7 +152,7 @@ class DoorController:
)
return self.doXMLRequest(el)
def get_records(self, req, count, params={}, stopFunction=None):
def get_records(self, req, count, params=None, stopFunction=None):
recordCount = 0
moreRecords = True
@ -172,7 +172,7 @@ class DoorController:
"recordOffset": str(
recordCount - 1 if recordCount > 0 else 0
),
**params,
**(params or {}),
}
)
)

View File

@ -15,7 +15,7 @@ def assert_elements_equal(e1: Element, e2: Element) -> None:
assert e1.attrib == e2.attrib
assert len(e1) == len(e2)
for c1, c2 in zip(e1, e2):
for c1, c2 in zip(e1, e2, strict=True):
assert_elements_equal(c1, c2)

View File

@ -136,7 +136,7 @@ class DoorMember:
self,
existing_door_credentials: set[Credential],
all_members: list["DoorMember"],
old_credentials: set[Credential] = set(),
old_credentials: set[Credential],
):
# cardholderID should be set on a member before this is called
assert self.cardholderID is not None
@ -240,7 +240,7 @@ def update_door(door: Door, dry_run: bool = False):
]
member.update_attribs()
member.update_credentials(existing_door_credentials, members)
member.update_credentials(existing_door_credentials, members, set())
member.update_schedules()
# cardholder exists, compare contents

View File

@ -590,7 +590,7 @@ class EventExt(Event):
self.materials_fee_included_in_price is not None
or self.materials_fee == 0
)
and getattr(self, "total_due_to_instructor") is not None
and self.total_due_to_instructor is not None
)

View File

@ -81,7 +81,9 @@ def scrape_transactions(membershipworks: MembershipWorks):
transactions_csv = membershipworks.get_transactions(start_date, now)
transactions_json = membershipworks.get_transactions(start_date, now, json=True)
# this is terrible, but as long as the dates are the same, should be fiiiine
transactions = [{**j, **v} for j, v in zip(transactions_csv, transactions_json)]
transactions = [
{**j, **v} for j, v in zip(transactions_csv, transactions_json, strict=True)
]
assert all(
t["Account ID"] == t.get("uid", "") and t["Payment ID"] == t.get("sid", "")
for t in transactions

View File

@ -83,6 +83,7 @@ select = [
"TCH",
"PTH",
"FURB",
"B",
]
ignore = ["ISC001"]