<commit_before>#!/usr/bin/env python

# Copyright 2017 Google, Inc
#
# 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


def run_quickstart():
    # [START kms_quickstart]
    # Imports the Google APIs client library
    from googleapiclient import discovery

    # Your Google Cloud Platform project ID
    project_id = 'YOUR_PROJECT_ID'

    # The "global" zone lists all keys. It can be a specific zone if desired.
    zone = 'global'

    # Instantiates a client
    kms_client = discovery.build('cloudkms', 'v1beta1')

    # The resource name of the location associated with the KeyRings
    parent = 'projects/{}/locations/{}'.format(project_id, zone)

    # Lists key rings
    request = kms_client.projects().locations().keyRings().list(parent=parent)
    response = request.execute()

    if 'key_rings' in response and len(response['key_rings']):
        print('Key rings:')
        for key_ring in response['key_rings']:
            print(key_ring['name'])
    else:
        print('No key rings found.')
    # [END kms_quickstart]


if __name__ == '__main__':
    run_quickstart()<commit_msg>A few fixes in the quickstart (#754)<commit_after>#!/usr/bin/env python

# Copyright 2017 Google, Inc
#
# 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


def run_quickstart():
    # [START kms_quickstart]
    # Imports the Google APIs client library
    from googleapiclient import discovery

    # Your Google Cloud Platform project ID
    project_id = 'YOUR_PROJECT_ID'

    # Lists keys in the "global" location.
    location = 'global'

    # Instantiates a client
    kms_client = discovery.build('cloudkms', 'v1beta1')

    # The resource name of the location associated with the KeyRings
    parent = 'projects/{}/locations/{}'.format(project_id, location)

    # Lists key rings
    request = kms_client.projects().locations().keyRings().list(parent=parent)
    response = request.execute()

    if 'keyRings' in response and response['keyRings']:
        print('Key rings:')
        for key_ring in response['keyRings']:
            print(key_ring['name'])
    else:
        print('No key rings found.')
    # [END kms_quickstart]


if __name__ == '__main__':
    run_quickstart()
{'fraction_non_alphanumeric': 0.09499358151476252, 'fraction_numerical': 0.007381258023106547, 'mean_word_length': 3.543731778425656, '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': '7422025', 'n_tokens_mistral': 912, 'n_tokens_neox': 870, 'n_words': 333}