# 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 utils import valid_idname, valid_guid, valid_key, reserved_word, find_key_in_query
from error import MQLParseError, MQLInternalError, MQLTypeError
from env import Guid
from pymql.util import keyquote
from pymql.log import LOG
from pymql.util.mwdatetime import coerce_datetime, uncoerce_datetime
import copy
  def get_reversed(self, varenv):
    if not self.reversed:
      self.reversed = ReversedSchemaProperty(self, varenv)

    return self.reversed


class ReversedSchemaProperty(SchemaProperty):
  # this class supports bug 7253 (! property reversing support)
  def __init__(self, orig_property, varenv):
    super(ReversedSchemaProperty,
          self).__init__(orig_property.type, '!' + orig_property.guid,
                         orig_property.name)
    self.orig_property = orig_property
    self.id = '!' + self.orig_property.id

    # make sure this will work...
    self.check_orig_property(varenv)
    self.set_from_orig_property()

  def check_orig_property(self, varenv):
    # return a made-up SchemaProperty that is the schema property turned around.
    # raise an MQLTypeError if such a thing makes no sense (for instance if they expected type is not in the object category)
    if self.orig_property.artificial:
      raise MQLTypeError(
          None,
          "Can't reverse artificial property %(property)s",
          property=self.orig_property.id)

    if self.orig_property.orig_property:

# 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/schema.py
from utils import valid_idname, valid_guid, valid_key, reserved_word, find_key_in_query
from error import MQLParseError, MQLInternalError, MQLTypeError
from env import Guid
from pymql.util import keyquote
from pymql.log import LOG
from pymql.util.mwdatetime import coerce_datetime, uncoerce_datetime
import copy

  def get_reversed(self, varenv):
    if not self.reversed:
      self.reversed = ReversedSchemaProperty(self, varenv)

    return self.reversed


class ReversedSchemaProperty(SchemaProperty):
  # this class supports bug 7253 (! property reversing support)
  def __init__(self, orig_property, varenv):
    super(ReversedSchemaProperty,
          self).__init__(orig_property.type, '!' + orig_property.guid,
                         orig_property.name)
    self.orig_property = orig_property
    self.id = '!' + self.orig_property.id

    # make sure this will work...
    self.check_orig_property(varenv)
    self.set_from_orig_property()

  def check_orig_property(self, varenv):
    # return a made-up SchemaProperty that is the schema property turned around.
    # raise an MQLTypeError if such a thing makes no sense (for instance if they expected type is not in the object category)
    if self.orig_property.artificial:
      raise MQLTypeError(
          None,
          "Can't reverse artificial property %(property)s",
          property=self.orig_property.id)

    if self.orig_property.orig_property:

      raise MQLInternalError(