diff --git a/src/sentry/api/bases/organizationmember.py b/src/sentry/api/bases/organizationmember.py index 598ed488555d..d7585e405d38 100644 --- a/src/sentry/api/bases/organizationmember.py +++ b/src/sentry/api/bases/organizationmember.py @@ -134,7 +134,7 @@ def _get_member( om_id = kwargs.get("id") if isinstance(om_id, int): - invite = OrganizationMemberInvite.objects.filter(organization_member_id=om_id).first() + invite = OrganizationMemberInvite.objects.filter(organization_member_id=om_id).first() # noqa: S034 if invite is not None: raise ResourceDoesNotExist diff --git a/src/sentry/api/endpoints/api_tokens.py b/src/sentry/api/endpoints/api_tokens.py index 7c7c3df6fa57..a89cf185fa20 100644 --- a/src/sentry/api/endpoints/api_tokens.py +++ b/src/sentry/api/endpoints/api_tokens.py @@ -148,7 +148,7 @@ def delete(self, request: Request) -> Response[dict[str, object] | None]: with outbox_context(transaction.atomic(router.db_for_write(ApiToken)), flush=False): token_to_delete: ApiToken | None = ApiToken.objects.filter( id=token_id, application__isnull=True, user_id=user_id - ).first() + ).first() # noqa: S034 if token_to_delete is None: return Response({"tokenId": token_id, "userId": user_id}, status=400) diff --git a/src/sentry/api/endpoints/artifact_lookup.py b/src/sentry/api/endpoints/artifact_lookup.py index a0c80bf4515d..7d9fac772906 100644 --- a/src/sentry/api/endpoints/artifact_lookup.py +++ b/src/sentry/api/endpoints/artifact_lookup.py @@ -94,7 +94,7 @@ def download_file(self, download_id: str, project: Project) -> HttpResponseBase: projectartifactbundle__project_id=project.id, ) .select_related("file") - .first() + .first() # noqa: S034 ) metrics.incr("sourcemaps.download.artifact_bundle") elif ty == "release_file": @@ -104,7 +104,7 @@ def download_file(self, download_id: str, project: Project) -> HttpResponseBase: organization_id=project.organization.id, ) .select_related("file") - .first() + .first() # noqa: S034 ) if ( file_m is not None diff --git a/src/sentry/api/endpoints/auth_organization_config.py b/src/sentry/api/endpoints/auth_organization_config.py index 7cd088fa21a5..0264b6277078 100644 --- a/src/sentry/api/endpoints/auth_organization_config.py +++ b/src/sentry/api/endpoints/auth_organization_config.py @@ -59,8 +59,8 @@ def get(self, request: Request, organization_id_or_slug: str) -> Response: raise NotFound() organization = organization_context.organization - auth_provider = AuthProvider.objects.filter(organization_id=organization.id).first() - avatar = OrganizationAvatarReplica.objects.filter(organization_id=organization.id).first() + auth_provider = AuthProvider.objects.filter(organization_id=organization.id).first() # noqa: S034 + avatar = OrganizationAvatarReplica.objects.filter(organization_id=organization.id).first() # noqa: S034 is_demo_organization = is_demo_mode_enabled() and is_demo_org(organization) provider = None diff --git a/src/sentry/api/endpoints/auth_recovery.py b/src/sentry/api/endpoints/auth_recovery.py index e0d48d4b367f..a6b0a4091cb1 100644 --- a/src/sentry/api/endpoints/auth_recovery.py +++ b/src/sentry/api/endpoints/auth_recovery.py @@ -134,7 +134,7 @@ def get(self, request: Request) -> Response: user_id=serializer.validated_data["user_id"], hash=serializer.validated_data["token"], ) - .first() + .first() # noqa: S034 ) valid = bool( password_hash is not None @@ -164,7 +164,7 @@ def post(self, request: Request) -> Response: password_hash = ( LostPasswordHash.objects.select_related("user") .filter(user_id=user_id, hash=token) - .first() + .first() # noqa: S034 ) if password_hash is None: return Response({"detail": "Invalid or expired recovery token"}, status=400) @@ -188,7 +188,7 @@ def post(self, request: Request) -> Response: LostPasswordHash.objects.select_for_update() .select_related("user") .filter(user_id=user_id, hash=token) - .first() + .first() # noqa: S034 ) if password_hash is None: return Response({"detail": "Invalid or expired recovery token"}, status=400) diff --git a/src/sentry/api/endpoints/debug_files.py b/src/sentry/api/endpoints/debug_files.py index d09bd5d80ca6..3c99e0e50d36 100644 --- a/src/sentry/api/endpoints/debug_files.py +++ b/src/sentry/api/endpoints/debug_files.py @@ -333,7 +333,7 @@ def download( debug_file = ProjectDebugFile.objects.filter( id=debug_file_id, project_id=project.id - ).first() + ).first() # noqa: S034 if debug_file is None: raise Http404 @@ -520,7 +520,7 @@ def delete(self, request: Request, project: Project) -> Response: debug_file = ( ProjectDebugFile.objects.filter(id=validated_id, project_id=project.id) .select_related("file") - .first() + .first() # noqa: S034 ) if debug_file is not None: debug_file.delete() diff --git a/src/sentry/api/endpoints/organization_fork.py b/src/sentry/api/endpoints/organization_fork.py index cfa164113d3e..5b7d224047c4 100644 --- a/src/sentry/api/endpoints/organization_fork.py +++ b/src/sentry/api/endpoints/organization_fork.py @@ -139,7 +139,7 @@ def post(self, request: Request, organization_id_or_slug: str) -> Response: provenance=Relocation.Provenance.SAAS_TO_SAAS.value, want_org_slugs=[org_mapping.slug], status__in={Relocation.Status.IN_PROGRESS.value, Relocation.Status.PAUSE.value}, - ).first() + ).first() # noqa: S034 if duplicate_relocation is not None: return Response( { diff --git a/src/sentry/api/endpoints/organization_monitoring_provider_details.py b/src/sentry/api/endpoints/organization_monitoring_provider_details.py index e8ef89a5483b..a86a6f35d80c 100644 --- a/src/sentry/api/endpoints/organization_monitoring_provider_details.py +++ b/src/sentry/api/endpoints/organization_monitoring_provider_details.py @@ -92,7 +92,7 @@ def put( identity__idp__type=provider_key, ) .select_related("identity") - .first() + .first() # noqa: S034 ) if org_identity is None: return Response({"detail": "Not connected to this provider."}, status=404) diff --git a/src/sentry/api/endpoints/source_map_debug.py b/src/sentry/api/endpoints/source_map_debug.py index 6877d322ba13..5d5a6e75a2a9 100644 --- a/src/sentry/api/endpoints/source_map_debug.py +++ b/src/sentry/api/endpoints/source_map_debug.py @@ -753,7 +753,7 @@ def _get_dist_matched_artifact_index_release_file(self) -> ReleaseFile | None: file__type=ARTIFACT_INDEX_TYPE, ) .select_related("file") - .first() + .first() # noqa: S034 ) if self.dist_matched_artifact_index_release_file: maybe_renew_releasefiles([self.dist_matched_artifact_index_release_file]) diff --git a/src/sentry/api/helpers/group_index/update.py b/src/sentry/api/helpers/group_index/update.py index 2ec29a4df94d..48bc13174a14 100644 --- a/src/sentry/api/helpers/group_index/update.py +++ b/src/sentry/api/helpers/group_index/update.py @@ -192,7 +192,7 @@ def get_current_release_version_of_group(group: Group, follows_semver: bool = Fa current_release_version = ( Release.objects.filter(id__in=latest_observation) .values_list("version", flat=True) - .first() + .first() # noqa: S034 ) return current_release_version diff --git a/src/sentry/models/apitoken.py b/src/sentry/models/apitoken.py index 2f3fde3dd16d..ba76834706ce 100644 --- a/src/sentry/models/apitoken.py +++ b/src/sentry/models/apitoken.py @@ -538,7 +538,7 @@ def write_relocation_import( query = models.Q(token=self.token) | models.Q( refresh_token__isnull=False, refresh_token=self.refresh_token ) - existing = self.__class__.objects.filter(query).first() + existing = self.__class__.objects.filter(query).first() # noqa: S034 if existing: self.token = generate_token(token_type=self.token_type) if self.refresh_token is not None: diff --git a/src/sentry/models/dashboard.py b/src/sentry/models/dashboard.py index 116ec53f5d5b..4d935e6a54a9 100644 --- a/src/sentry/models/dashboard.py +++ b/src/sentry/models/dashboard.py @@ -73,7 +73,7 @@ def get_favorite_dashboard( """ return self.filter( organization=organization, user_id=user_id, dashboard=dashboard, favorited=True - ).first() + ).first() # noqa: S034 def reorder_favorite_dashboards( self, organization: Organization, user_id: int, new_dashboard_positions: list[int] @@ -175,7 +175,7 @@ def insert_favorite_dashboard( dashboard=dashboard, ) .select_for_update() - .first() + .first() # noqa: S034 ) if existing and existing.favorited: @@ -221,7 +221,7 @@ def insert_favorite_dashboard_alphabetically( dashboard=dashboard, ) .select_for_update() - .first() + .first() # noqa: S034 ) if existing and existing.favorited: @@ -471,7 +471,7 @@ def favorited_by(self, user_ids: Iterable[int]) -> None: users_to_refavorite = new_user_ids & existing_user_ids for user_id in users_to_refavorite: - fav = existing_favorites.filter(user_id=user_id, favorited=False).first() + fav = existing_favorites.filter(user_id=user_id, favorited=False).first() # noqa: S034 if fav: last_position = DashboardFavoriteUser.objects.get_last_position( self.organization, user_id diff --git a/src/sentry/models/featureadoption.py b/src/sentry/models/featureadoption.py index 1c6bb2878051..a76ed9012aa8 100644 --- a/src/sentry/models/featureadoption.py +++ b/src/sentry/models/featureadoption.py @@ -221,7 +221,7 @@ def bulk_record( def get_by_slug(self, organization: Organization, slug: str) -> FeatureAdoption | None: return self.filter( organization=organization, feature_id=manager.get_by_slug(slug).id - ).first() + ).first() # noqa: S034 @cell_silo_model diff --git a/src/sentry/models/groupopenperiod.py b/src/sentry/models/groupopenperiod.py index 80c055706de2..78b0e6e28f79 100644 --- a/src/sentry/models/groupopenperiod.py +++ b/src/sentry/models/groupopenperiod.py @@ -228,7 +228,7 @@ def create_open_period(group: Group, start_time: datetime, event_id: str | None with transaction.atomic(router.db_for_write(Group)): # Force a Group lock before the create to establish consistent lock ordering # This prevents deadlocks by ensuring we always acquire the Group lock first - Group.objects.select_for_update().filter(id=group.id).first() + Group.objects.select_for_update().filter(id=group.id).first() # noqa: S034 # There are some historical cases where we log multiple regressions for the same group, # but we only want to create a new open period for the first regression diff --git a/src/sentry/models/groupsearchviewstarred.py b/src/sentry/models/groupsearchviewstarred.py index 3c60b1223b9a..f6e1b7ed1fc5 100644 --- a/src/sentry/models/groupsearchviewstarred.py +++ b/src/sentry/models/groupsearchviewstarred.py @@ -29,7 +29,7 @@ def get_starred_view( """ return self.filter( organization=organization, user_id=user_id, group_search_view=view - ).first() + ).first() # noqa: S034 def reorder_starred_views( self, organization: Organization, user_id: int, new_view_positions: list[int] diff --git a/src/sentry/models/organizationmember.py b/src/sentry/models/organizationmember.py index 6a59758014bb..dd6a14fd0476 100644 --- a/src/sentry/models/organizationmember.py +++ b/src/sentry/models/organizationmember.py @@ -275,7 +275,7 @@ def save( update_fields: Iterable[str] | None = None, ) -> None: if self.id is not None: - invite = OrganizationMemberInvite.objects.filter(organization_member_id=self.id).first() + invite = OrganizationMemberInvite.objects.filter(organization_member_id=self.id).first() # noqa: S034 assert invite is None, "Cannot save placeholder organization member for an invited user" with outbox_context(transaction.atomic(using=router.db_for_write(OrganizationMember))): @@ -753,7 +753,7 @@ def normalize_before_relocation_import( self.inviter_id = None # If there is a token collision, just wipe the token. The user can always make a new one. - matching_token = self.__class__.objects.filter(token=self.token).first() + matching_token = self.__class__.objects.filter(token=self.token).first() # noqa: S034 if matching_token is not None: self.token = None self.token_expires_at = None diff --git a/src/sentry/models/organizationmemberinvite.py b/src/sentry/models/organizationmemberinvite.py index 35dd55ff3bd3..d42a4a25a729 100644 --- a/src/sentry/models/organizationmemberinvite.py +++ b/src/sentry/models/organizationmemberinvite.py @@ -265,7 +265,7 @@ def write_relocation_import( ) -> tuple[int, ImportKind] | None: # If there is a token collision, generate new tokens. query = models.Q(token=self.token) - existing = self.__class__.objects.filter(query).first() + existing = self.__class__.objects.filter(query).first() # noqa: S034 if existing: self.pk = existing.pk self.expires_at = timezone.now() + timedelta(days=INVITE_DAYS_VALID) diff --git a/src/sentry/models/orgauthtoken.py b/src/sentry/models/orgauthtoken.py index e1925d53133b..19483c0c708e 100644 --- a/src/sentry/models/orgauthtoken.py +++ b/src/sentry/models/orgauthtoken.py @@ -111,7 +111,7 @@ def normalize_before_relocation_import( # one. matching_token_hashed = self.__class__.objects.filter( token_hashed=self.token_hashed - ).first() + ).first() # noqa: S034 if (not self.token_hashed) or matching_token_hashed: org_slug = pk_map.get_slug(get_model_name(Organization), self.organization_id) if org_slug is None: diff --git a/src/sentry/models/projectkey.py b/src/sentry/models/projectkey.py index 175e5548c7f7..ecfed22ec9aa 100644 --- a/src/sentry/models/projectkey.py +++ b/src/sentry/models/projectkey.py @@ -186,7 +186,7 @@ def get_default(cls, project: Project | int) -> ProjectKey | None: project=project, roles=models.F("roles").bitor(cls.roles.store), status=ProjectKeyStatus.ACTIVE, - ).first() + ).first() # noqa: S034 @property def is_active(self) -> bool: @@ -392,10 +392,10 @@ def write_relocation_import( self, _s: ImportScope, _f: ImportFlags ) -> tuple[int, ImportKind] | None: # If there is a key collision, generate new keys. - matching_public_key = self.__class__.objects.filter(public_key=self.public_key).first() + matching_public_key = self.__class__.objects.filter(public_key=self.public_key).first() # noqa: S034 if not self.public_key or matching_public_key: self.public_key = self.generate_api_key() - matching_secret_key = self.__class__.objects.filter(secret_key=self.secret_key).first() + matching_secret_key = self.__class__.objects.filter(secret_key=self.secret_key).first() # noqa: S034 if not self.secret_key or matching_secret_key: self.secret_key = self.generate_api_key() diff --git a/src/sentry/models/pullrequest.py b/src/sentry/models/pullrequest.py index 75b75a3fc087..4da39b063562 100644 --- a/src/sentry/models/pullrequest.py +++ b/src/sentry/models/pullrequest.py @@ -309,7 +309,7 @@ def get_or_fetch_external_id( organization_id=organization_id, repository_id=repository_id, key=key, - ).first() + ).first() # noqa: S034 if stored is not None and stored.external_id is not None: metrics.incr( "scm.pull_request.external_id", diff --git a/src/sentry/models/release.py b/src/sentry/models/release.py index 82a09d6b57ca..a9aab50a9f5a 100644 --- a/src/sentry/models/release.py +++ b/src/sentry/models/release.py @@ -594,7 +594,7 @@ def _get_or_create_impl( release = cls.objects.filter( organization_id=project.organization_id, version__in=[version, project_version], - ).first() + ).first() # noqa: S034 if release is None: metric_tags["cache_hit"] = "false" metric_tags[DATA_ACCESS_TAG] = DataAccessTagValues.DB_READ.value diff --git a/src/sentry/tasks/on_demand_metrics.py b/src/sentry/tasks/on_demand_metrics.py index 4f9b32068143..aacd36fae25c 100644 --- a/src/sentry/tasks/on_demand_metrics.py +++ b/src/sentry/tasks/on_demand_metrics.py @@ -255,7 +255,7 @@ def _get_widget_on_demand_specs( if not cache.has_key(_get_project_for_query_cache_key(organization)): # This can just be the first project we find, since spec hashes should not be project # dependent. If spec hashes become project dependent then this may need to change. - project_for_query = Project.objects.filter(organization=organization).first() + project_for_query = Project.objects.filter(organization=organization).first() # noqa: S034 cache.set( _get_project_for_query_cache_key(organization), project_for_query, diff --git a/src/sentry/tasks/seer/agentic_triage/cron.py b/src/sentry/tasks/seer/agentic_triage/cron.py index 0b67487e77ce..ba7f9b136bcc 100644 --- a/src/sentry/tasks/seer/agentic_triage/cron.py +++ b/src/sentry/tasks/seer/agentic_triage/cron.py @@ -335,7 +335,7 @@ def run_agentic_triage_for_org( block on it. The run record, if created, is created synchronously.""" organization = Organization.objects.filter( id=organization_id, status=OrganizationStatus.ACTIVE - ).first() + ).first() # noqa: S034 if organization is None: return None @@ -357,7 +357,7 @@ def run_agentic_triage_for_org( organization=organization, workflow_config__strategy=SeerWorkflowStrategy.AGENTIC_TRIAGE, trigger_key=schedule_id, - ).first() + ).first() # noqa: S034 # Without quota, only completed runs or runs with persisted executions can continue. if existing_run is None or ( existing_run.date_completed is None and not existing_run.executions.exists() @@ -440,7 +440,7 @@ def run_agentic_triage_execution( """Heavy phase of an agentic triage run: eligibility, triage, and optional autofix dispatch. Single code path used by both sync invocation (from run_agentic_triage_for_org) and async dispatch (apply_async).""" - run = SeerWorkflowRun.objects.select_related("organization").filter(id=run_id).first() + run = SeerWorkflowRun.objects.select_related("organization").filter(id=run_id).first() # noqa: S034 if run is None: logger.info("night_shift.missing_run", extra={"night_shift_run_id": run_id}) return None @@ -600,7 +600,7 @@ def build_run_options( if org_tweaks is not None: layered.update(_tweaks_to_partial(org_tweaks)) if project_id is not None: - project = Project.objects.filter(id=project_id, organization_id=organization_id).first() + project = Project.objects.filter(id=project_id, organization_id=organization_id).first() # noqa: S034 if project is not None: layered.update(_tweaks_to_partial(get_agentic_triage_tweaks(project))) layered.update(manual_overrides or {}) diff --git a/src/sentry/tasks/seer/autofix_issue_data.py b/src/sentry/tasks/seer/autofix_issue_data.py index f94e93ed1428..fdcd6b2da3cb 100644 --- a/src/sentry/tasks/seer/autofix_issue_data.py +++ b/src/sentry/tasks/seer/autofix_issue_data.py @@ -98,7 +98,7 @@ def schedule_judging() -> None: processing_deadline_duration=5 * 60, ) def schedule_judging_for_org(organization_id: int, *args: Any, **kwargs: Any) -> None: - organization = Organization.objects.filter(id=organization_id).first() + organization = Organization.objects.filter(id=organization_id).first() # noqa: S034 if organization is None or not features.has(FEATURE_FLAG, organization): return @@ -143,7 +143,7 @@ def judge_issue_data(issues: list[tuple[int, str]], *args: Any, **kwargs: Any) - def _judge_issue(issue_data_id: int, event_id: str) -> None: issue_data = ( - SeerAutofixIssueData.objects.select_related("organization").filter(id=issue_data_id).first() + SeerAutofixIssueData.objects.select_related("organization").filter(id=issue_data_id).first() # noqa: S034 ) if issue_data is None or not features.has(FEATURE_FLAG, issue_data.organization): return diff --git a/src/sentry/tasks/seer/investigation.py b/src/sentry/tasks/seer/investigation.py index 3ccff6602d32..62af475eb072 100644 --- a/src/sentry/tasks/seer/investigation.py +++ b/src/sentry/tasks/seer/investigation.py @@ -88,14 +88,14 @@ def _lock_orchestration_run(run_id: int) -> InvestigationOrchestrationRun | None investigation = ( Notebook.objects.select_for_update(of=("self",)) .filter(orchestration_run__id=run_id) - .first() + .first() # noqa: S034 ) if investigation is None: return None return ( InvestigationOrchestrationRun.objects.select_for_update(of=("self",)) .filter(id=run_id) - .first() + .first() # noqa: S034 ) @@ -161,7 +161,7 @@ def _mark_command_dispatch_failed( ) -> None: database = router.db_for_write(InvestigationOrchestrationCommand) with transaction.atomic(using=database): - command_snapshot = InvestigationOrchestrationCommand.objects.filter(id=command_id).first() + command_snapshot = InvestigationOrchestrationCommand.objects.filter(id=command_id).first() # noqa: S034 if command_snapshot is None: return run = _lock_orchestration_run(command_snapshot.orchestration_run_id) @@ -172,7 +172,7 @@ def _mark_command_dispatch_failed( command = ( InvestigationOrchestrationCommand.objects.select_for_update() .filter(id=command_id) - .first() + .first() # noqa: S034 ) # A rerun_updated event means Seer has it, whatever happened to the response. if ( @@ -221,7 +221,7 @@ def _mark_command_dispatch_failed( def _mark_command_version_conflicted(command_id: int, reason: CommandRejectionCode) -> None: database = router.db_for_write(InvestigationOrchestrationCommand) with transaction.atomic(using=database): - command_snapshot = InvestigationOrchestrationCommand.objects.filter(id=command_id).first() + command_snapshot = InvestigationOrchestrationCommand.objects.filter(id=command_id).first() # noqa: S034 if command_snapshot is None: return run = _lock_orchestration_run(command_snapshot.orchestration_run_id) @@ -232,7 +232,7 @@ def _mark_command_version_conflicted(command_id: int, reason: CommandRejectionCo command = ( InvestigationOrchestrationCommand.objects.select_for_update() .filter(id=command_id) - .first() + .first() # noqa: S034 ) if ( command is None @@ -277,7 +277,7 @@ def _mark_internal_command_rejected(command_id: int, code: CommandRejectionCode database = router.db_for_write(InvestigationOrchestrationCommand) with transaction.atomic(using=database): - command_snapshot = InvestigationOrchestrationCommand.objects.filter(id=command_id).first() + command_snapshot = InvestigationOrchestrationCommand.objects.filter(id=command_id).first() # noqa: S034 if command_snapshot is None: return run = _lock_orchestration_run(command_snapshot.orchestration_run_id) @@ -288,7 +288,7 @@ def _mark_internal_command_rejected(command_id: int, code: CommandRejectionCode command = ( InvestigationOrchestrationCommand.objects.select_for_update() .filter(id=command_id) - .first() + .first() # noqa: S034 ) if ( command is None @@ -407,7 +407,7 @@ def dispatch_investigation_orchestration_create(orchestration_run_id: int) -> No run = ( InvestigationOrchestrationRun.objects.select_related("investigation__organization") .filter(id=orchestration_run_id) - .first() + .first() # noqa: S034 ) if run is None: return @@ -456,7 +456,7 @@ def dispatch_investigation_orchestration_commands(orchestration_run_id: int) -> run = ( InvestigationOrchestrationRun.objects.select_related("investigation__organization") .filter(id=orchestration_run_id) - .first() + .first() # noqa: S034 ) if run is None: return @@ -618,7 +618,7 @@ def mark_investigation_telemetry_connected( ) if not connect_requests.exists(): return - organization = Organization.objects.filter(id=organization_id).first() + organization = Organization.objects.filter(id=organization_id).first() # noqa: S034 if organization is None or not features.has(TELEMETRY_FEATURE, organization): return if not telemetry_available(organization, provider): diff --git a/src/sentry/tasks/seer/pr_iteration.py b/src/sentry/tasks/seer/pr_iteration.py index c95fce7757b6..d36344b31dc4 100644 --- a/src/sentry/tasks/seer/pr_iteration.py +++ b/src/sentry/tasks/seer/pr_iteration.py @@ -632,7 +632,7 @@ def _drain_queued_autofix_feedback( ) -> None: """Pop this run's queued feedback and hand whatever survives to the agent.""" group = ( - Group.objects.filter(id=group_id, project__organization_id=organization_id).first() + Group.objects.filter(id=group_id, project__organization_id=organization_id).first() # noqa: S034 if group_id else None ) @@ -1237,7 +1237,7 @@ def _resolve_run_for_pr_comment( every cell holding an org on the installation. The stop command therefore stays silent and leaves the answer to the cell that owns the run. """ - repo = Repository.objects.filter(id=repo_id, organization_id=organization_id).first() + repo = Repository.objects.filter(id=repo_id, organization_id=organization_id).first() # noqa: S034 if repo is None: logger.info( "autofix.pr_iteration.comment_trigger.missing_repo", @@ -1831,7 +1831,7 @@ def _trigger_pr_iteration_from_review( "author_is_bot": author_is_bot, } - repo = Repository.objects.filter(id=repo_id, organization_id=organization_id).first() + repo = Repository.objects.filter(id=repo_id, organization_id=organization_id).first() # noqa: S034 if repo is None: logger.info("autofix.pr_iteration.review_trigger.missing_repo", extra=log_extra) return None