class Spec002(SpecificationBase): name = 'spec002' filename_fields = [ 'project', 'specification', 'descriptor', 'version', 'frame', 'extension', ] frame = ListType(IntType(), required=True) extension = ListType(StringType(), required=True, validators=[lambda x: vd.is_eq(x, 'jpg')]) height = ListType(IntType(), required=True, validators=[lambda x: vd.is_eq(x, 5)]) width = ListType(IntType(), required=True, validators=[lambda x: vd.is_eq(x, 4)]) channels = ListType(IntType(), required=True, validators=[lambda x: vd.is_eq(x, 3)]) file_traits = dict( width=tr.get_image_width, height=tr.get_image_height, channels=tr.get_num_image_channels, ) def get_asset_path(self, filepath): return Path(filepath).parents[0]
class Spec001(SequenceSpecificationBase): asset_name_fields = ['project', 'specification', 'descriptor', 'version'] # type: List[str] filename_fields = [ 'project', 'specification', 'descriptor', 'version', 'coordinate', 'frame', 'extension' ] # type: List[str] descriptor = ListType( StringType(), required=True, validators=[vd.is_descriptor, vd.is_homogenous] ) # type: ListType frame = ListType( IntType(), required=True, validators=[vd.is_frame] ) # type: ListType extension = ListType( StringType(), required=True, validators=[vd.is_extension, lambda x: vd.is_eq(x, 'png')] ) # type: ListType coordinate = ListType( ListType(IntType(), required=True, validators=[vd.is_coordinate]) ) # type: ListType height = ListType(IntType(), required=True) # type: ListType width = ListType(IntType(), required=True) # type: ListType channels = ListType(IntType(), required=True) # type: ListType file_traits = dict( width=tr.get_image_width, height=tr.get_image_height, channels=tr.get_num_image_channels ) # type: Dict[str, Any]
class Vdb001(FileSpecificationBase): filename_fields = [ 'project', 'specification', 'descriptor', 'version', 'extension' ] # type: List[str] extension = ListType( StringType(), required=True, validators=[vd.is_extension, lambda x: vd.is_eq(x, 'vdb')] ) # type: ListType
class Spec002(SequenceSpecificationBase): asset_name_fields = ['project', 'specification', 'descriptor', 'version'] # type: List[str] filename_fields = [ 'project', 'specification', 'descriptor', 'version', 'frame', 'extension' ] # type: List[str] frame = ListType( IntType(), required=True, validators=[vd.is_frame, lambda x: vd.is_gt(x, -1)] ) # type: ListType extension = ListType( StringType(), required=True, validators=[vd.is_extension, lambda x: vd.is_eq(x, 'jpg')] ) # type: ListType width = ListType( IntType(), required=True, validators=[lambda x: vd.is_eq(x, 1024)] ) # type: ListType height = ListType( IntType(), required=True, validators=[lambda x: vd.is_eq(x, 1024)] ) # type: ListType channels = ListType( IntType(), required=True, validators=[lambda x: vd.is_eq(x, 3)] ) # type: ListType file_traits = dict( width=tr.get_image_width, height=tr.get_image_height, channels=tr.get_num_image_channels ) # type: Dict[str, Any]
class Raw002(SequenceSpecificationBase): ''' Raw JPEG sequences with 1 or 3 channels and coordinates. Attributes: filename_fields (list[str]): project, specification, descriptor, version, frame, extension asset_name_fields (list[str]): project, specification, descriptor, version, height (int): Image height. Must be 1024. width (int): Image width. Must be 1024. extension (str): File extension. Must be "png". ''' asset_name_fields = ['project', 'specification', 'descriptor', 'version'] # type: List[str] filename_fields = [ 'project', 'specification', 'descriptor', 'version', 'coordinate', 'frame', 'extension' ] # type: List[str] height = ListType(IntType(), required=True) # type: ListType width = ListType(IntType(), required=True) # type: ListType frame = ListType(IntType(), required=True, validators=[vd.is_frame]) # type: ListType coordinate = ListType( ListType(IntType(), validators=[vd.is_coordinate]), required=True, ) # type: ListType channels = ListType(IntType(), required=True, validators=[lambda x: vd.is_in(x, [1, 3]) ]) # type: ListType extension = ListType( StringType(), required=True, validators=[vd.is_extension, lambda x: vd.is_eq(x, 'jpg')]) # type: ListType file_traits = dict( width=tr.get_image_width, height=tr.get_image_height, channels=tr.get_num_image_channels, ) # type: Dict[str, Any]
def test_is_eq(self): vd.is_eq(1, 1) expected = 'foo != bar.' with self.assertRaisesRegexp(ValidationError, expected): vd.is_eq('foo', 'bar')