<s> from __future__ import print_function , unicode_literals <EOL> from voodoo . representable import Representable <EOL> class Resource ( object ) : <EOL> __metaclass__ = Representable <EOL> def __init__ ( self , resource_type , resource_instance ) : <EOL> self . resource_type = resource_type <EOL> self . resource_instance = resource_instance <EOL> def to_weblab_str ( self ) : <EOL> return "<STR_LIT>" % ( self . resource_instance , self . resource_type ) <EOL> def __hash__ ( self ) : <EOL> return hash ( self . to_weblab_str ( ) ) <EOL> @ staticmethod <EOL> def parse ( weblab_str ) : <EOL> pos = weblab_str . find ( "<STR_LIT:@>" ) <EOL> resource_instance = weblab_str [ : pos ] <EOL> resource_type = weblab_str [ pos + <NUM_LIT:1> : ] <EOL> return Resource ( resource_type , resource_instance ) </s>
