Commit 2c4a6ccf authored by Cresson Remi's avatar Cresson Remi
Browse files

FIX: isinstance

1 merge request!23Add deepnets
Pipeline #34869 passed with stages
in 2 minutes and 23 seconds
Showing with 3 additions and 3 deletions
+3 -3
......@@ -18,7 +18,7 @@ def str2datetime(datestr):
"""
# source (with a few enhancements):
# https://stackoverflow.com/questions/23581128/how-to-format-date-string-via-multiple-formats-in-python
assert isinstance(str, datestr), "Input must be a str!"
assert isinstance(datestr, str), "Input must be a str!"
formats = ('%Y-%m-%d', '%d/%m/%Y', '%d-%m-%Y')
for fmt in formats:
try:
......@@ -39,7 +39,7 @@ def any2datetime(str_or_datetime):
A datetime.datetime instance
"""
if isinstance(datetime.datetime, str_or_datetime):
if isinstance(str_or_datetime, datetime.datetime):
return str_or_datetime
assert isinstance(str, str_or_datetime), "Date must be a str, or a datetime.datetime instance!"
assert isinstance(str_or_datetime, str), "Date must be a str, or a datetime.datetime instance!"
return dates.str2datetime(str_or_datetime)
\ No newline at end of file
Supports Markdown
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