<s> from __future__ import absolute_import <EOL> import uuid <EOL> import six <EOL> class UUID ( object ) : <EOL> """<STR_LIT>""" <EOL> def __str__ ( self ) : <EOL> return str ( self . v ) <EOL> def to_json ( self ) : <EOL> return str ( self . v ) <EOL> def apply_with ( self , _ , val , ctx ) : <EOL> """<STR_LIT>""" <EOL> if isinstance ( val , uuid . UUID ) : <EOL> self . v = val <EOL> elif isinstance ( val , six . string_types ) : <EOL> try : <EOL> self . v = uuid . UUID ( val ) <EOL> except ValueError : <EOL> self . v = uuid . UUID ( bytes = val ) <EOL> elif isinstance ( val , six . binary_type ) : <EOL> self . v = uuid . UUID ( bytes = val ) <EOL> else : <EOL> raise ValueError ( '<STR_LIT>' + str ( type ( v ) ) ) </s>
