Skip to content

Commit

Permalink
Remove Codec pretty printer derivers.
Browse files Browse the repository at this point in the history
These are not needed and affect code coverage negatively.
  • Loading branch information
zoj613 committed Jul 11, 2024
1 parent 8518c7b commit bae4aaa
Show file tree
Hide file tree
Showing 10 changed files with 13 additions and 38 deletions.
3 changes: 1 addition & 2 deletions lib/codecs/array_to_array.ml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
module Ndarray = Owl.Dense.Ndarray.Generic

type dimension_order = int array [@@deriving show]
type dimension_order = int array

type array_to_array =
| Transpose of dimension_order
[@@deriving show]

type error =
[ `Transpose_order of dimension_order * string ]
Expand Down
3 changes: 0 additions & 3 deletions lib/codecs/array_to_array.mli
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ type array_to_array =
type error =
[ `Transpose_order of dimension_order * string ]

val pp_array_to_array : Format.formatter -> array_to_array -> unit
val show_array_to_array : array_to_array -> string

module ArrayToArray : sig
val parse
: ('a, 'b) Util.array_repr ->
Expand Down
4 changes: 0 additions & 4 deletions lib/codecs/array_to_bytes.ml
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,14 @@ module Ndarray = Owl.Dense.Ndarray.Generic
type endianness =
| Little
| Big
[@@deriving show]

type loc =
| Start
| End
[@@deriving show]

type array_to_bytes =
| Bytes of endianness
| ShardingIndexed of shard_config
[@@deriving show]

and shard_config =
{chunk_shape : int array
Expand All @@ -29,7 +26,6 @@ and chain =
{a2a: array_to_array list
;a2b: array_to_bytes
;b2b: bytes_to_bytes list}
[@@deriving show]

type error =
[ Extensions.error
Expand Down
3 changes: 0 additions & 3 deletions lib/codecs/array_to_bytes.mli
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ and chain = {
b2b: Bytes_to_bytes.bytes_to_bytes list;
}

val pp_chain : Format.formatter -> chain -> unit
val show_chain : chain -> string

type error =
[ Extensions.error
| Array_to_array.error
Expand Down
2 changes: 0 additions & 2 deletions lib/codecs/bytes_to_bytes.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@ module Ndarray = Owl.Dense.Ndarray.Generic

type compression_level =
| L0 | L1 | L2 | L3 | L4 | L5 | L6 | L7 | L8 | L9
[@@deriving show]

type bytes_to_bytes =
| Crc32c
| Gzip of compression_level
[@@deriving show]

type error =
[ `Gzip of Ezgzip.error ]
Expand Down
3 changes: 0 additions & 3 deletions lib/codecs/bytes_to_bytes.mli
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ type bytes_to_bytes =
type error =
[ `Gzip of Ezgzip.error ]

val pp_bytes_to_bytes : Format.formatter -> bytes_to_bytes -> unit
val show_bytes_to_bytes : bytes_to_bytes -> string

module BytesToBytes : sig
val compute_encoded_size : int -> bytes_to_bytes -> int
val encode : bytes_to_bytes -> string -> (string, [> error]) result
Expand Down
4 changes: 0 additions & 4 deletions lib/codecs/codecs.ml
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,6 @@ and variable_to_internal_b2b b2b =
module Chain = struct
type t = chain

let pp = pp_chain

let show = show_chain

let create :
type a b. (a, b) Util.array_repr -> codec_chain -> (t, [> error ]) result
= fun repr cc ->
Expand Down
25 changes: 11 additions & 14 deletions lib/codecs/codecs.mli
Original file line number Diff line number Diff line change
Expand Up @@ -39,34 +39,31 @@ type codec_chain = {
b2b: bytestobytes list;
}

type error = Array_to_bytes.error
type error =
[ `Extension of string
| `Gzip of Ezgzip.error
| `Transpose_order of int array * string
| `Sharding of int array * int array * string ]

module Chain : sig
type t

val create
: ('a, 'b) Util.array_repr -> codec_chain -> (t, [> error]) result
val create :
('a, 'b) Util.array_repr -> codec_chain -> (t, [> error ]) result

val default : t

val compute_encoded_size : int -> t -> int

val encode
: t -> ('a, 'b) Ndarray.t -> (string, [> error]) result
val encode :
t -> ('a, 'b) Ndarray.t -> (string, [> error ]) result

val decode
: t ->
('a, 'b) Util.array_repr ->
string ->
(('a, 'b) Ndarray.t, [> error]) result
val decode :
t -> ('a, 'b) Util.array_repr -> string -> (('a, 'b) Ndarray.t, [> error]) result

val ( = ) : t -> t -> bool

val of_yojson : Yojson.Safe.t -> (t, string) result

val to_yojson : t -> Yojson.Safe.t

val pp : Format.formatter -> t -> unit

val show : t -> string
end
3 changes: 1 addition & 2 deletions test/test_codecs.ml
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,7 @@ let tests = [

let str = Chain.to_yojson c |> Yojson.Safe.to_string in
(match Chain.of_yojson @@ Yojson.Safe.from_string str with
| Ok v ->
assert_equal ~printer:Chain.show v c;
| Ok v -> assert_equal v c;
| Error _ ->
assert_failure
"a serialized chain should successfully deserialize"))
Expand Down
1 change: 0 additions & 1 deletion test/test_metadata.ml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ let test_array_metadata
~printer:show_int_array shape @@ ArrayMetadata.shape meta;

assert_equal
~printer:Codecs.Chain.show
Codecs.Chain.default @@
ArrayMetadata.codecs meta;

Expand Down

0 comments on commit bae4aaa

Please sign in to comment.