<s> import six <EOL> import flask . views <EOL> from flask_apispec . annotations import activate <EOL> def inherit ( child , parents ) : <EOL> child . __apispec__ = child . __dict__ . get ( '<STR_LIT>' , { } ) <EOL> for key in [ '<STR_LIT:args>' , '<STR_LIT>' , '<STR_LIT>' ] : <EOL> child . __apispec__ . setdefault ( key , [ ] ) . extend ( <EOL> annotation <EOL> for parent in parents <EOL> for annotation in getattr ( parent , '<STR_LIT>' , { } ) . get ( key , [ ] ) <EOL> if annotation not in child . __apispec__ [ key ] <EOL> ) <EOL> class ResourceMeta ( type ) : <EOL> def __new__ ( mcs , name , bases , attrs ) : <EOL> klass = super ( ResourceMeta , mcs ) . __new__ ( mcs , name , bases , attrs ) <EOL> mro = klass . mro ( ) <EOL> inherit ( klass , mro [ <NUM_LIT:1> : ] ) <EOL> methods = [ <EOL> each . lower ( ) for each in <EOL> getattr ( klass , '<STR_LIT>' , None ) or flask . views . http_method_funcs <EOL> ] <EOL> for key , value in six . iteritems ( attrs ) : <EOL> if key . lower ( ) in methods : <EOL> parents = [ <EOL> getattr ( parent , key ) for parent in mro <EOL> if hasattr ( parent , key ) <EOL> ] <EOL> inherit ( value , parents ) <EOL> setattr ( klass , key , activate ( value ) ) <EOL> if not isinstance ( value , staticmethod ) : <EOL> value . __dict__ . setdefault ( '<STR_LIT>' , { } ) <EOL> value . __apispec__ [ '<STR_LIT>' ] = True <EOL> return klass <EOL> class MethodResourceMeta ( ResourceMeta , flask . views . MethodViewType ) : <EOL> pass <EOL> class MethodResource ( six . with_metaclass ( MethodResourceMeta , flask . views . MethodView ) ) : <EOL> """<STR_LIT>""" <EOL> methods = None </s>
