<s> from ztag . transform import ZMapTransform , ZMapTransformOutput , Transformable <EOL> from ztag import protocols , errors <EOL> class UPnPTransform ( ZMapTransform ) : <EOL> name = "<STR_LIT>" <EOL> port = None <EOL> protocol = protocols . UPNP <EOL> subprotocol = protocols . UPNP . DISCOVERY <EOL> KEYS = [ <EOL> "<STR_LIT>" , <EOL> "<STR_LIT:location>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" <EOL> ] <EOL> def _transform_object ( self , obj ) : <EOL> classification = obj [ '<STR_LIT>' ] <EOL> if classification != "<STR_LIT>" : <EOL> raise errors . IgnoreObject ( classification ) <EOL> success = int ( obj [ '<STR_LIT:success>' ] ) <EOL> if success != <NUM_LIT:1> : <EOL> raise errors . IgnoreObject ( "<STR_LIT>" ) <EOL> wrapped = Transformable ( obj ) <EOL> transformed = { } <EOL> for key in self . KEYS : <EOL> transformed [ key ] = wrapped [ key ] . resolve ( ) <EOL> out = ZMapTransformOutput ( ) <EOL> out . transformed = transformed <EOL> return out </s>
