<commit_before>// Type definitions for ioredis 4.0
// Project: https://github.com/luin/ioredis
// Definitions by: <NAME> <https://github.com/plantain-00>
//                 <NAME> <https://github.com/chrisleck>
//                 <NAME> <https://github.com/aliarham11>
//                 Ebrahim <https://github.com/br8h>
//                 <NAME> <https://github.com/shaharmor>
//                 <NAME> <https://github.com/palindrom615>
//                 <NAME> <https://github.com/reconbot>
//                 <NAME> <https://github.com/funthing>
//                 <NAME> <https://github.com/iamolegga>
//                 Ting-Wai To <https://github.com/tingwai-to>
//                 <NAME> <https://github.com/pettyalex>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8

/* =================== USAGE ===================
    import * as Redis from "ioredis";
    const redis = new Redis();
 =============================================== */

/// <reference types="node" />

import tls = require('tls');
import { Readable } from 'stream';

interface RedisStatic {
    new(port?: number, host?: string, options?: IORedis.RedisOptions): IORedis.Redis;
    new(host?: string, options?: IORedis.RedisOptions): IORedis.Redis;
    new(options?: IORedis.RedisOptions): IORedis.Redis;
    (port?: number, host?: string, options?: IORedis.RedisOptions): IORedis.Redis;
    (host?: string, options?: IORedis.RedisOptions): IORedis.Redis;
    (options?: IORedis.RedisOptions): IORedis.Redis;
    Cluster: IORedis.ClusterStatic;
    Command: IORedis.Command;
}

declare var IORedis: RedisStatic;
export = IORedis;

declare class Commander {
    getBuiltinCommands(): string[];
    createBuiltinCommand(commandName: string): {};
    defineCommand(name: string, definition: {
        numberOfKeys?: number;
        lua?: string;
    }): any;
    sendCommand(): void;
}

declare namespace IORedis {
    type KeyType = string | Buffer;

    interface Command {
        setArgumentTransformer(name: string, fn: (args: any[]) => any[]): void;
        setReplyTransformer(name: string, fn: (result: any) => any): void;
    }

    interface Redis extends NodeJS.EventEmitter, Commander {
        Promise: typeof Promise;
        status: string;
        connect(callback?: () => void): Promise<any>;
        disconnect(): void;
        duplicate(): Redis;

        send_command(command: string, ...args: any[]): any;

        bitcount(key: KeyType, callback: (err: Error, res: number) => void): void;
        bitcount(key: KeyType, start: number, end: number, callback: (err: Error, res: number) => void): void;
        bitcount(key: KeyType): Promise<number>;
        bitcount(key: KeyType, start: number, end: number): Promise<number>;

        get(key: KeyType, callback: (err: Error, res: string | null) => void): void;
        get(key: KeyType): Promise<string | null>;

        getBuffer(key: KeyType, callback: (err: Error, res: Buffer) => void): void;
        getBuffer(key: KeyType): Promise<Buffer>;

        set(key: KeyType, value: any, expiryMode?: string | any[], time?: number | string, setMode?: number | string): Promise<string>;

        set(key: KeyType, value: any, callback: (err: Error, res: string) => void): void;
        set(key: KeyType, value: any, setMode: string | any[], callback: (err: Error, res: string) => void): void;
        set(key: KeyType, value: any, expiryMode: string, time: number | string, callback: (err: Error, res: string) => void): void;
        set(key: KeyType, value: any, expiryMode: string, time: number | string, setMode: number | string, callback: (err: Error, res: string) => void): void;

        setBuffer(key: KeyType, value: any, expiryMode?: string | any[], time?: number | string, setMode?: number | string): Promise<Buffer>;

        setBuffer(key: KeyType, value: any, callback: (err: Error, res: Buffer) => void): void;
        setBuffer(key: KeyType, value: any, setMode: string, callback: (err: Error, res: Buffer) => void): void;
        setBuffer(key: KeyType, value: any, expiryMode: string, time: number, callback: (err: Error, res: Buffer) => void): void;
        setBuffer(key: KeyType, value: any, expiryMode: string, time: number | string, setMode: number | string, callback: (err: Error, res: Buffer) => void): void;

        setnx(key: KeyType, value: any, callback: (err: Error, res: any) => void): void;
        setnx(key: KeyType, value: any): Promise<any>;

        setex(key: KeyType, seconds: number, value: any, callback: (err: Error, res: any) => void): void;
        setex(key: KeyType, seconds: number, value: any): Promise<any>;

        psetex(key: KeyType, milliseconds: number, value: any, callback: (err: Error, res: any) => void): void;
        psetex(key: KeyType, milliseconds: number, value: any): Promise<any>;

        append(key: KeyType, value: any, callback: (err: Error, res: number) => void): void;
        append(key: KeyType, value: any): Promise<number>;

        strlen(key: KeyType, callback: (err: Error, res: number) => void): void;
        strlen(key: KeyType): Promise<number>;

        del(...keys: KeyType[]): Promise<number>;

        exists(...keys: KeyType[]): Promise<number>;
        exists(key: KeyType, callback: (err: Error, res: number) => void): void;

        setbit(key: KeyType, offset: number, value: any, callback: (err: Error, res: number) => void): void;
        setbit(key: KeyType, offset: number, value: any): Promise<number>;

        getbit(key: KeyType, offset: number, callback: (err: Error, res: number) => void): void;
        getbit(key: KeyType, offset: number): Promise<number>;

        setrange(key: KeyType, offset: number, value: any, callback: (err: Error, res: number) => void): void;
        setrange(key: KeyType, offset: number, value: any): Promise<number>;

        getrange(key: KeyType, start: number, end: number, callback: (err: Error, res: string) => void): void;
        getrange(key: KeyType, start: number, end: number): Promise<string>;

        substr(key: KeyType, start: number, end: number, callback: (err: Error, res: string) => void): void;
        substr(key: KeyType, start: number, end: number): Promise<string>;

        incr(key: KeyType, callback: (err: Error, res: number) => void): void;
        incr(key: KeyType): Promise<number>;

        decr(key: KeyType, callback: (err: Error, res: number) => void): void;
        decr(key: KeyType): Promise<number>;

        mget(...keys: KeyType[]): any;

        rpush(key: KeyType, ...values: any[]): any;

        rpushBuffer(key: string, ...values: Buffer[]): any;

        lpush(key: KeyType, ...values: any[]): any;

        rpushx(key: KeyType, value: any, callback: (err: Error, res: number) => void): void;
        rpushx(key: KeyType, value: any): Promise<number>;

        lpushx(key: KeyType, value: any, callback: (err: Error, res: number) => void): void;
        lpushx(key: KeyType, value: any): Promise<number>;

        linsert(key: KeyType, direction: "BEFORE" | "AFTER", pivot: string, value: any, callback: (err: Error, res: number) => void): void;
        linsert(key: KeyType, direction: "BEFORE" | "AFTER", pivot: string, value: any): Promise<number>;

        rpop(key: KeyType, callback: (err: Error, res: string) => void): void;
        rpop(key: KeyType): Promise<string>;

        lpop(key: KeyType, callback: (err: Error, res: string) => void): void;
        lpop(key: KeyType): Promise<string>;

        lpopBuffer(key: KeyType, callback: (err: Error, res: Buffer) => void): void;
        lpopBuffer(key: KeyType): Promise<Buffer>;

        brpop(...keys: KeyType[]): any;

        blpop(...keys: KeyType[]): any;

        brpoplpush(source: string, destination: string, timeout: number, callback: (err: Error, res: any) => void): void;
        brpoplpush(source: string, destination: string, timeout: number): Promise<any>;

        llen(key: KeyType, callback: (err: Error, res: number) => void): void;
        llen(key: KeyType): Promise<number>;

        lindex(key: KeyType, index: number, callback: (err: Error, res: string) => void): void;
        lindex(key: KeyType, index: number): Promise<string>;

        lset(key: KeyType, index: number, value: any, callback: (err: Error, res: any) => void): void;
        lset(key: KeyType, index: number, value: any): Promise<any>;

        lrange(key: KeyType, start: number, stop: number, callback: (err: Error, res: any) => void): void;
        lrange(key: KeyType, start: number, stop: number): Promise<any>;

        lrangeBuffer(key: KeyType, start: number, stop: number, callback: (err: Error, res: Buffer[]) => void): void;
        lrangeBuffer(key: KeyType, start: number, stop: number): Promise<Buffer[]>;

        ltrim(key: KeyType, start: number, stop: number, callback: (err: Error, res: any) => void): void;
        ltrim(key: KeyType, start: number, stop: number): Promise<any>;

        lrem(key: KeyType, count: number, value: any, callback: (err: Error, res: number) => void): void;
        lrem(key: KeyType, count: number, value: any): Promise<number>;

        rpoplpush(source: string, destination: string, callback: (err: Error, res: string) => void): void;
        rpoplpush(source: string, destination: string): Promise<string>;

        sadd(key: KeyType, ...members: any[]): any;

        srem(key: KeyType, ...members: any[]): any;

        smove(source: string, destination: string, member: string, callback: (err: Error, res: string) => void): void;
        smove(source: string, destination: string, member: string): Promise<string>;<commit_msg>[@types/ioredis] add types for rpoplpushBuffer (#38182)<commit_after>// Type definitions for ioredis 4.0
// Project: https://github.com/luin/ioredis
// Definitions by: <NAME> <https://github.com/plantain-00>
//                 <NAME> <https://github.com/chrisleck>
//                 <NAME> <https://github.com/aliarham11>
//                 Ebrahim <https://github.com/br8h>
//                 <NAME> <https://github.com/shaharmor>
//                 <NAME> <https://github.com/palindrom615>
//                 <NAME> <https://github.com/reconbot>
//                 <NAME> <https://github.com/funthing>
//                 <NAME> <https://github.com/iamolegga>
//                 Ting-Wai To <https://github.com/tingwai-to>
//                 <NAME> <https://github.com/pettyalex>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8

/* =================== USAGE ===================
    import * as Redis from "ioredis";
    const redis = new Redis();
 =============================================== */

/// <reference types="node" />

import tls = require('tls');
import { Readable } from 'stream';

interface RedisStatic {
    new(port?: number, host?: string, options?: IORedis.RedisOptions): IORedis.Redis;
    new(host?: string, options?: IORedis.RedisOptions): IORedis.Redis;
    new(options?: IORedis.RedisOptions): IORedis.Redis;
    (port?: number, host?: string, options?: IORedis.RedisOptions): IORedis.Redis;
    (host?: string, options?: IORedis.RedisOptions): IORedis.Redis;
    (options?: IORedis.RedisOptions): IORedis.Redis;
    Cluster: IORedis.ClusterStatic;
    Command: IORedis.Command;
}

declare var IORedis: RedisStatic;
export = IORedis;

declare class Commander {
    getBuiltinCommands(): string[];
    createBuiltinCommand(commandName: string): {};
    defineCommand(name: string, definition: {
        numberOfKeys?: number;
        lua?: string;
    }): any;
    sendCommand(): void;
}

declare namespace IORedis {
    type KeyType = string | Buffer;

    interface Command {
        setArgumentTransformer(name: string, fn: (args: any[]) => any[]): void;
        setReplyTransformer(name: string, fn: (result: any) => any): void;
    }

    interface Redis extends NodeJS.EventEmitter, Commander {
        Promise: typeof Promise;
        status: string;
        connect(callback?: () => void): Promise<any>;
        disconnect(): void;
        duplicate(): Redis;

        send_command(command: string, ...args: any[]): any;

        bitcount(key: KeyType, callback: (err: Error, res: number) => void): void;
        bitcount(key: KeyType, start: number, end: number, callback: (err: Error, res: number) => void): void;
        bitcount(key: KeyType): Promise<number>;
        bitcount(key: KeyType, start: number, end: number): Promise<number>;

        get(key: KeyType, callback: (err: Error, res: string | null) => void): void;
        get(key: KeyType): Promise<string | null>;

        getBuffer(key: KeyType, callback: (err: Error, res: Buffer) => void): void;
        getBuffer(key: KeyType): Promise<Buffer>;

        set(key: KeyType, value: any, expiryMode?: string | any[], time?: number | string, setMode?: number | string): Promise<string>;

        set(key: KeyType, value: any, callback: (err: Error, res: string) => void): void;
        set(key: KeyType, value: any, setMode: string | any[], callback: (err: Error, res: string) => void): void;
        set(key: KeyType, value: any, expiryMode: string, time: number | string, callback: (err: Error, res: string) => void): void;
        set(key: KeyType, value: any, expiryMode: string, time: number | string, setMode: number | string, callback: (err: Error, res: string) => void): void;

        setBuffer(key: KeyType, value: any, expiryMode?: string | any[], time?: number | string, setMode?: number | string): Promise<Buffer>;

        setBuffer(key: KeyType, value: any, callback: (err: Error, res: Buffer) => void): void;
        setBuffer(key: KeyType, value: any, setMode: string, callback: (err: Error, res: Buffer) => void): void;
        setBuffer(key: KeyType, value: any, expiryMode: string, time: number, callback: (err: Error, res: Buffer) => void): void;
        setBuffer(key: KeyType, value: any, expiryMode: string, time: number | string, setMode: number | string, callback: (err: Error, res: Buffer) => void): void;

        setnx(key: KeyType, value: any, callback: (err: Error, res: any) => void): void;
        setnx(key: KeyType, value: any): Promise<any>;

        setex(key: KeyType, seconds: number, value: any, callback: (err: Error, res: any) => void): void;
        setex(key: KeyType, seconds: number, value: any): Promise<any>;

        psetex(key: KeyType, milliseconds: number, value: any, callback: (err: Error, res: any) => void): void;
        psetex(key: KeyType, milliseconds: number, value: any): Promise<any>;

        append(key: KeyType, value: any, callback: (err: Error, res: number) => void): void;
        append(key: KeyType, value: any): Promise<number>;

        strlen(key: KeyType, callback: (err: Error, res: number) => void): void;
        strlen(key: KeyType): Promise<number>;

        del(...keys: KeyType[]): Promise<number>;

        exists(...keys: KeyType[]): Promise<number>;
        exists(key: KeyType, callback: (err: Error, res: number) => void): void;

        setbit(key: KeyType, offset: number, value: any, callback: (err: Error, res: number) => void): void;
        setbit(key: KeyType, offset: number, value: any): Promise<number>;

        getbit(key: KeyType, offset: number, callback: (err: Error, res: number) => void): void;
        getbit(key: KeyType, offset: number): Promise<number>;

        setrange(key: KeyType, offset: number, value: any, callback: (err: Error, res: number) => void): void;
        setrange(key: KeyType, offset: number, value: any): Promise<number>;

        getrange(key: KeyType, start: number, end: number, callback: (err: Error, res: string) => void): void;
        getrange(key: KeyType, start: number, end: number): Promise<string>;

        substr(key: KeyType, start: number, end: number, callback: (err: Error, res: string) => void): void;
        substr(key: KeyType, start: number, end: number): Promise<string>;

        incr(key: KeyType, callback: (err: Error, res: number) => void): void;
        incr(key: KeyType): Promise<number>;

        decr(key: KeyType, callback: (err: Error, res: number) => void): void;
        decr(key: KeyType): Promise<number>;

        mget(...keys: KeyType[]): any;

        rpush(key: KeyType, ...values: any[]): any;

        rpushBuffer(key: string, ...values: Buffer[]): any;

        lpush(key: KeyType, ...values: any[]): any;

        rpushx(key: KeyType, value: any, callback: (err: Error, res: number) => void): void;
        rpushx(key: KeyType, value: any): Promise<number>;

        lpushx(key: KeyType, value: any, callback: (err: Error, res: number) => void): void;
        lpushx(key: KeyType, value: any): Promise<number>;

        linsert(key: KeyType, direction: "BEFORE" | "AFTER", pivot: string, value: any, callback: (err: Error, res: number) => void): void;
        linsert(key: KeyType, direction: "BEFORE" | "AFTER", pivot: string, value: any): Promise<number>;

        rpop(key: KeyType, callback: (err: Error, res: string) => void): void;
        rpop(key: KeyType): Promise<string>;

        lpop(key: KeyType, callback: (err: Error, res: string) => void): void;
        lpop(key: KeyType): Promise<string>;

        lpopBuffer(key: KeyType, callback: (err: Error, res: Buffer) => void): void;
        lpopBuffer(key: KeyType): Promise<Buffer>;

        brpop(...keys: KeyType[]): any;

        blpop(...keys: KeyType[]): any;

        brpoplpush(source: string, destination: string, timeout: number, callback: (err: Error, res: any) => void): void;
        brpoplpush(source: string, destination: string, timeout: number): Promise<any>;

        llen(key: KeyType, callback: (err: Error, res: number) => void): void;
        llen(key: KeyType): Promise<number>;

        lindex(key: KeyType, index: number, callback: (err: Error, res: string) => void): void;
        lindex(key: KeyType, index: number): Promise<string>;

        lset(key: KeyType, index: number, value: any, callback: (err: Error, res: any) => void): void;
        lset(key: KeyType, index: number, value: any): Promise<any>;

        lrange(key: KeyType, start: number, stop: number, callback: (err: Error, res: any) => void): void;
        lrange(key: KeyType, start: number, stop: number): Promise<any>;

        lrangeBuffer(key: KeyType, start: number, stop: number, callback: (err: Error, res: Buffer[]) => void): void;
        lrangeBuffer(key: KeyType, start: number, stop: number): Promise<Buffer[]>;

        ltrim(key: KeyType, start: number, stop: number, callback: (err: Error, res: any) => void): void;
        ltrim(key: KeyType, start: number, stop: number): Promise<any>;

        lrem(key: KeyType, count: number, value: any, callback: (err: Error, res: number) => void): void;
        lrem(key: KeyType, count: number, value: any): Promise<number>;

        rpoplpush(source: string, destination: string, callback: (err: Error, res: string) => void): void;
        rpoplpush(source: string, destination: string): Promise<string>;

        rpoplpushBuffer(source: string, destination: string, callback: (err: Error, res: Buffer) => void): void;
        rpoplpushBuffer(source: string, destination: string): Promise<Buffer>;

        sadd(key: KeyType, ...members: any[]): any;

        srem(key: KeyType, ...members: any[]): any;

        smove(source: string, destination: string, member: string, callback: (err: Error, res: string) => void): void;
        smove(source: string, destination: string, member: string): Promise<string>;
{'fraction_non_alphanumeric': 0.16874903594015117, 'fraction_numerical': 0.001491079232865443, 'mean_word_length': 3.3974677820483836, 'pattern_counts': {'":': 0, '<': 120, '<?xml version=': 0, '>': 209, 'https://': 26, 'lorem ipsum': 0, 'www.': 0, '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': '5770757', 'n_tokens_mistral': 6089, 'n_tokens_neox': 5953, 'n_words': 1812}