# 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'


import re
  import sys, os
import json
import scope
import lookup
import pprint
import cgi
  import cmdline
from pymql.log import LOG, log_util, pprintlog, dumplog
from pymql.error import EmptyResult
from qprim import QueryPrimitive
from utils import (element, elements, dict_recurse, valid_relname, follow_path,
                   is_direct_pointer, valid_precompiled_sort, ReadMode,
                   WriteMode, PrepareMode, CheckMode, QueryDict, QueryList,
                   ResultDict, Missing)
from error import MQLResultError, MQLInternalError, MQLInternalParseError, MQLAccessError, MQLGraphError
from env import Varenv
            filter_result[key] = result[key]
          elif basekey == 'value':
            # sanitize results.
            filter_result[key] = self.sanitize_value(
                result[key], result[key[0] + 'datatype'], varenv)
          elif basekey in QueryPrimitive.values:
            # this better be what you said!!!
            filter_result[key] = result[key]
          elif basekey == 'index':
            filter_result[key] = self.generate_index_read_result(result)
          elif basekey in QueryPrimitive.pointers:
            # might be direct sub-query or constraint, or query
            if isinstance(asked, dict):
              # sub-query, return it
              filter_result[key] = self.filter_query_result(result[key], varenv)
            else:
              if asked is None:
                # we'll be asking for the id of this thing, not just the guid.
                varenv.lookup_manager.guid_list.append(result[key])

              # just give back the guid
              filter_result[key] = result[key]
        elif valid_relname(key):
          # skip optional results we didn't get a value for.
          if result.query.get('@optional') and key not in result:
            # XXX should we give you None as a result rather than leaving it out completely?
            pass
          else:
            # is this a ResultError or an InternalError?
            if key not in result:

# 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/lojson.py
import re
  import sys, os
import json
import scope
import lookup
import pprint
import cgi
  import cmdline
from pymql.log import LOG, log_util, pprintlog, dumplog
from pymql.error import EmptyResult
from qprim import QueryPrimitive
from utils import (element, elements, dict_recurse, valid_relname, follow_path,
                   is_direct_pointer, valid_precompiled_sort, ReadMode,
                   WriteMode, PrepareMode, CheckMode, QueryDict, QueryList,
                   ResultDict, Missing)
from error import MQLResultError, MQLInternalError, MQLInternalParseError, MQLAccessError, MQLGraphError
from env import Varenv

            filter_result[key] = result[key]
          elif basekey == 'value':
            # sanitize results.
            filter_result[key] = self.sanitize_value(
                result[key], result[key[0] + 'datatype'], varenv)
          elif basekey in QueryPrimitive.values:
            # this better be what you said!!!
            filter_result[key] = result[key]
          elif basekey == 'index':
            filter_result[key] = self.generate_index_read_result(result)
          elif basekey in QueryPrimitive.pointers:
            # might be direct sub-query or constraint, or query
            if isinstance(asked, dict):
              # sub-query, return it
              filter_result[key] = self.filter_query_result(result[key], varenv)
            else:
              if asked is None:
                # we'll be asking for the id of this thing, not just the guid.
                varenv.lookup_manager.guid_list.append(result[key])

              # just give back the guid
              filter_result[key] = result[key]
        elif valid_relname(key):
          # skip optional results we didn't get a value for.
          if result.query.get('@optional') and key not in result:
            # XXX should we give you None as a result rather than leaving it out completely?
            pass
          else:
            # is this a ResultError or an InternalError?
            if key not in result:

              raise MQLInternalError(