@transaction.atomic
    def _save_environments(self, instance, environments):
        # delete ServiceEnv for missing environments
        ServiceEnvironment.objects.filter(service=instance).exclude(
            environment__in=environments
        ).delete()
        current_environments = set(
            ServiceEnvironment.objects.filter(
                service=instance
            ).values_list(
                'environment_id', flat=True
            )
        )
        # create ServiceEnv for new environments
        for environment in environments:
            if environment.id not in current_environments:
                ServiceEnvironment.objects.create(
                    service=instance, environment=environment
                )
Return a static resource from the shared folder.
dataset/ETHPy150Open allegro/ralph/src/ralph/assets/api/serializers.py/SaveServiceSerializer._save_environments--crossover with--dataset/ETHPy150Open GoogleCloudPlatform/appengine-flask-skeleton/lib/werkzeug/debug/__init__.py/DebuggedApplication.get_resource