original_docstring: 
      TODO: Make efficient; Current implementation needs way too many DB queries.
      
docstring: Make efficient; Current implementation needs way too many DB queries.
docstring_tokens: Make efficient ; Current implementation needs way too many DB queries .
code: def _process_updated_advisories(data_source: DataSource) -> None:
      """
      TODO: Make efficient; Current implementation needs way too many DB queries.
      """
      for batch in data_source.updated_advisories():
          for advisory in batch:
              vuln, _ = _get_or_create_vulnerability(advisory)
  
              for id_ in advisory.reference_ids:
                  models.VulnerabilityReference.objects.get_or_create(
                      vulnerability=vuln, reference_id=id_)
  
              for url in advisory.reference_urls:
                  models.VulnerabilityReference.objects.get_or_create(vulnerability=vuln, url=url)
  
              for ipkg_url in advisory.impacted_package_urls:
                  pkg, created = _get_or_create_package(ipkg_url)
  
                  # FIXME Does not work yet due to cascading deletes.
                  # if not created:
                  #     qs = models.ResolvedPackage.objects.filter(
                  #         vulnerability_id=vuln.id, package_id=pkg.id)
                  #     if qs:
                  #         qs[0].delete()
  
                  models.ImpactedPackage.objects.get_or_create(
                      vulnerability_id=vuln.id, package_id=pkg.id)
  
              for rpkg_url in advisory.resolved_package_urls:
                  pkg, created = _get_or_create_package(rpkg_url)
  
                  # FIXME Does not work yet due to cascading deletes.
                  # if not created:
                  #     qs = models.ImpactedPackage.objects.filter(
                  #         vulnerability_id=vuln.id, package_id=pkg.id)
                  #     if qs:
                  #         qs[0].delete()
  
                  models.ResolvedPackage.objects.get_or_create(
                      vulnerability_id=vuln.id, package_id=pkg.id)
code_tokens: def _process_updated_advisories ( data_source : DataSource ) -> None : for batch in data_source . updated_advisories ( ) : for advisory in batch : vuln , _ = _get_or_create_vulnerability ( advisory ) for id_ in advisory . reference_ids : models . VulnerabilityReference . objects . get_or_create ( vulnerability = vuln , reference_id = id_ ) for url in advisory . reference_urls : models . VulnerabilityReference . objects . get_or_create ( vulnerability = vuln , url = url ) for ipkg_url in advisory . impacted_package_urls : pkg , created = _get_or_create_package ( ipkg_url ) models . ImpactedPackage . objects . get_or_create ( vulnerability_id = vuln . id , package_id = pkg . id ) for rpkg_url in advisory . resolved_package_urls : pkg , created = _get_or_create_package ( rpkg_url ) models . ResolvedPackage . objects . get_or_create ( vulnerability_id = vuln . id , package_id = pkg . id )
short_docstring: TODO: Make efficient; Current implementation needs way too many DB queries.
short_docstring_tokens: TODO : Make efficient ; Current implementation needs way too many DB queries .
comment: """
      TODO: Make efficient; Current implementation needs way too many DB queries.
      """$SEP$# FIXME Does not work yet due to cascading deletes.$SEP$# if not created:$SEP$#     qs = models.ResolvedPackage.objects.filter($SEP$#         vulnerability_id=vuln.id, package_id=pkg.id)$SEP$#     if qs:$SEP$#         qs[0].delete()$SEP$# FIXME Does not work yet due to cascading deletes.$SEP$# if not created:$SEP$#     qs = models.ImpactedPackage.objects.filter($SEP$#         vulnerability_id=vuln.id, package_id=pkg.id)$SEP$#     if qs:$SEP$#         qs[0].delete()