def _deserialize(self, value, attr, obj):
        """Deserializes a string into a Pendulum object."""
        if not self.context.get('convert_dates', True) or not value:
            return value

        value = super(PendulumField, self)._deserialize(value, attr, value)
        timezone = self.get_field_value('timezone')
        target = pendulum.instance(value)

        if (timezone and (text_type(target) !=
                          text_type(target.in_timezone(timezone)))):
            raise ValidationError(
                "The provided datetime is not in the "
                "{} timezone.".format(timezone)
            )

        return target
def _deserialize ( self , value , attr , obj ) : if not self . context . get ( 'convert_dates' , True ) or not value : return value value = super ( PendulumField , self ) . _deserialize ( value , attr , value ) timezone = self . get_field_value ( 'timezone' ) target = pendulum . instance ( value ) if ( timezone and ( text_type ( target ) != text_type ( target . in_timezone ( timezone ) ) ) ) : raise ValidationError ( "The provided datetime is not in the " "{} timezone." . format ( timezone ) ) return target
Deserializes a string into a Pendulum object.