# Path: error.py
# def is_valid_HTTP_code(code):
# def get_HTTP_err(code):
#   def __init__(self,
#                msg,
#                http_code=400,
#                app_code=DEF_ME_CODE,
#                inner_exc=None,
#                **kwds):
#   def gen_msgs(self, **kwds):
#   def get_err_dict(self):
#   def __str__(self):
#   def __init__(self,
#                msg,
#                http_code=500,
#                app_code=ParameterizedError.DEF_ME_CODE,
#                inner_exc=None,
#                **kwds):
#   def __init__(self, msg=None, *args, **kwds):
# class ParameterizedError(Exception):
# class NetworkAddressError(ParameterizedError):
# class ContentLoadError(ParameterizedError):
# class TypeVerifyError(ParameterizedError):
# class EmailError(ParameterizedError):
# class SubscriptionError(ParameterizedError):
# class MSSError(ParameterizedError):
# class UserLookupError(ParameterizedError):
# class UserAuthError(ParameterizedError):
# class BlobError(ParameterizedError):
# class BLOBClientError(ParameterizedError):
# class RelevanceError(ParameterizedError):
# class TextSearchError(ParameterizedError):
# class AutocompleteError(ParameterizedError):
# class EmptyResult(ParameterizedError):
# class GraphConnectionError(ParameterizedError):
# class FormattingError(ParameterizedError):
# class SessionError(ParameterizedError):
# class ConfigError(ParameterizedError):
# class SanitizationError(ParameterizedError):
# class BlurbError(ParameterizedError):
# class DomainOperationError(ParameterizedError):
# class GenericRuntimeError(ParameterizedError):
# class OAuthDisabledError(ParameterizedError):
# class RecaptchaError(ParameterizedError):
# class ReadOnlyDatabaseError(ParameterizedError):
#   DEF_PFX = '/api/status/error'
#   DEF_ME_CODE = '/unknown/unknown'


from grquoting import quote, unquote
from itertools import chain
from utils import (valid_value_op, valid_timestamp_op, valid_timestamp,
                   valid_history_op, valid_guid, ReadMode, WriteMode,
                   PrepareMode, CheckMode, Missing, ResultDict, incr_subseq)
from error import (MQLResultError, MQLInternalError, MQLInternalParseError,
                   MQLValueAlreadyInUseError, MQLTooManyValuesForUniqueQuery)
from pymql.log import LOG
            'Namespace has ambiguous uniqueness state',
            result=result[n])

      n += 1

    # check we processed everything...
    if n != len(result):
      raise MQLInternalError(
          self.query,
          'Got %(count)d results, expecting %(expected_count)d',
          count=len(result),
          expected_count=n)

  def add_order_results(self, results):
    self.existing_order = []

    for existing in results:
      # find out what the existing order looks like...
      n = len(self.result)
      guid = None
      order = None

      # ['guid', 'typeguid', 'contents']
      for i in xrange(n):
        if self.result[i] == 'guid':
          guid = self.transform_result(self.result[i], existing[i])

      # there's exactly one more thing -- the order info itself.
      # ['guid','typeguid','datatype','value']
      if len(existing[n]) != 1:

# Path: error.py
# def is_valid_HTTP_code(code):
# def get_HTTP_err(code):
#   def __init__(self,
#                msg,
#                http_code=400,
#                app_code=DEF_ME_CODE,
#                inner_exc=None,
#                **kwds):
#   def gen_msgs(self, **kwds):
#   def get_err_dict(self):
#   def __str__(self):
#   def __init__(self,
#                msg,
#                http_code=500,
#                app_code=ParameterizedError.DEF_ME_CODE,
#                inner_exc=None,
#                **kwds):
#   def __init__(self, msg=None, *args, **kwds):
# class ParameterizedError(Exception):
# class NetworkAddressError(ParameterizedError):
# class ContentLoadError(ParameterizedError):
# class TypeVerifyError(ParameterizedError):
# class EmailError(ParameterizedError):
# class SubscriptionError(ParameterizedError):
# class MSSError(ParameterizedError):
# class UserLookupError(ParameterizedError):
# class UserAuthError(ParameterizedError):
# class BlobError(ParameterizedError):
# class BLOBClientError(ParameterizedError):
# class RelevanceError(ParameterizedError):
# class TextSearchError(ParameterizedError):
# class AutocompleteError(ParameterizedError):
# class EmptyResult(ParameterizedError):
# class GraphConnectionError(ParameterizedError):
# class FormattingError(ParameterizedError):
# class SessionError(ParameterizedError):
# class ConfigError(ParameterizedError):
# class SanitizationError(ParameterizedError):
# class BlurbError(ParameterizedError):
# class DomainOperationError(ParameterizedError):
# class GenericRuntimeError(ParameterizedError):
# class OAuthDisabledError(ParameterizedError):
# class RecaptchaError(ParameterizedError):
# class ReadOnlyDatabaseError(ParameterizedError):
#   DEF_PFX = '/api/status/error'
#   DEF_ME_CODE = '/unknown/unknown'


# Path: mql/qprim.py
from grquoting import quote, unquote
from itertools import chain
from utils import (valid_value_op, valid_timestamp_op, valid_timestamp,
                   valid_history_op, valid_guid, ReadMode, WriteMode,
                   PrepareMode, CheckMode, Missing, ResultDict, incr_subseq)
from error import (MQLResultError, MQLInternalError, MQLInternalParseError,
                   MQLValueAlreadyInUseError, MQLTooManyValuesForUniqueQuery)
from pymql.log import LOG

            'Namespace has ambiguous uniqueness state',
            result=result[n])

      n += 1

    # check we processed everything...
    if n != len(result):
      raise MQLInternalError(
          self.query,
          'Got %(count)d results, expecting %(expected_count)d',
          count=len(result),
          expected_count=n)

  def add_order_results(self, results):
    self.existing_order = []

    for existing in results:
      # find out what the existing order looks like...
      n = len(self.result)
      guid = None
      order = None

      # ['guid', 'typeguid', 'contents']
      for i in xrange(n):
        if self.result[i] == 'guid':
          guid = self.transform_result(self.result[i], existing[i])

      # there's exactly one more thing -- the order info itself.
      # ['guid','typeguid','datatype','value']
      if len(existing[n]) != 1:

        raise MQLResultError(