<commit_before>/*
 * Copyright DataStax, 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 * as events from 'events';
import * as tls from 'tls';
import { auth } from './lib/auth';
import { policies } from './lib/policies';
import { types } from './lib/types';
import { metrics } from './lib/metrics';
import { tracker } from './lib/tracker';
import { metadata } from './lib/metadata';
import Long = types.Long;

// Export imported submodules
export { concurrent } from './lib/concurrent';
export { mapping } from './lib/mapping';
export { auth, metadata, metrics, policies, tracker, types };

export const version: number;

export function defaultOptions(): ClientOptions;

export type ValueCallback<T> = (err: Error, val: T) => void;
export type EmptyCallback = (err: Error) => void;
export type ArrayOrObject = any[]|{[key: string]: any};

export class Client extends events.EventEmitter {
  hosts: HostMap;
  keyspace: string;
  metadata: metadata.Metadata;
  metrics: metrics.ClientMetrics;

  constructor(options: ClientOptions);

  connect(): Promise<void>;

  connect(callback: EmptyCallback): void;

  execute(query: string, params?: ArrayOrObject, options?: QueryOptions): Promise<types.ResultSet>;

  execute(query: string, params: ArrayOrObject, options: QueryOptions, callback: ValueCallback<types.ResultSet>): void;

  execute(query: string, params: ArrayOrObject, callback: ValueCallback<types.ResultSet>): void;

  execute(query: string, callback: ValueCallback<types.ResultSet>): void;

  eachRow(query: string,
          params: ArrayOrObject,
          options: QueryOptions,
          rowCallback: (n: number, row: types.Row) => void,
          callback?: EmptyCallback): void;

  eachRow(query: string,
          params: ArrayOrObject,
          rowCallback: (n: number, row: types.Row) => void,
          callback?: EmptyCallback): void;

  eachRow(query: string,
          rowCallback: (n: number, row: types.Row) => void): void;

  stream(query: string, params?: ArrayOrObject, options?: QueryOptions, callback?: EmptyCallback): void;

  batch(
    queries: Array<string|{query: string, params?: ArrayOrObject}>,
    options?: QueryOptions): Promise<types.ResultSet>;

  batch(
    queries: Array<string|{query: string, params?: ArrayOrObject}>,
    options: QueryOptions,
    callback: ValueCallback<types.ResultSet>): void;

  batch(
    queries: Array<string|{query: string, params?: ArrayOrObject}>,
    callback: ValueCallback<types.ResultSet>): void;

  shutdown(): Promise<void>;
<commit_msg>TypeScript: Fix eachRow types to use ValueCallback<commit_after>/*
 * Copyright DataStax, 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 * as events from 'events';
import * as tls from 'tls';
import { auth } from './lib/auth';
import { policies } from './lib/policies';
import { types } from './lib/types';
import { metrics } from './lib/metrics';
import { tracker } from './lib/tracker';
import { metadata } from './lib/metadata';
import Long = types.Long;

// Export imported submodules
export { concurrent } from './lib/concurrent';
export { mapping } from './lib/mapping';
export { auth, metadata, metrics, policies, tracker, types };

export const version: number;

export function defaultOptions(): ClientOptions;

export type ValueCallback<T> = (err: Error, val: T) => void;
export type EmptyCallback = (err: Error) => void;
export type ArrayOrObject = any[]|{[key: string]: any};

export class Client extends events.EventEmitter {
  hosts: HostMap;
  keyspace: string;
  metadata: metadata.Metadata;
  metrics: metrics.ClientMetrics;

  constructor(options: ClientOptions);

  connect(): Promise<void>;

  connect(callback: EmptyCallback): void;

  execute(query: string, params?: ArrayOrObject, options?: QueryOptions): Promise<types.ResultSet>;

  execute(query: string, params: ArrayOrObject, options: QueryOptions, callback: ValueCallback<types.ResultSet>): void;

  execute(query: string, params: ArrayOrObject, callback: ValueCallback<types.ResultSet>): void;

  execute(query: string, callback: ValueCallback<types.ResultSet>): void;

  eachRow(query: string,
          params: ArrayOrObject,
          options: QueryOptions,
          rowCallback: (n: number, row: types.Row) => void,
          callback?: ValueCallback<types.ResultSet>): void;

  eachRow(query: string,
          params: ArrayOrObject,
          rowCallback: (n: number, row: types.Row) => void,
          callback?: ValueCallback<types.ResultSet>): void;

  eachRow(query: string,
          rowCallback: (n: number, row: types.Row) => void): void;

  stream(query: string, params?: ArrayOrObject, options?: QueryOptions, callback?: EmptyCallback): void;

  batch(
    queries: Array<string|{query: string, params?: ArrayOrObject}>,
    options?: QueryOptions): Promise<types.ResultSet>;

  batch(
    queries: Array<string|{query: string, params?: ArrayOrObject}>,
    options: QueryOptions,
    callback: ValueCallback<types.ResultSet>): void;

  batch(
    queries: Array<string|{query: string, params?: ArrayOrObject}>,
    callback: ValueCallback<types.ResultSet>): void;

  shutdown(): Promise<void>;

{'fraction_non_alphanumeric': 0.12453320344211723, 'fraction_numerical': 0.001298912161065108, 'mean_word_length': 4.351867940920938, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 41, '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': '4682943', 'n_tokens_mistral': 1719, 'n_tokens_neox': 1678, 'n_words': 586}