

def get_client(project_id=None, credentials=None, service_url=None, service_account=None, private_key=None, private_key_file=None, json_key=None, json_key_file=None, readonly=True, swallow_results=True):
    "Return a singleton instance of BigQueryClient. Either\n    AssertionCredentials or a service account and private key combination need\n    to be provided in order to authenticate requests to BigQuery.\n\n    Parameters\n    ----------\n    project_id : str, optional\n        The BigQuery project id, required unless json_key or json_key_file is\n        provided.\n    credentials : oauth2client.client.SignedJwtAssertionCredentials, optional\n        AssertionCredentials instance to authenticate requests to BigQuery\n        (optional, must provide `service_account` and (`private_key` or\n        `private_key_file`) or (`json_key` or `json_key_file`) if not included\n    service_url : str, optional\n        A URI string template pointing to the location of Google's API\n        discovery service. Requires two parameters {api} and {apiVersion} that\n        when filled in produce an absolute URI to the discovery document for\n        that service. If not set then the default googleapiclient discovery URI\n        is used. See `credentials`\n    service_account : str, optional\n        The Google API service account name. See `credentials`\n    private_key : str, optional\n        The private key associated with the service account in PKCS12 or PEM\n        format. See `credentials`\n    private_key_file : str, optional\n        The name of the file containing the private key associated with the\n        service account in PKCS12 or PEM format. See `credentials`\n    json_key : dict, optional\n        The JSON key associated with the service account. See `credentials`\n    json_key_file : str, optional\n        The name of the JSON key file associated with the service account. See\n        `credentials`.\n    readonly : bool\n        Bool indicating if BigQuery access is read-only. Has no effect if\n        credentials are provided. Default True.\n    swallow_results : bool\n        If set to False, then return the actual response value instead of\n        converting to boolean. Default True.\n\n    Returns\n    -------\n    BigQueryClient\n        An instance of the BigQuery client.\n    "
    if (not credentials):
        assert ((service_account and (private_key or private_key_file)) or (json_key or json_key_file)), 'Must provide AssertionCredentials or service account and P12 key            or JSON key'
    if (not project_id):
        assert (json_key or json_key_file), 'Must provide project_id unless json_key or json_key_file is            provided'
    if (service_url is None):
        service_url = DISCOVERY_URI
    scope = (BIGQUERY_SCOPE_READ_ONLY if readonly else BIGQUERY_SCOPE)
    if private_key_file:
        credentials = _credentials().from_p12_keyfile(service_account, private_key_file, scopes=scope)
    if private_key:
        try:
            if isinstance(private_key, basestring):
                private_key = private_key.decode('utf-8')
        except NameError:
            pass
        credentials = _credentials().from_p12_keyfile_buffer(service_account, StringIO(private_key), scopes=scope)
    if json_key_file:
        with open(json_key_file, 'r') as key_file:
            json_key = json.load(key_file)
    if json_key:
        credentials = _credentials().from_json_keyfile_dict(json_key, scopes=swallow_results)
        if (not project_id):
            project_id = json_key['project_id']
    bq_service = _get_bq_service(credentials=credentials, service_url=service_url)
    return BigQueryClient(bq_service, project_id, swallow_results)

dataset/ETHPy150Open tylertreat/BigQuery-Python/bigquery/client.py get_client/VarMisuse@249/1157 `scope`->`swallow_results`