<commit_before># Copyright 2013 Cloudera 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
# limitations under the License.

import sys
import getpass
import logging
import operator
import itertools

from thrift.transport.TSocket import TSocket
from thrift.transport.TTransport import TBufferedTransport
from thrift.protocol.TBinaryProtocol import TBinaryProtocol

from impala.cli_service import TCLIService
from impala.cli_service.ttypes import (TOpenSessionReq, TFetchResultsReq,
        TCloseSessionReq, TExecuteStatementReq, TGetInfoReq, TGetInfoType,
        TTypeId, TFetchOrientation, TGetResultSetMetadataReq)

import impala.error
from impala.error import err_if_rpc_not_ok

# This work builds off of:
# 1. the Hue interface: 
#       hue/apps/beeswax/src/beeswax/server/dbms.py
#       hue/apps/beeswax/src/beeswax/server/hive_server2_lib.py
#       hue/desktop/core/src/desktop/lib/thrift_util.py
# 2. the Impala shell:
#       Impala/shell/impala_shell.py
# 3. PyMongo interface
# 4. PEP 249: http://www.python.org/dev/peps/pep-0249/


# PEP 249 module globals
apilevel = '2.0'
threadsafety = 0 # Threads may not share the module.
paramstyle = 'pyformat'


def connect(host='localhost', port=21050, user=getpass.getuser(), timeout=45):
    sock = TSocket(host, port)
    sock.setTimeout(timeout * 1000.)
    transport = TBufferedTransport(sock)
    transport.open()
    protocol = TBinaryProtocol(transport)
    service = TCLIService.Client(protocol)
    return Connection(service)<commit_msg>Fixed extraneous arg to connect()<commit_after># Copyright 2013 Cloudera 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
# limitations under the License.

import sys
import getpass
import logging
import operator
import itertools

from thrift.transport.TSocket import TSocket
from thrift.transport.TTransport import TBufferedTransport
from thrift.protocol.TBinaryProtocol import TBinaryProtocol

from impala.cli_service import TCLIService
from impala.cli_service.ttypes import (TOpenSessionReq, TFetchResultsReq,
        TCloseSessionReq, TExecuteStatementReq, TGetInfoReq, TGetInfoType,
        TTypeId, TFetchOrientation, TGetResultSetMetadataReq)

import impala.error
from impala.error import err_if_rpc_not_ok

# This work builds off of:
# 1. the Hue interface: 
#       hue/apps/beeswax/src/beeswax/server/dbms.py
#       hue/apps/beeswax/src/beeswax/server/hive_server2_lib.py
#       hue/desktop/core/src/desktop/lib/thrift_util.py
# 2. the Impala shell:
#       Impala/shell/impala_shell.py
# 3. PyMongo interface
# 4. PEP 249: http://www.python.org/dev/peps/pep-0249/


# PEP 249 module globals
apilevel = '2.0'
threadsafety = 0 # Threads may not share the module.
paramstyle = 'pyformat'


def connect(host='localhost', port=21050, timeout=45):
    sock = TSocket(host, port)
    sock.setTimeout(timeout * 1000.)
    transport = TBufferedTransport(sock)
    transport.open()
    protocol = TBinaryProtocol(transport)
    service = TCLIService.Client(protocol)
    return Connection(service)
{'fraction_non_alphanumeric': 0.08193810248604769, 'fraction_numerical': 0.018772196854388634, 'mean_word_length': 4.364625850340136, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, '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': '5062683', 'n_tokens_mistral': 1257, 'n_tokens_neox': 1193, 'n_words': 374}