text stringlengths 0 601k |
|---|
let rec num_trainable_vars t = let sub_vars = Hashtbl . data t . subs |> List . fold ~ init : 0 ~ f ( : fun acc t -> acc + num_trainable_vars t ) in sub_vars + Hashtbl . length t . trainable_tensors |
let iter_trainable_vars t ~ f = let f ~ key ~ data = f key data in let rec loop t = Hashtbl . iter t . subs ~ f : loop ; Hashtbl . iteri t . trainable_tensors ~ f in loop t |
let all_vars t = let rec walk t ~ path = let sub_vars = Hashtbl . to_alist t . subs |> List . concat_map ~ f ( : fun ( key , t ) -> walk t ~ path ( : key :: path ) ) in let vars = Hashtbl . to_alist t . all_tensors_by_name |> List . map ~ f ( : fun ( key , tensor ) -> List . rev ( key :: path ) |> String . concat ~ sep... |
let copy ~ src ~ dst = Tensor . no_grad ( fun ( ) -> let rec walk ~ src ~ dst path = Hashtbl . iteri dst . all_tensors_by_name ~ f ( : fun ~ key ~ data -> match Hashtbl . find src . all_tensors_by_name key with | Some src -> Tensor . copy_ data ~ src | None -> Printf . failwithf " cannot find var % s from var - store %... |
let name t = t . name |
let device t = t . device |
module Init = struct type t = | Zeros | Ones | Const of float | Normal of { mean : float ; stdev : float } | Uniform of float * float | Copy of Tensor . t end |
let new_var ( ? trainable = true ) t ~ shape ~ init ~ name = let device = device t in let requires_grad = trainable && not t . frozen in let tensor = match ( init : Init . t ) with | Zeros -> Tensor . zeros shape ~ requires_grad ~ device | Ones -> Tensor . ones shape ~ requires_grad ~ device | Const scale -> Tensor . o... |
let new_var_copy ? trainable t ~ src ~ name = new_var ? trainable t ~ shape ( : Tensor . shape src ) ~ init ( : Copy src ) ~ name |
module Configuration = struct type t = { name : string ; vaccine_peptide_length : int ; padding_around_mutation : int ; max_vaccine_peptides_per_mutation : int ; max_mutations_in_report : int ; min_mapping_quality : int ; min_variant_sequence_coverage : int ; min_alt_rna_reads : int ; include_mismatches_after_variant :... |
type product = < host : Ketrew_pure . Host . t ; is_done : Ketrew_pure . Target . Condition . t option ; ascii_report_path : string option ; xlsx_report_path : string option ; pdf_report_path : string option ; debug_log_path : string ; output_folder_path : string ; > |
let move_vaxrank_product ? host ~ output_folder_path ( vp : product ) : product = let open KEDSL in let open Option in let host = match host with | None -> vp # host | Some h -> h in let sub path = let base = String . chop_prefix_exn ~ prefix : vp # output_folder_path path in output_folder_path // base in let ascii_pro... |
let run ( ~ run_with : Machine . t ) ~ configuration ~ reference_build ~ vcfs ~ bam ~ predictor ~ alleles_file ~ output_folder = let open KEDSL in let open Hla_utilities in let host = Machine . ( as_host run_with ) in let vaxrank = Machine . get_tool run_with Machine . Tool . Default . vaxrank in let sorted_bam = Samto... |
let ba0 = Bigarray . Array1 . create Bigarray . float32 Bigarray . c_layout 0 ; ; |
let display ( vertexBuffer , colourBuffer ) = function ( ) -> glClear [ GL_COLOR_BUFFER_BIT ; GL_DEPTH_BUFFER_BIT ] ; glMatrixMode GL_MODELVIEW ; glLoadIdentity ( ) ; glTranslate 0 . 0 . ( - 5 . 0 ) ; glBindBuffer GL_ARRAY_BUFFER vertexBuffer ; glVertexPointer0 3 Coord . GL_FLOAT 0 ; glBindBuffer GL_ARRAY_BUFFER colour... |
let ini_gl ( ) = glMatrixMode GL_PROJECTION ; glLoadIdentity ( ) ; gluPerspective 45 . 0 ( 640 . 0 . / 480 . 0 ) 1 . 0 512 . 0 ; glClearColor 0 . 0 0 . 0 0 . 0 1 . 0 ; let vertexData = Bigarray . Array1 . of_array Bigarray . float32 Bigarray . c_layout [ | 0 . 0 ; 1 . 0 ; 0 . 0 ; - 1 . 0 ; - 1 . 0 ; 0 . 0 ; 1 . 0 ; - 1... |
let keyboard ( vertexBuffer , colourBuffer ) = fun ~ key ~ x ~ y -> match key with | ' \ 027 ' -> glDisableClientState GL_VERTEX_ARRAY ; glDisableClientState GL_COLOR_ARRAY ; glDeleteBuffer vertexBuffer ; glDeleteBuffer colourBuffer ; exit ( 0 ) ; | _ -> ( ) ; ; |
let ( ) = ignore ( glutInit Sys . argv ) ; glutInitDisplayMode [ GLUT_RGB ; GLUT_DEPTH ; GLUT_DOUBLE ] ; glutInitWindowSize 640 480 ; ignore ( glutCreateWindow " VBO demo " ) ; let buffers = ini_gl ( ) in glutDisplayFunc ~ display ( : display buffers ) ; glutKeyboardFunc ~ keyboard ( : keyboard buffers ) ; glutMainLoop... |
let vertexData = Bigarray . Array1 . of_array Bigarray . float32 Bigarray . c_layout [ | 0 . 0 ; 1 . 0 ; 0 . 0 ; - 1 . 0 ; - 1 . 0 ; 0 . 0 ; 1 . 0 ; - 1 . 0 ; 0 . 0 ; ] | |
let colourData = Bigarray . Array1 . of_array Bigarray . float32 Bigarray . c_layout [ | 0 . 0 ; 0 . 0 ; 1 . 0 ; 0 . 0 ; 1 . 0 ; 1 . 0 ; 1 . 0 ; 0 . 5 ; 0 . 0 ; ] | |
let display ( vertexBuffer , colourBuffer ) = function ( ) -> glClear [ GL_COLOR_BUFFER_BIT ; GL_DEPTH_BUFFER_BIT ] ; glMatrixMode GL_MODELVIEW ; glLoadIdentity ( ) ; glTranslate 0 . 0 . ( - 5 . 0 ) ; glEnableClientState GL_VERTEX_ARRAY ; glEnableClientState GL_COLOR_ARRAY ; glBindBuffer GL_ARRAY_BUFFER vertexBuffer ; ... |
let ini_gl ( ) = glMatrixMode GL_PROJECTION ; glLoadIdentity ( ) ; gluPerspective 45 . 0 ( 640 . 0 . / 480 . 0 ) 1 . 0 512 . 0 ; glClearColor 0 . 0 0 . 0 0 . 0 1 . 0 ; let vertexBuffer = glGenBuffer ( ) in glBindBuffer GL_ARRAY_BUFFER vertexBuffer ; glBufferData GL_ARRAY_BUFFER ( ba_sizeof vertexData ) vertexData GL_DY... |
let keyboard ( vertexBuffer , colourBuffer ) = fun ~ key ~ x ~ y -> match key with | ' \ 027 ' -> glDeleteBuffer vertexBuffer ; glDeleteBuffer colourBuffer ; exit ( 0 ) ; | _ -> ( ) ; ; |
let ( ) = ignore ( glutInit Sys . argv ) ; glutInitDisplayMode [ GLUT_RGB ; GLUT_DEPTH ; GLUT_DOUBLE ] ; glutInitWindowSize 640 480 ; ignore ( glutCreateWindow " VBO demo " ) ; let buffers = ini_gl ( ) in glutDisplayFunc ~ display ( : display buffers ) ; glutKeyboardFunc ~ keyboard ( : keyboard buffers ) ; glutMainLoop... |
let vertexData = Bigarray . Array1 . of_array Bigarray . float32 Bigarray . c_layout [ | 0 . 0 ; 1 . 0 ; 0 . 0 ; - 1 . 0 ; - 1 . 0 ; 0 . 0 ; 1 . 0 ; - 1 . 0 ; 0 . 0 ; ] | |
let colourData = Bigarray . Array1 . of_array Bigarray . float32 Bigarray . c_layout [ | 0 . 0 ; 0 . 0 ; 1 . 0 ; 0 . 0 ; 1 . 0 ; 1 . 0 ; 1 . 0 ; 0 . 5 ; 0 . 0 ; ] | |
let display ( vertexBuffer , colourBuffer ) = function ( ) -> glClear [ GL_COLOR_BUFFER_BIT ; GL_DEPTH_BUFFER_BIT ] ; glMatrixMode GL_MODELVIEW ; glLoadIdentity ( ) ; glTranslate 0 . 0 . ( - 5 . 0 ) ; glEnableClientState GL_VERTEX_ARRAY ; glEnableClientState GL_COLOR_ARRAY ; glBindBuffer GL_ARRAY_BUFFER vertexBuffer ; ... |
let ini_gl ( ) = glMatrixMode GL_PROJECTION ; glLoadIdentity ( ) ; gluPerspective 45 . 0 ( 640 . 0 . / 480 . 0 ) 1 . 0 512 . 0 ; glClearColor 0 . 0 0 . 0 0 . 0 1 . 0 ; let vertexBuffer = glGenBuffer ( ) in glBindBuffer GL_ARRAY_BUFFER vertexBuffer ; glBufferData GL_ARRAY_BUFFER ( ba_sizeof vertexData ) vertexData GL_DY... |
let keyboard ( vertexBuffer , colourBuffer ) = fun ~ key ~ x ~ y -> match key with | ' \ 027 ' -> glDeleteBuffer vertexBuffer ; glDeleteBuffer colourBuffer ; exit ( 0 ) ; | _ -> ( ) ; ; |
let ( ) = ignore ( glutInit Sys . argv ) ; glutInitDisplayMode [ GLUT_RGB ; GLUT_DEPTH ; GLUT_DOUBLE ] ; glutInitWindowSize 640 480 ; ignore ( glutCreateWindow " VBO demo " ) ; let buffers = ini_gl ( ) in glutDisplayFunc ~ display ( : display buffers ) ; glutKeyboardFunc ~ keyboard ( : keyboard buffers ) ; glutMainLoop... |
module Make ( S : Comb . S ) = struct open S open Circuit open Cyclesim . Api type t = S . t let vcdmin = 33 let vcdmax = 126 let vcdcycle = 10 type trace = { w : int ; id : string ; name : string ; data : S . t ref ; prev : string ref ; } type cyclesim = t Cyclesim . Api . cyclesim let wrap os sim = let osl s = os ( s... |
module Gtkwave ( S : Comb . S ) = struct module Vcd = Make ( S ) type t = S . t type cyclesim = t Cyclesim . Api . cyclesim let wrap chan sim = let o s = output_string chan s ; flush chan in Vcd . wrap o sim let gtkwave ( ? args " " ) = sim = let fifoname = Filename . temp_file " sim " " fifo " in Printf . printf " Cre... |
module Safe = struct type error = [ ` invalid_int of string | ` invalid_float of string ] let int_of_string s = try Ok ( Int . of_string s ) s with _ -> Error ( ` invalid_int s ) s let float_of_string s = try Ok ( Float . of_string s ) s with _ -> Error ( ` invalid_float s ) s end |
let is_valid_dna = String . for_all ~ f ( : String . contains " ACGTN ) " |
type vcf_number = | Number of int | OnePerAllele | OnePerGenotype | Unknown |
type vcf_format_type = [ ` integer_value | ` float_value | ` character_value | ` string_value ] |
type vcf_info_type = [ vcf_format_type | ` flag_value ] |
type vcf_info_meta = Info of vcf_number * vcf_info_type * vcf_description |
type vcf_filter_meta = Filter of vcf_description |
type vcf_format_meta = Format of vcf_number * vcf_format_type * vcf_description |
type vcf_alt_meta = Alt of vcf_description |
type vcf_meta = { vcfm_version : string ; vcfm_id_cache : vcf_id Set . Poly . t ; vcfm_info : ( vcf_id , vcf_info_meta ) vcf_info_meta Hashtbl . t ; vcfm_filters : ( vcf_id * vcf_filter_meta ) vcf_filter_meta list ; vcfm_format : ( vcf_id , vcf_format_meta ) vcf_format_meta Hashtbl . t ; vcfm_alt : ( string , vcf_alt_m... |
type vcf_format = [ ` integer of int | ` float of float | ` character of char | ` string of string | ` missing ] |
type vcf_info = [ vcf_format | ` flag of string ] |
type vcf_row = { vcfr_chrom : string ; vcfr_pos : int ; vcfr_ids : string list ; vcfr_ref : string ; vcfr_alts : string list ; vcfr_qual : float option ; vcfr_filter : vcf_id list ; vcfr_info : ( vcf_id , vcf_info list ) list Hashtbl . t ; vcfr_samples : ( vcf_id , ( vcf_id * vcf_format list ) list list ) list Hashtbl ... |
type vcf_parse_row_error = [ Safe . error | ` info_type_coersion_failure of vcf_info_type * string | ` format_type_coersion_failure of vcf_format_type * string | ` invalid_dna of string | ` unknown_info of vcf_id | ` unknown_filter of vcf_id | ` unknown_alt of string | ` duplicate_ids of vcf_id list | ` invalid_argumen... |
type vcf_parse_error = [ ` malformed_meta of Pos . t * string | ` malformed_row of Pos . t * vcf_parse_row_error * string | ` malformed_header of Pos . t * string | ` incomplete_input of Pos . t * string list * string option | ` not_ready ] |
let string_to_vcf_number = function | " A " -> OnePerAllele | " G " -> OnePerGenotype | " . " -> Unknown | arity -> Number ( int_of_string arity ) arity |
let string_to_vcf_format_type s = match String . lowercase s with | " integer " -> ` integer_value | " float " -> ` float_value | " character " -> ` character_value | " string " -> ` string_value | v -> failwith ( " string_to_vcf_format_type : invalid format : " ^ v ) v |
let vcf_format_type_to_string = function | ` integer_value -> " integer " | ` float_value -> " float " | ` character_value -> " character " | ` string_value -> " string " |
let coerce_to_vcf_format_type t s = if String . equal s " . " then Ok ` missing else match t with | ` integer_value -> Result . map ( Safe . int_of_string s ) s ~ f ( : fun x -> ` integer x ) x | ` float_value -> Result . map ( Safe . float_of_string s ) s ~ f ( : fun x -> ` float x ) x | ` character_value when String ... |
let coerce_n ~ f key n s = let open Result . Monad_infix in let res = lazy ( Result . all ( List . map ~ f ( String . split ~ on : ' , ' s ) s ) s ) s in match n with | Number n -> Lazy . force res >>= fun values -> if List . length values = n then Ok values else Error ( ` invalid_arguments_length ( key , List . length... |
let string_to_vcf_info_type s = match String . lowercase s with | " flag " -> ` flag_value | s -> string_to_vcf_format_type s |
let vcf_info_type_to_string = function | ` flag_value -> " flag " | # vcf_format_type as t -> vcf_format_type_to_string t |
let coerce_to_vcf_info_type t s = let res = match t with | ` flag_value -> Ok ( ` flag s ) s | # vcf_format_type -> coerce_to_vcf_format_type t s in Result . map_error res ~ f ( : fun _exn -> ` info_type_coersion_failure ( t , s ) s ) s |
let parse_row_error_to_string = function | ` invalid_int s -> sprintf " invalid_integer ( % s ) s " s | ` invalid_float s -> sprintf " invalid_float ( % s ) s " s | ` info_type_coersion_failure ( t , s ) s -> sprintf " info_type_coersion_failure ( % s , % S ) S " ( vcf_info_type_to_string t ) t s | ` format_type_coersi... |
let parse_error_to_string = let pos ( ) a = Pos . to_string a in function | ` malformed_meta ( p , s ) s -> sprintf " malformed_meta ( % a , % S ) S " pos p s | ` malformed_row ( p , err , s ) s -> sprintf " malformed_row ( % s , % a , % S ) S " ( parse_row_error_to_string err ) err pos p s | ` malformed_header ( p , s... |
let reserved_info = Hashtbl . Poly . of_alist_exn [ ( " AA " , ` string_value ) string_value ; ( " AC " , ` integer_value ) integer_value ; ( " AF " , ` float_value ) float_value ; ( " AN " , ` integer_value ) integer_value ; ( " BQ " , ` float_value ) float_value ; ( " CIGAR " , ` string_value ) string_value ; ( " DB ... |
let default_meta = { vcfm_version = " < unknown " ; > vcfm_id_cache = Set . Poly . empty ; vcfm_info = Hashtbl . Poly . create ( ) ; vcfm_filters = [ ] ; vcfm_format = Hashtbl . Poly . create ( ) ; vcfm_alt = reserved_alt ; vcfm_arbitrary = Hashtbl . Poly . create ( ) ; vcfm_header = [ ] ; vcfm_samples = [ ] } |
let string_to_vcfr_ref s = let s = String . uppercase s in if is_valid_dna s then Ok s else Error ( ` invalid_dna s ) s |
let string_to_vcfr_info { vcfm_info ; _ } s = let go values = List . map ( String . split ~ on : ' ; ' s ) s ~ f ( : fun chunk -> let ( key , raw_value ) raw_value = Option . value ~ default ( : chunk , ) " " ( String . lsplit2 ~ on : ' = ' chunk ) chunk in let chunk_values = match Hashtbl . find vcfm_info key with | S... |
let string_to_vcfr_filter { vcfm_filters ; _ } s = match String . split ~ on : ' ; ' s with | [ " PASS ] " -> Ok [ ] | chunks -> match List . find chunks ~ f ( : fun chunk -> not ( List . Assoc . mem ~ equal : String . equal vcfm_filters chunk ) chunk ) chunk with | Some unknown_filter -> Error ( ` unknown_filter unkno... |
let string_to_vcfr_ids { vcfm_id_cache ; _ } s = match String . split ~ on : ' ; ' s with | [ ] " . " -> Ok [ ] | chunks -> let duplicate_ids = List . filter chunks ~ f ( : Set . mem vcfm_id_cache ) vcfm_id_cache in if List . is_empty duplicate_ids then Ok chunks else Error ( ` duplicate_ids duplicate_ids ) duplicate_i... |
let string_to_vcfr_alts { vcfm_alt ; _ } s = match String . split ~ on : ' , ' s with | [ ] " . " -> Ok [ ] | chunks -> let res = List . map chunks ~ f ( : fun chunk -> let n = String . length chunk in match Char ( . chunk [ . 0 ] 0 = ' < ' && chunk [ . n - 1 ] 1 = ' > ' , is_valid_dna chunk ) chunk with | ( true , _ )... |
let list_to_vcfr_samples { vcfm_format ; vcfm_samples ; _ } chunks = let open Result . Monad_infix in let samples = Hashtbl . Poly . create ( ) in let go sample_keys id raw_sample = let sample_chunks = String . split ~ on : ' : ' raw_sample in if List ( . length sample_keys <> length sample_chunks ) sample_chunks then ... |
let list_to_vcf_row meta chunks = let open Result . Monad_infix in let n_chunks = List . length chunks and n_columns = List ( . length meta . vcfm_header + length meta . vcfm_samples ) vcfm_samples in match chunks with | vcfr_chrom :: raw_pos :: raw_id :: raw_ref :: raw_alt :: raw_qual :: raw_filter :: raw_info :: raw_... |
module Transform = struct let next_vcf_header meta p = let open Lines . Buffer in let { vcfm_info ; vcfm_format ; _ } = meta in let l = Option . value_exn ( next_line p :> string option ) option in let chunks = List . filter ~ f : String ( . fun s -> s <> ) " " ( String . split ~ on : ' \ t ' l ) l in begin match chunk... |
module type Cohttp_IO_S = sig type + ' a t val ( ) >>= : ' a t -> ( ' a -> ' b t ) t -> ' b t val return : ' a -> ' a t type ic type oc val iter : ( ' a -> unit t ) t -> ' a list -> unit t val read_line : ic -> string option t val read : ic -> int -> string t val read_exactly : ic -> int -> string option t val write : ... |
module IO = struct type ' a t = ' a Lwt . t let ( >>= ) = Lwt ( . >>= ) let return = Lwt . return type ic = Lwt_io . input_channel type oc = Lwt_io . output_channel let iter = Lwt_list . iter_s let read_line = Lwt_io . read_line_opt let read ic count = Lwt . catch ( fun ( ) -> Lwt_io . read ~ count ic ) ic ( function E... |
let reader t = let frag = ref ( Cstruct . create 0 ) 0 in let rec aux buf ofs len = if len = 0 then return 0 else let available = Cstruct . length ! frag in if available = 0 then begin M . read t >>= function | Ok ` Eof -> return 0 | Ok ( ` Data b ) b -> frag := b ; aux buf ofs len | Error e -> Fmt . kstr Lwt . fail_wi... |
let writer t ( buf : Lwt_bytes . t ) t ( ofs : int ) int ( len : int ) int = let b = Cstruct . sub ( Cstruct . of_bigarray buf ) buf ofs len in M . write t b >>= function | Ok ( ) -> return len | Error ` Closed -> return 0 | Error e -> Fmt . kstr Lwt . fail_with " % a " M . pp_write_error e |
let open_client ~ domid ~ port ( ? buffer_size = 1024 ) 1024 ( ) = M . client ~ domid ~ port ( ) >>= fun t -> let close ( ) = M . close t in let in_buffer = Lwt_bytes . create buffer_size in let ic = Lwt_io . make ~ buffer : in_buffer ~ mode : Lwt_io . input ~ close ( reader t ) t in let out_buffer = Lwt_bytes . create... |
let open_server ~ domid ~ port ( ? buffer_size = 1024 ) 1024 ( ) = M . server ~ domid ~ port ~ read_size : buffer_size ~ write_size : buffer_size ( ) >>= fun t -> let close ( ) = M . close t in let in_buffer = Lwt_bytes . create buffer_size in let ic = Lwt_io . make ~ buffer : in_buffer ~ mode : Lwt_io . input ~ close ... |
module Kind = struct type t = | Git | Hg let of_dir_contents files = if String . Set . mem files " . git " then Some Git else if String . Set . mem files " . hg " then Some Hg else None let to_dyn t = Dyn . Variant ( ( match t with | Git -> " Git " | Hg -> " Hg " ) , [ ] ) let equal = ( = ) end |
module T = struct type t = { root : Path . t ; kind : Kind . t } let to_dyn { root ; kind } = Dyn . record [ ( " root " , Path . to_dyn root ) ; ( " kind " , Kind . to_dyn kind ) ] let equal { root = ra ; kind = ka } { root = rb ; kind = kb } = Path . equal ra rb && Kind . equal ka kb let hash t = Path . hash t . root ... |
let git , hg = let get prog = lazy ( match Bin . which ~ path ( : Env . path Env . initial ) prog with | Some x -> x | None -> Utils . program_not_found prog ~ loc : None ) in ( get " git " , get " hg " ) |
let select git hg t = Memo . of_non_reproducible_fiber ( match t . kind with | Git -> git t | Hg -> hg t ) |
let prog t = Lazy . force ( match t . kind with | Git -> git | Hg -> hg ) |
let run t args = let open Fiber . O in let + s = Process . run_capture Strict ( prog t ) args ~ dir : t . root ~ env : Env . initial in String . trim s |
let git_accept ( ) = Process . Accept ( Predicate_lang . union [ Element 0 ; Element 128 ] ) |
let run_git t args = let res = Process . run_capture ( git_accept ( ) ) ( prog t ) args ~ dir : t . root ~ env : Env . initial ~ stderr_to ( : Process . Io . file Config . dev_null Out ) in let open Fiber . O in let + res = res in match res with | Ok s -> Some ( String . trim s ) | Error 128 -> None | Error _ -> assert... |
let hg_describe t = let open Fiber . O in let * s = run t [ " log " ; " -- rev " ; " . " ; " - T " ; " { latesttag } { latesttagdistance } " ] in let + id = run t [ " id " ; " - i " ] in let id , dirty_suffix = match String . drop_suffix id ~ suffix " " :+ with | Some id -> ( id , " - dirty " ) | None -> ( id , " " ) i... |
let make_fun name ~ git ~ hg = let memo = Memo . create name ~ input ( : module T ) ( select git hg ) in Staged . stage ( Memo . exec memo ) |
let describe = Staged . unstage @@ make_fun " vcs - describe " ~ git ( : fun t -> run_git t [ " describe " ; " -- always " ; " -- dirty " ; " -- abbrev = 7 " ] ) ~ hg ( : fun x -> let open Fiber . O in let + res = hg_describe x in Some res ) |
let commit_id = Staged . unstage @@ make_fun " vcs - commit - id " ~ git ( : fun t -> run_git t [ " rev - parse " ; " HEAD " ] ) ~ hg ( : fun t -> let open Fiber . O in let + res = run t [ " id " ; " - i " ] in Some res ) |
let files = let run_zero_separated_hg t args = Process . run_capture_zero_separated Strict ( prog t ) args ~ dir : t . root ~ env : Env . initial in let run_zero_separated_git t args = let open Fiber . O in let + res = Process . run_capture_zero_separated ( git_accept ( ) ) ( prog t ) args ~ dir : t . root ~ env : Env ... |
let ( ) = init ( ) |
let temp_dir = lazy ( Path . of_string " vcs - tests " ) |
let ( ) = at_exit ( fun ( ) -> Path . rm_rf ( Lazy . force temp_dir ) ) |
let has_hg = match Lazy . force Vcs . hg with | ( _ : Path . t ) -> true | exception _ -> false |
let run ( vcs : Vcs . t ) args = let prog , prog_str , real_args = match vcs . kind with | Git -> ( Vcs . git , " git " , args ) | Hg -> ( if has_hg then ( Vcs . hg , " hg " , args ) else ( Vcs . git , " hg " , match args with | [ " tag " ; s ; " - u " ; _ ] -> [ " tag " ; " - a " ; s ; " - m " ; s ] | [ " commit " ; "... |
type action = | Init | Add of string | Write of string * string | Commit | Tag of string | Describe of string |
let run_action ( vcs : Vcs . t ) action = match action with | Init -> run vcs [ " init " ; " - q " ] | Add fn -> run vcs [ " add " ; fn ] | Commit -> ( match vcs . kind with | Git -> run vcs [ " commit " ; " - m " ; " commit message " ] | Hg -> run vcs [ " commit " ; " - m " ; " commit message " ; " - u " ; " toto " ] ... |
let run kind script = let ( lazy temp_dir ) = temp_dir in Path . rm_rf temp_dir ; Path . mkdir_p temp_dir ; let vcs = { Vcs . kind ; root = temp_dir } in let config = { Scheduler . Config . concurrency = 1 ; display = { verbosity = Short ; status_line = false } ; rpc = None ; stats = None } in Scheduler . Run . go ~ on... |
let script = [ Init ; Write ( " a " , " " ) - ; Add " a " ; Commit ; Describe " < commit - id " > ; Write ( " b " , " " ) - ; Add " b " ; Describe " < commit - id >- dirty " ; Commit ; Describe " < commit - id " > ; Tag " 1 . 0 " ; Describe " 1 . 0 " ; Write ( " c " , " " ) - ; Add " c " ; Describe " 1 . 0 - dirty " ; ... |
type ' msg applicationCallbacks = { enqueue : ' msg -> unit ; } |
type ' msg eventHandler = | EventHandlerCallback of string * ( Web . Node . event -> ' msg option ) | EventHandlerMsg of ' msg |
type ' msg eventCache = { handler : Web . Node . event_cb ; cb : ( Web . Node . event -> ' msg option ) ref } |
type ' msg property = | NoProp | RawProp of string * string | Attribute of string * string * string | Data of string * string | Event of string * ' msg eventHandler * ' msg eventCache option ref | Style of ( string * string ) list |
type ' msg properties = ' msg property list |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.