Commit 95f2c8bd authored by Laurent Peuch's avatar Laurent Peuch
Browse files

[fix] logilab.common.date.strptime has been replaced by datetime.strptime

parent 8d79188376a2
Pipeline #7437 passed with stage
in 3 minutes and 11 seconds
......@@ -24,7 +24,7 @@ from typing import Set, Type, Dict, Union, Callable, Any, Iterable, TypeVar
import pkg_resources
from logilab.common.date import strptime, strptime_time
from logilab.common.date import strptime_time
from logilab.common import nullobject
from yams._exceptions import SchemaError, UnknownType, BadSchemaDefinition, ValidationError # noqa
......@@ -100,8 +100,10 @@ KEYWORD_MAP: Dict[str, Dict[str, _current_date_or_datetime_constructor_type]] =
# bw compat for literal date/time values stored as strings in schemas
DATE_FACTORY_MAP: Dict[str, Callable[[str], Union[datetime, float]]] = {
"Datetime": lambda x: ":" in x and strptime(x, "%Y/%m/%d %H:%M") or strptime(x, "%Y/%m/%d"),
"Date": lambda x: strptime(x, "%Y/%m/%d"),
"Datetime": lambda x: ":" in x
and datetime.strptime(x, "%Y/%m/%d %H:%M")
or datetime.strptime(x, "%Y/%m/%d"),
"Date": lambda x: datetime.strptime(x, "%Y/%m/%d"),
"Time": strptime_time, # returns a float (from time())
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment