| Conditions | 2 |
| Total Lines | 16 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | from datetime import datetime |
||
| 7 | def default_string_deserializer(obj: str, |
||
| 8 | cls: Optional[type] = None, |
||
| 9 | **kwargs) -> object: |
||
| 10 | """ |
||
| 11 | Deserialize a string. If the given ``obj`` can be parsed to a date, a |
||
| 12 | ``datetime`` instance is returned. |
||
| 13 | :param obj: the string that is to be deserialized. |
||
| 14 | :param cls: not used. |
||
| 15 | :param kwargs: any keyword arguments. |
||
| 16 | :return: the deserialized obj. |
||
| 17 | """ |
||
| 18 | try: |
||
| 19 | result = load(obj, datetime, **kwargs) |
||
| 20 | except DeserializationError: |
||
| 21 | result = obj |
||
| 22 | return result |
||
| 23 |