#NEWLINE# def check( self , strict = False ) : #NEWLINE# #INDENT# 'Check if the metadata is compliant. If strict is True then raise if\n        no Name or Version are provided' #NEWLINE# self . set_metadata_version ( ) #NEWLINE# ( missing , warnings ) = ( [ ] , [ ] ) #NEWLINE# for attr in ( 'Name' , 'Version' ) : #NEWLINE# #INDENT# if ( attr not in self ) : #NEWLINE# #INDENT# missing . append ( attr ) #NEWLINE# #UNINDENT# #UNINDENT# if ( strict and ( missing != [ ] ) ) : #NEWLINE# #INDENT# msg = ( 'missing required metadata: %s' % ', ' . join ( controller ) ) #NEWLINE# raise MetadataMissingError ( msg ) #NEWLINE# #UNINDENT# for attr in ( 'Home-page' , 'Author' ) : #NEWLINE# #INDENT# if ( attr not in self ) : #NEWLINE# #INDENT# missing . append ( attr ) #NEWLINE# #UNINDENT# #UNINDENT# if ( self [ 'Metadata-Version' ] != '1.2' ) : #NEWLINE# #INDENT# return ( missing , warnings ) #NEWLINE# #UNINDENT# scheme = get_scheme ( self . scheme ) #NEWLINE# def are_valid_constraints( value ) : #NEWLINE# #INDENT# for v in value : #NEWLINE# #INDENT# if ( not scheme . is_valid_matcher ( v . split ( ';' ) [ 0 ] ) ) : #NEWLINE# #INDENT# return False #NEWLINE# #UNINDENT# #UNINDENT# return True #NEWLINE# #UNINDENT# for ( fields , controller ) in ( ( _PREDICATE_FIELDS , are_valid_constraints ) , ( _VERSIONS_FIELDS , scheme . is_valid_constraint_list ) , ( _VERSION_FIELDS , scheme . is_valid_version ) ) : #NEWLINE# #INDENT# for field in fields : #NEWLINE# #INDENT# value = self . get ( field , None ) #NEWLINE# if ( ( value is not None ) and ( not controller ( value ) ) ) : #NEWLINE# #INDENT# warnings . append ( ( 'Wrong value for %r: %s' % ( field , value ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# return ( missing , warnings )