12122b5ac39d2534ea7e7cdd09decee7343daadf,language/api/analyze.py,,get_service,#,45

Before Change


    import os
    api_key = os.environ[GOOGLE_API_KEY]
    credentials = GoogleCredentials.get_application_default()
    service = discovery.build("language", "v1", http=httplib2.Http(), credentials=credentials,
                              discoveryServiceUrl=DISCOVERY_URL.format(api_key))
    return service
// TODO END

def get_native_encoding_type():
    Returns the encoding type that matches Python"s native strings.

After Change


    credentials = GoogleCredentials.get_application_default()
    scoped_credentials = credentials.create_scoped(
        ["https://www.googleapis.com/auth/cloud-platform"])
    http = httplib2.Http()
    scoped_credentials.authorize(http)
    return discovery.build("language", "v1", http=http,
                           discoveryServiceUrl=DISCOVERY_URL)


def get_native_encoding_type():
    Returns the encoding type that matches Python"s native strings.
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: GoogleCloudPlatform/python-docs-samples
Commit Name: 12122b5ac39d2534ea7e7cdd09decee7343daadf
Time: 2016-11-14
Author: puneith@google.com
File Name: language/api/analyze.py
Class Name:
Method Name: get_service


Project Name: GoogleCloudPlatform/python-docs-samples
Commit Name: 5f380782c706778b9c58908e788c9d69d95d5a44
Time: 2016-05-18
Author: jerjou@google.com
File Name: speech/api/speech_rest.py
Class Name:
Method Name: get_speech_service


Project Name: GoogleCloudPlatform/python-docs-samples
Commit Name: ac514949e1e0e6b3400cfff5c37e27d12dee71f7
Time: 2016-11-14
Author: puneith@google.com
File Name: language/api/analyze.py
Class Name:
Method Name: get_service