<s> """<STR_LIT>""" <EOL> import json <EOL> import pickle <EOL> import couchbase . exceptions as E <EOL> import couchbase . _libcouchbase as C <EOL> from couchbase . items import ItemCollection , ItemOptionDict , ItemSequence <EOL> from couchbase . result import SubdocResult <EOL> from couchbase . subdocument import MultiValue <EOL> def _result__repr__ ( self ) : <EOL> """<STR_LIT>""" <EOL> details = [ ] <EOL> flags = self . __class__ . _fldprops <EOL> rcstr = "<STR_LIT>" . format ( self . rc ) <EOL> if self . rc != <NUM_LIT:0> : <EOL> rcstr += "<STR_LIT>" . format ( self . errstr ) <EOL> details . append ( rcstr ) <EOL> if flags & C . PYCBC_RESFLD_KEY and hasattr ( self , '<STR_LIT:key>' ) : <EOL> details . append ( "<STR_LIT>" . format ( repr ( self . key ) ) ) <EOL> if flags & C . PYCBC_RESFLD_VALUE and hasattr ( self , '<STR_LIT:value>' ) : <EOL> details . append ( "<STR_LIT>" . format ( repr ( self . value ) ) ) <EOL> if flags & C . PYCBC_RESFLD_CAS and hasattr ( self , '<STR_LIT>' ) : <EOL> details . append ( "<STR_LIT>" . format ( cas = self . cas ) ) <EOL> if flags & C . PYCBC_RESFLD_CAS and hasattr ( self , '<STR_LIT>' ) : <EOL> details . append ( "<STR_LIT>" . format ( flags = self . flags ) ) <EOL> if flags & C . PYCBC_RESFLD_HTCODE and hasattr ( self , "<STR_LIT>" ) : <EOL> details . append ( "<STR_LIT>" . format ( self . http_status ) ) <EOL> if flags & C . PYCBC_RESFLD_URL and hasattr ( self , "<STR_LIT:url>" ) : <EOL> details . append ( "<STR_LIT>" . format ( self . url ) ) <EOL> if hasattr ( self , '<STR_LIT>' ) : <EOL> details += self . _pycbc_repr_extra ( ) <EOL> ret = "<STR_LIT>" . format ( self . __class__ . __name__ , '<STR_LIT:U+002CU+0020>' . join ( details ) ) <EOL> return ret <EOL> def _observeinfo__repr__ ( self ) : <EOL> constants = ( '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' ) <EOL> flag_str = '<STR_LIT>' <EOL> for c in constants : <EOL> if self . flags == getattr ( C , c ) : <EOL> flag_str = c <EOL> break <EOL> fmstr = ( "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> ret = fmstr . format ( cls = self . __class__ . __name__ , <EOL> status_s = flag_str , <EOL> flags = self . flags , <EOL> is_master = bool ( self . from_master ) , <EOL> cas = self . cas ) <EOL> return ret <EOL> def _json_encode_wrapper ( * args ) : <EOL> return json . dumps ( * args , ensure_ascii = False , separators = ( '<STR_LIT:U+002C>' , '<STR_LIT::>' ) ) <EOL> class FMT_AUTO_object_not_a_number ( object ) : <EOL> pass <EOL> _FMT_AUTO = FMT_AUTO_object_not_a_number ( ) <EOL> MAX_URI_LENGTH = <NUM_LIT> <EOL> def _view_path_helper ( options ) : <EOL> if not options : <EOL> return '<STR_LIT>' , '<STR_LIT>' <EOL> post_body = '<STR_LIT>' <EOL> encoded = options . encoded <EOL> if len ( encoded ) > MAX_URI_LENGTH : <EOL> encoded , post_body = options . _long_query_encoded <EOL> return encoded , post_body <EOL> def run_init ( m ) : <EOL> m . _init_helpers ( result_reprfunc = _result__repr__ , <EOL> fmt_utf8_flags = C . FMT_UTF8 , <EOL> fmt_bytes_flags = C . FMT_BYTES , <EOL> fmt_json_flags = C . FMT_JSON , <EOL> fmt_pickle_flags = C . FMT_PICKLE , <EOL> pickle_encode = pickle . dumps , <EOL> pickle_decode = pickle . loads , <EOL> json_encode = _json_encode_wrapper , <EOL> json_decode = json . loads , <EOL> lcb_errno_map = E . _LCB_ERRNO_MAP , <EOL> misc_errno_map = E . _EXCTYPE_MAP , <EOL> default_exception = E . CouchbaseError , <EOL> obsinfo_reprfunc = _observeinfo__repr__ , <EOL> itmcoll_base_type = ItemCollection , <EOL> itmopts_dict_type = ItemOptionDict , <EOL> itmopts_seq_type = ItemSequence , <EOL> fmt_auto = _FMT_AUTO , <EOL> view_path_helper = _view_path_helper , <EOL> sd_result_type = SubdocResult , <EOL> sd_multival_type = MultiValue ) <EOL> run_init ( C ) <EOL> C . FMT_AUTO = _FMT_AUTO </s>
