<s> """<STR_LIT>""" <EOL> import copy <EOL> from jsonschema . validators import RefResolver , validator_for <EOL> from jsonschema import draft4_format_checker <EOL> __all__ = [ <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> ] <EOL> class SchemaNotProvided ( Exception ) : <EOL> """<STR_LIT>""" <EOL> class LocalRefResolver ( RefResolver ) : <EOL> """<STR_LIT>""" <EOL> def resolve_remote ( self , uri ) : <EOL> raise SchemaNotProvided ( uri ) <EOL> def getValidator ( schema , schema_store ) : <EOL> """<STR_LIT>""" <EOL> resolver = LocalRefResolver ( <EOL> base_uri = b'<STR_LIT>' , <EOL> referrer = schema , store = schema_store ) <EOL> resolver . resolution_scope = b'<STR_LIT>' <EOL> return validator_for ( schema ) ( <EOL> schema , resolver = resolver , format_checker = draft4_format_checker ) <EOL> def resolveSchema ( schema , schemaStore ) : <EOL> """<STR_LIT>""" <EOL> result = copy . deepcopy ( schema ) <EOL> resolver = LocalRefResolver ( base_uri = b'<STR_LIT>' , referrer = schema , <EOL> store = schemaStore ) <EOL> def resolve ( obj ) : <EOL> if isinstance ( obj , list ) : <EOL> for item in obj : <EOL> resolve ( item ) <EOL> return <EOL> if isinstance ( obj , dict ) : <EOL> if "<STR_LIT>" in obj : <EOL> with resolver . resolving ( obj [ u'<STR_LIT>' ] ) as resolved : <EOL> resolve ( resolved ) <EOL> obj . clear ( ) <EOL> obj . update ( resolved ) <EOL> else : <EOL> for value in obj . values ( ) : <EOL> resolve ( value ) <EOL> resolve ( result ) <EOL> result [ "<STR_LIT>" ] = "<STR_LIT>" <EOL> return result </s>
