Skip to content
2 changes: 1 addition & 1 deletion warehouse/accounts/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def notify_users_of_tos_update(request):
request.db.query(User)
.outerjoin(Email)
.filter(Email.verified == True, Email.primary == True) # noqa E711
.filter(User.id.not_in(already_notified_subquery))
.filter(User.id.not_in(select(already_notified_subquery)))
.limit(request.registry.settings.get("terms.notification_batch_size"))
)
for user in users_to_notify:
Expand Down
4 changes: 3 additions & 1 deletion warehouse/admin/views/malware_reports.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,9 @@ def malware_reports_detail(request):
Show a detailed view of a Malware Report.
"""
observation_id = request.matchdict.get("observation_id")
observation = request.db.get(Observation, observation_id)
observation = (
request.db.get(Observation, observation_id) if observation_id else None
)

return {"report": observation}

Expand Down
4 changes: 2 additions & 2 deletions warehouse/admin/views/organizations.py
Original file line number Diff line number Diff line change
Expand Up @@ -1029,7 +1029,7 @@ def add_manual_activation(request):
)
def set_upload_limit(request):
organization_id = request.matchdict["organization_id"]
organization = request.db.query(Organization).get(organization_id)
organization = request.db.get(Organization, organization_id)
if organization is None:
raise HTTPNotFound

Expand Down Expand Up @@ -1215,7 +1215,7 @@ def delete_manual_activation(request):
)
def set_total_size_limit(request):
organization_id = request.matchdict["organization_id"]
organization = request.db.query(Organization).get(organization_id)
organization = request.db.get(Organization, organization_id)
if organization is None:
raise HTTPNotFound

Expand Down
2 changes: 1 addition & 1 deletion warehouse/attestations/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def parse_attestations(
f"attestation: {e}",
)
except Exception as e:
with sentry_sdk.push_scope() as scope:
with sentry_sdk.new_scope() as scope:
scope.fingerprint = [e]
sentry_sdk.capture_message(
f"Unexpected error while verifying attestation: {e}"
Expand Down
4 changes: 3 additions & 1 deletion warehouse/packaging/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ def _simple_index(request, serial):
Project.lifecycle_status.is_distinct_from(
LifecycleStatus.QuarantineEnter
)
).order_by(Project.normalized_name)
)
.order_by(Project.normalized_name)
.scalar_subquery()
)
)
projects = request.db.execute(query).scalar() or []
Expand Down