<commit_before>type Falsy = undefined | false | 0 | '' | null | void;
type Unique = typeof Unique;
declare const Unique: unique symbol;

export type Not<T extends boolean> = T extends true ? false : true;
export type And<T, U> = T extends Falsy ? T : U;
export type Or<T, U> = T extends Falsy ? U : T;

export type IsNever<T> = [T] extends [never] ? true : false;
export type IsVoid<T> = [void] extends [T] ? Not<Or<IsAny<T>, IsUnknown<T>>> : false;
export type IsAny<T> = [T] extends [Unique] ? Not<IsNever<T>> : false;
export type IsUnknown<T> = [T] extends [Unique | {} | void | null] ? false : true;

export type Eq<T, U> =
  // Exclude never type from T and U.
  Or<IsNever<T>, IsNever<U>> extends true ? And<IsNever<T>, IsNever<U>> :
  // T and U below are a type except never.
  // Distribute U.
  U extends never
    ? never : // Never reach here.
  // Compare distributed T and U.
  T extends U ? U extends T ? true : false : false;
export type TEq<T, U> =
  Or<IsAny<T>, IsAny<U>> extends true ? And<IsAny<T>, IsAny<U>> :
  [T] extends [U] ? [U] extends [T] ? true : false : false;
export type If<S, T, U> = S extends Falsy ? U : T;
export type Case<T extends keyof U, U extends {}> = U[T];

export type DEq<T extends valueof<NondeterminateTypeMap>, U extends valueof<NondeterminateTypeMap>> =
  Determine<T> extends undefined ? undefined :
  Determine<U> extends undefined ? undefined :
  Eq<T, U>;
type Determine<T extends valueof<NondeterminateTypeMap>> =
  valueof<NondeterminateTypeMap> extends T ? undefined :
  T;
interface NondeterminateTypeMap {
  boolean: boolean;
}

export type Split<T extends readonly unknown[]> =
  T extends unknown ?
  T extends readonly [] ? never :
  ((...as: T) => void) extends ((a: infer T1, ...as: infer T2) => void) ? [T1, T2] :
  never :
  never;
export type Head<T extends readonly unknown[]> =
  T extends [infer U, ...infer V] ? If<TEq<T, V>, never, U> :
  never;
export type Tail<T extends readonly unknown[]> =
  T extends [unknown, ...infer U] ? If<TEq<T, U>, never, U> :
  never;
export type Init<T extends readonly unknown[]> =
  T extends readonly [] ? never :
  T extends [...infer U, unknown] ? If<TEq<T, U>, never, U> :
  never;
export type Last<T extends readonly unknown[]> =
  T extends readonly [] ? never :
  T extends [...infer U, infer V] ? If<TEq<T, U>, never, V> :
  never;
export type Inits<as extends readonly unknown[]> =
  number extends as['length'] ? never :
  as extends readonly [] ? [] :
  as | Inits<Init<as>>;
export type Tails<as extends readonly unknown[]> =
  number extends as['length'] ? never :
  as extends readonly [] ? [] :
  as | Tails<Tail<as>>;
export type Reverse<T extends readonly unknown[]> =
  T extends readonly [infer T, ...infer U, infer V] ? [V, ...Reverse<U>, T] :
  T;
export type Member<T, U extends readonly unknown[]> = Index<T, U> extends -1 ? false : true;
export type Index<T, U extends readonly unknown[]> = Idx<T, U, []>;
type Idx<T, U extends readonly unknown[], V extends readonly void[]> =
  TEq<U, Tail<U> | U> extends true ? -1 :
  If<TEq<U[0], T>, V['length'], Idx<T, Tail<U>, [void, ...V]>>;
export type AtLeast<N extends number, T> = AtLeastRec<N, T, T[], []>;
type AtLeastRec<L, Elm, T extends readonly unknown[], C extends readonly unknown[]> = {
  0: T;
  1: AtLeastRec<L, Elm, [Elm, ...T], [unknown, ...C]>;
}[C['length'] extends L ? 0 : 1];

export type Rewrite<T, R extends [unknown, unknown]> =
  [T] extends [never]
    ? true extends (R extends never ? never : R[0] extends never ? true : never)<commit_msg>Refactoring<commit_after>type Falsy = undefined | false | 0 | '' | null | void;
type Unique = typeof Unique;
declare const Unique: unique symbol;

export type Not<T extends boolean> = T extends true ? false : true;
export type And<T, U> = T extends Falsy ? T : U;
export type Or<T, U> = T extends Falsy ? U : T;

export type IsNever<T> = [T] extends [never] ? true : false;
export type IsVoid<T> = [void] extends [T] ? Not<Or<IsAny<T>, IsUnknown<T>>> : false;
export type IsAny<T> = [T] extends [Unique] ? Not<IsNever<T>> : false;
export type IsUnknown<T> = [T] extends [Unique | {} | void | null] ? false : true;

export type Eq<T, U> =
  // Exclude never type from T and U.
  Or<IsNever<T>, IsNever<U>> extends true ? And<IsNever<T>, IsNever<U>> :
  // T and U below are a type except never.
  // Distribute U.
  U extends never
    ? never : // Never reach here.
  // Compare distributed T and U.
  T extends U ? U extends T ? true : false : false;
export type TEq<T, U> =
  Or<IsAny<T>, IsAny<U>> extends true ? And<IsAny<T>, IsAny<U>> :
  [T] extends [U] ? [U] extends [T] ? true : false : false;
export type If<S, T, U> = S extends Falsy ? U : T;
export type Case<T extends keyof U, U extends {}> = U[T];

export type DEq<T extends valueof<NondeterminateTypeMap>, U extends valueof<NondeterminateTypeMap>> =
  Determine<T> extends undefined ? undefined :
  Determine<U> extends undefined ? undefined :
  Eq<T, U>;
type Determine<T extends valueof<NondeterminateTypeMap>> =
  valueof<NondeterminateTypeMap> extends T ? undefined :
  T;
interface NondeterminateTypeMap {
  boolean: boolean;
}

export type Split<T extends readonly unknown[]> =
  T extends unknown ?
  T extends readonly [] ? never :
  ((...as: T) => void) extends ((a: infer T1, ...as: infer T2) => void) ? [T1, T2] :
  never :
  never;
export type Head<T extends readonly unknown[]> =
  T extends readonly [infer V, ...infer U] ? If<TEq<Readonly<T>, Readonly<U>>, never, V> :
  never;
export type Tail<T extends readonly unknown[]> =
  T extends readonly [unknown, ...infer U] ? If<TEq<Readonly<T>, Readonly<U>>, never, U> :
  never;
export type Init<T extends readonly unknown[]> =
  T extends readonly [] ? never :
  T extends readonly [...infer U, unknown] ? If<TEq<Readonly<T>, Readonly<U>>, never, U> :
  never;
export type Last<T extends readonly unknown[]> =
  T extends readonly [] ? never :
  T extends readonly [...infer U, infer V] ? If<TEq<Readonly<T>, Readonly<U>>, never, V> :
  never;
export type Inits<as extends readonly unknown[]> =
  number extends as['length'] ? never :
  as extends readonly [] ? [] :
  as | Inits<Init<as>>;
export type Tails<as extends readonly unknown[]> =
  number extends as['length'] ? never :
  as extends readonly [] ? [] :
  as | Tails<Tail<as>>;
export type Reverse<T extends readonly unknown[]> =
  T extends readonly [infer T, ...infer U, infer V] ? [V, ...Reverse<U>, T] :
  T;
export type Member<T, U extends readonly unknown[]> = Index<T, U> extends -1 ? false : true;
export type Index<T, U extends readonly unknown[]> = Idx<T, U, []>;
type Idx<T, U extends readonly unknown[], V extends readonly void[]> =
  TEq<Readonly<U>, Readonly<Tail<U> | U>> extends true ? -1 :
  If<TEq<U[0], T>, V['length'], Idx<T, Tail<U>, [void, ...V]>>;
export type AtLeast<N extends number, T> = AtLeastRec<N, T, T[], []>;
type AtLeastRec<L, Elm, T extends readonly unknown[], C extends readonly unknown[]> = {
  0: T;
  1: AtLeastRec<L, Elm, [Elm, ...T], [unknown, ...C]>;
}[C['length'] extends L ? 0 : 1];

export type Rewrite<T, R extends [unknown, unknown]> =
  [T] extends [never]
    ? true extends (R extends never ? never : R[0] extends never ? true : never)
{'fraction_non_alphanumeric': 0.16005547850208043, 'fraction_numerical': 0.0036061026352288486, 'mean_word_length': 3.895451459606246, 'pattern_counts': {'":': 0, '<': 163, '<?xml version=': 0, '>': 167, 'https://': 0, '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': '445403', 'n_tokens_mistral': 2531, 'n_tokens_neox': 2485, 'n_words': 899}