src/pybel/utils.py
def parse_datetime(s: str) -> datetime.date:
    """Try to parse a datetime object from a standard datetime format or date format."""
    for fmt in (CREATION_DATE_FMT, PUBLISHED_DATE_FMT, PUBLISHED_DATE_FMT_2):
        try:
            dt = datetime.strptime(s, fmt)
        except ValueError:
            pass
        else:
            return dt

    raise ValueError('Incorrect datetime format for {}'.format(s))
Try to parse a datetime object from a standard datetime format or date format.
Try to parse a datetime object from a standard datetime format or date format.
Try to parse a datetime object from a standard datetime format or date format .
def parse_datetime(s: str) -> datetime.date:
    for fmt in (CREATION_DATE_FMT, PUBLISHED_DATE_FMT, PUBLISHED_DATE_FMT_2):
        try:
            dt = datetime.strptime(s, fmt)
        except ValueError:
            pass
        else:
            return dt
    raise ValueError('Incorrect datetime format for {}'.format(s))
def parse_datetime ( s : str ) -> datetime . date : for fmt in ( CREATION_DATE_FMT , PUBLISHED_DATE_FMT , PUBLISHED_DATE_FMT_2 ) : try : dt = datetime . strptime ( s , fmt ) except ValueError : pass else : return dt raise ValueError ( 'Incorrect datetime format for {}' . format ( s ) )
Try to parse a datetime object from a standard datetime format or date format.
Try to parse a datetime object from a standard datetime format or date format .
"""Try to parse a datetime object from a standard datetime format or date format."""
s
str