
from schematics.exceptions import ConversionError, ValidationError


def validate(schema, data):
    try:
        schema.import_data(data)
        schema.validate()
    except (ConversionError, ValidationError) as e:
        raise InvalidInputError(details=e.messages)


def weight_validator(value):
    if abs(value.as_tuple().exponent) > 1:
        raise ValidationError('Only one decimal point is allowed.')

    return value


from schematics.exceptions import ConversionError, ValidationError
from .errors import InvalidInputError


def validate(schema, data):
    try:
        schema.import_data(data)
        schema.validate()
    except (ConversionError, ValidationError) as e:
        raise InvalidInputError(details=e.messages)


def weight_validator(value):
    if abs(value.as_tuple().exponent) > 1:
        raise ValidationError('Only one decimal point is allowed.')

    return value

Fix bug, InvalidInputError not defined.
Fix bug, InvalidInputError not defined.
  
  from schematics.exceptions import ConversionError, ValidationError
+ from .errors import InvalidInputError
  
  
  def validate(schema, data):
      try:
          schema.import_data(data)
          schema.validate()
      except (ConversionError, ValidationError) as e:
          raise InvalidInputError(details=e.messages)
  
  
  def weight_validator(value):
      if abs(value.as_tuple().exponent) > 1:
          raise ValidationError('Only one decimal point is allowed.')
  
      return value
  
Fix bug, InvalidInputError not defined.
## Code Before:

from schematics.exceptions import ConversionError, ValidationError


def validate(schema, data):
    try:
        schema.import_data(data)
        schema.validate()
    except (ConversionError, ValidationError) as e:
        raise InvalidInputError(details=e.messages)


def weight_validator(value):
    if abs(value.as_tuple().exponent) > 1:
        raise ValidationError('Only one decimal point is allowed.')

    return value

## Instruction:
Fix bug, InvalidInputError not defined.
## Code After:

from schematics.exceptions import ConversionError, ValidationError
from .errors import InvalidInputError


def validate(schema, data):
    try:
        schema.import_data(data)
        schema.validate()
    except (ConversionError, ValidationError) as e:
        raise InvalidInputError(details=e.messages)


def weight_validator(value):
    if abs(value.as_tuple().exponent) > 1:
        raise ValidationError('Only one decimal point is allowed.')

    return value
