<s> from __future__ import absolute_import <EOL> import io <EOL> import struct <EOL> import warnings <EOL> from psd_tools . utils import unpack , read_fmt , read_unicode_string <EOL> def single_value ( fmt ) : <EOL> def decoder ( data ) : <EOL> return unpack ( fmt , data ) [ <NUM_LIT:0> ] <EOL> return decoder <EOL> def unicode_string ( data ) : <EOL> return read_unicode_string ( io . BytesIO ( data ) ) <EOL> def boolean ( fmt = "<STR_LIT:?>" ) : <EOL> fmt_size = struct . calcsize ( str ( fmt ) ) <EOL> def decoder ( data ) : <EOL> return bool ( single_value ( fmt ) ( data [ : fmt_size ] ) ) <EOL> return decoder <EOL> def new_registry ( ) : <EOL> """<STR_LIT>""" <EOL> decoders = { } <EOL> def register ( key ) : <EOL> def decorator ( func ) : <EOL> decoders [ key ] = func <EOL> return func <EOL> return decorator <EOL> return decoders , register </s>
