<commit_before>{ stdenv, fetchzip, ocaml, findlib, ocamlbuild, re, stringext, ounit
, sexplib, ppx_sexp_conv
, legacyVersion ? false
, sexplib_p4
}:

assert stdenv.lib.versionAtLeast ocaml.version "4";

with
  if legacyVersion
  then {
    version = "1.9.1";
    sha256 = "0v3jxqgyi4kj92r3x83rszfpnvvzy9lyb913basch4q64yka3w85";
  } else {
    version = "1.9.2";
    sha256 = "137pg8j654x7r0d1664iy2zp3l82nki1kkh921lwdrwc5qqdl6jx";
  };

stdenv.mkDerivation {
  name = "ocaml${ocaml.version}-uri-${version}";

  src = fetchzip {
    url = "https://github.com/mirage/ocaml-uri/archive/v${version}.tar.gz";
    inherit sha256;
  };

  buildInputs = [ ocaml findlib ocamlbuild ounit ]
  ++ stdenv.lib.optional (!legacyVersion) ppx_sexp_conv;
  propagatedBuildInputs = [ re (if legacyVersion then sexplib_p4 else sexplib) stringext ];

  configurePhase = "ocaml setup.ml -configure --prefix $out --enable-tests";
  buildPhase = ''
    ocaml setup.ml -build
    ocaml setup.ml -doc
  '';
  doCheck = true;
  checkPhase = "ocaml setup.ml -test";
  installPhase = "ocaml setup.ml -install";

  createFindlibDestdir = true;

  meta = {
    homepage = https://github.com/mirage/ocaml-uri;
    platforms = ocaml.meta.platforms or [];
    description = "RFC3986 URI parsing library for OCaml";
    license = stdenv.lib.licenses.isc;
    maintainers = with stdenv.lib.maintainers; [ vbgl ];
  };
}
<commit_msg>ocamlPackages.uri_p4: disable for OCaml ≥ 4.03<commit_after>{ stdenv, fetchzip, ocaml, findlib, ocamlbuild, re, stringext, ounit
, sexplib, ppx_sexp_conv
, legacyVersion ? false
, sexplib_p4
}:

if !stdenv.lib.versionAtLeast ocaml.version "4"
|| legacyVersion && stdenv.lib.versionAtLeast ocaml.version "4.03"
then throw "uri${stdenv.lib.optionalString legacyVersion "_p4"} is not available for OCaml ${ocaml.version}" else

with
  if legacyVersion
  then {
    version = "1.9.1";
    sha256 = "0v3jxqgyi4kj92r3x83rszfpnvvzy9lyb913basch4q64yka3w85";
  } else {
    version = "1.9.2";
    sha256 = "137pg8j654x7r0d1664iy2zp3l82nki1kkh921lwdrwc5qqdl6jx";
  };

stdenv.mkDerivation {
  name = "ocaml${ocaml.version}-uri-${version}";

  src = fetchzip {
    url = "https://github.com/mirage/ocaml-uri/archive/v${version}.tar.gz";
    inherit sha256;
  };

  buildInputs = [ ocaml findlib ocamlbuild ounit ]
  ++ stdenv.lib.optional (!legacyVersion) ppx_sexp_conv;
  propagatedBuildInputs = [ re (if legacyVersion then sexplib_p4 else sexplib) stringext ];

  configurePhase = "ocaml setup.ml -configure --prefix $out --enable-tests";
  buildPhase = ''
    ocaml setup.ml -build
    ocaml setup.ml -doc
  '';
  doCheck = true;
  checkPhase = "ocaml setup.ml -test";
  installPhase = "ocaml setup.ml -install";

  createFindlibDestdir = true;

  meta = {
    homepage = https://github.com/mirage/ocaml-uri;
    platforms = ocaml.meta.platforms or [];
    description = "RFC3986 URI parsing library for OCaml";
    license = stdenv.lib.licenses.isc;
    maintainers = with stdenv.lib.maintainers; [ vbgl ];
  };
}

{'fraction_non_alphanumeric': 0.12749667110519308, 'fraction_numerical': 0.04460719041278296, 'mean_word_length': 3.792663476874003, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, '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': '1076747', 'n_tokens_mistral': 1239, 'n_tokens_neox': 1174, 'n_words': 225}