55from paths_cli .compiling .tools import custom_eval
66from paths_cli .compiling .plugins import VolumeCompilerPlugin , CategoryPlugin
77from paths_cli .compiling .root_compiler import compiler_for
8- from paths_cli .compiling .json_type import json_type_ref
8+ from paths_cli .compiling .json_type import (
9+ json_type_ref , json_type_eval , json_type_list
10+ )
911
1012
1113# TODO: extra function for volumes should not be necessary as of OPS 2.0
@@ -29,30 +31,31 @@ def cv_volume_build_func(**dct):
2931 Parameter ('cv' , compiler_for ('cv' ), json_type = json_type_ref ('cv' ),
3032 description = "CV that defines this volume" ),
3133 Parameter ('lambda_min' , custom_eval ,
34+ json_type = json_type_eval ("Float" ),
3235 description = "Lower bound for this volume" ),
3336 Parameter ('lambda_max' , custom_eval ,
37+ json_type = json_type_eval ("Float" ),
3438 description = "Upper bound for this volume" )
3539 ],
40+ description = ("A volume defined by an allowed range of values for the "
41+ "given CV." ),
3642 name = 'cv-volume' ,
3743)
3844
3945build_cv_volume = CV_VOLUME_PLUGIN
4046
41- # jsonschema type for combination volumes
42- VOL_ARRAY_TYPE = {
43- 'type' : 'array' ,
44- 'items' : json_type_ref ('volume' ),
45- }
46-
4747
4848INTERSECTION_VOLUME_PLUGIN = VolumeCompilerPlugin (
4949 builder = lambda subvolumes : functools .reduce (operator .__and__ ,
5050 subvolumes ),
5151 parameters = [
5252 Parameter ('subvolumes' , compiler_for ('volume' ),
53- json_type = VOL_ARRAY_TYPE ,
53+ json_type = json_type_list ( json_type_ref ( 'volume' )) ,
5454 description = "List of the volumes to intersect" )
5555 ],
56+ description = ("A volume determined by the intersection of its "
57+ "constituent volumes; i.e., to be in this volume a point "
58+ "must be in *all* the constituent volumes." ),
5659 name = 'intersection' ,
5760)
5861
@@ -64,9 +67,12 @@ def cv_volume_build_func(**dct):
6467 subvolumes ),
6568 parameters = [
6669 Parameter ('subvolumes' , compiler_for ('volume' ),
67- json_type = VOL_ARRAY_TYPE ,
70+ json_type = json_type_list ( json_type_ref ( 'volume' )) ,
6871 description = "List of the volumes to join into a union" )
6972 ],
73+ description = ("A volume defined by the union of its constituent "
74+ "volumes; i.e., a point that is in *any* of the "
75+ "constituent volumes is also in this volume." ),
7076 name = 'union' ,
7177)
7278
0 commit comments