Deserializes string to date. :param string: str. :return: date.
(self, string)
| 637 | return value |
| 638 | |
| 639 | def __deserialize_date(self, string): |
| 640 | """Deserializes string to date. |
| 641 | |
| 642 | :param string: str. |
| 643 | :return: date. |
| 644 | """ |
| 645 | try: |
| 646 | return parse(string).date() |
| 647 | except ImportError: |
| 648 | return string |
| 649 | except ValueError: |
| 650 | raise rest.ApiException( |
| 651 | status=0, |
| 652 | reason="Failed to parse `{0}` as date object".format(string) |
| 653 | ) |
| 654 | |
| 655 | def __deserialize_datetime(self, string): |
| 656 | """Deserializes string to datetime. |