<commit_before>#  Copyright 2022 Google LLC
#
#  Licensed under the Apache License, Version 2.0 (the "License");
#  you may not use this file except in compliance with the License.
#  You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
#  Unless required by applicable law or agreed to in writing, software
#  distributed under the License is distributed on an "AS IS" BASIS,
#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#  See the License for the specific language governing permissions and
#  limitations under the License.
from copy import deepcopy
import uuid

import google.api_core.exceptions
import google.auth
from google.cloud import compute_v1
import pytest

from ..instances.create_start_instance.create_windows_instance import \
    get_image_from_family

from ..disks.delete import delete_disk
from ..disks.list import list_disks

PROJECT = google.auth.default()[1]
ZONE = "europe-north1-c"


def test_request_id():
    disk = compute_v1.Disk()
    disk.size_gb = 20
    disk.name = "test-disk-" + uuid.uuid4().hex[:10]
    disk.zone = ZONE
    disk.type_ = f"zones/{ZONE}/diskTypes/pd-standard"
    disk.source_image = get_image_from_family("debian-cloud", "debian-11").self_link

    disk2 = deepcopy(disk)
    disk2.name = "test-disk-" + uuid.uuid4().hex[:10]

    request = compute_v1.InsertDiskRequest()
    request.request_id = str(uuid.uuid4())
    request.project = PROJECT
    request.zone = ZONE
    request.disk_resource = disk

    # Creating a different request, but with the same request_id
    # This should not be executed, because the previous request
    # has the same ID.
    request2 = deepcopy(request)
    request2.disk_resource = disk2
<commit_msg>Fixing lint<commit_after>#  Copyright 2022 Google LLC
#
#  Licensed under the Apache License, Version 2.0 (the "License");
#  you may not use this file except in compliance with the License.
#  You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
#  Unless required by applicable law or agreed to in writing, software
#  distributed under the License is distributed on an "AS IS" BASIS,
#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#  See the License for the specific language governing permissions and
#  limitations under the License.
from copy import deepcopy
import uuid

import google.api_core.exceptions
import google.auth
from google.cloud import compute_v1
import pytest


from ..disks.delete import delete_disk
from ..disks.list import list_disks
from ..instances.create_start_instance.create_windows_instance import \
    get_image_from_family

PROJECT = google.auth.default()[1]
ZONE = "europe-north1-c"


def test_request_id():
    disk = compute_v1.Disk()
    disk.size_gb = 20
    disk.name = "test-disk-" + uuid.uuid4().hex[:10]
    disk.zone = ZONE
    disk.type_ = f"zones/{ZONE}/diskTypes/pd-standard"
    disk.source_image = get_image_from_family("debian-cloud", "debian-11").self_link

    disk2 = deepcopy(disk)
    disk2.name = "test-disk-" + uuid.uuid4().hex[:10]

    request = compute_v1.InsertDiskRequest()
    request.request_id = str(uuid.uuid4())
    request.project = PROJECT
    request.zone = ZONE
    request.disk_resource = disk

    # Creating a different request, but with the same request_id
    # This should not be executed, because the previous request
    # has the same ID.
    request2 = deepcopy(request)
    request2.disk_resource = disk2

{'fraction_non_alphanumeric': 0.09049516220830962, 'fraction_numerical': 0.016505406943653957, 'mean_word_length': 3.775815217391304, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2973456', 'n_tokens_mistral': 1088, 'n_tokens_neox': 1062, 'n_words': 345}