Attention une mise à jour du service Gitlab va être effectuée le mardi 30 novembre entre 17h30 et 18h00. Cette mise à jour va générer une interruption du service dont nous ne maîtrisons pas complètement la durée mais qui ne devrait pas excéder quelques minutes. Cette mise à jour intermédiaire en version 14.0.12 nous permettra de rapidement pouvoir mettre à votre disposition une version plus récente.

Commit 5d0e34e4 authored by Stephane Glondu's avatar Stephane Glondu
Browse files

Cleanup

parent 56edcd81
......@@ -4,13 +4,6 @@ let ( =% ) = Z.equal
module Array = struct
include Array
let forall f a =
let n = Array.length a in
(let rec check i =
if i >= 0 then f a.(i) && check (pred i)
else true
in check (pred n))
let forall2 f a b =
let n = Array.length a in
n = Array.length b &&
......@@ -76,9 +69,6 @@ module Array = struct
let map2 f a b =
Array.mapi (fun i ai -> f ai b.(i)) a
let map2i f a b =
Array.mapi (fun i ai -> f i ai b.(i)) a
let map3 f a b c =
Array.mapi (fun i ai -> f ai b.(i) c.(i)) a
......@@ -130,21 +120,3 @@ module String = struct
let xn = String.length x and sn = String.length s in
xn >= sn && String.sub x 0 sn = s
end
let hashB x = Cryptokit.(x |>
hash_string (Hash.sha256 ()) |>
transform_string (Base64.encode_compact ())
)
let load_from_file read fname =
let i = open_in fname in
let buf = Lexing.from_channel i in
let lex = Yojson.init_lexer ~fname () in
let result = read lex buf in
close_in i;
result
let non_empty_lines_of_file fname =
Lwt_io.lines_of_file fname |>
Lwt_stream.filter (fun s -> s <> "") |>
Lwt_stream.to_list
......@@ -8,7 +8,6 @@ end
module Array : sig
include module type of Array
val forall : ('a -> bool) -> 'a array -> bool
val forall2 : ('a -> 'b -> bool) -> 'a array -> 'b array -> bool
val foralli : (int -> 'a -> bool) -> 'a array -> bool
val fforall : ('a -> bool) -> 'a array array -> bool
......@@ -17,7 +16,6 @@ module Array : sig
val fforall3 : ('a -> 'b -> 'c -> bool) ->
'a array array -> 'b array array -> 'c array array -> bool
val map2 : ('a -> 'b -> 'c) -> 'a array -> 'b array -> 'c array
val map2i : (int -> 'a -> 'b -> 'c) -> 'a array -> 'b array -> 'c array
val map3 : ('a -> 'b -> 'c -> 'd) ->
'a array -> 'b array -> 'c array -> 'd array
val mmap : ('a -> 'b) -> 'a array array -> 'b array array
......@@ -33,9 +31,3 @@ module String : sig
val map : (char -> char) -> string -> string
val startswith : string -> string -> bool
end
val hashB : string -> string
val load_from_file : (Yojson.lexer_state -> Lexing.lexbuf -> 'a) ->
string -> 'a
val non_empty_lines_of_file : string -> string list Lwt.t
......@@ -2,6 +2,11 @@ open Lwt
open Util
open Serializable_compat_t
let hashB x = Cryptokit.(x |>
hash_string (Hash.sha256 ()) |>
transform_string (Base64.encode_compact ())
)
let if_legacy s =
if String.length s = 38 && s.[0] = '{' && s.[37] = '}'
then Uuidm.of_string ~pos:1 s
......
......@@ -15,6 +15,19 @@ let enforce_single_element s =
(assert_lwt b) >>
Lwt.return t
let load_from_file read fname =
let i = open_in fname in
let buf = Lexing.from_channel i in
let lex = Yojson.init_lexer ~fname () in
let result = read lex buf in
close_in i;
result
let hashB x = Cryptokit.(x |>
hash_string (Hash.sha256 ()) |>
transform_string (Base64.encode_compact ())
)
let load_elections_and_votes dirname =
Lwt_unix.files_of_directory dirname |>
Lwt_stream.filter_map_s (fun x ->
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment