@classmethod<EOL><INDENT>def parse(cls, date, **kwargs):<DEDENT>
<EOL>default_date1 = datetime.datetime(<NUM_LIT:1>, <NUM_LIT:1>, <NUM_LIT:1>)<EOL>default_date2 = datetime.datetime(<NUM_LIT:2>, <NUM_LIT:2>, <NUM_LIT:2>)<EOL>parsed_date1 = parse_date(date, default=default_date1, **kwargs)<EOL>parsed_date2 = parse_date(date, default=default_date2, **kwargs)<EOL>has_year = parsed_date1.year == parsed_date2.year<EOL>has_month = parsed_date1.month == parsed_date2.month<EOL>has_day = parsed_date1.day == parsed_date2.day<EOL>if has_year:<EOL><INDENT>year = parsed_date1.year<EOL><DEDENT>else:<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>month = parsed_date1.month if has_month else None<EOL>day = parsed_date1.day if has_day else None<EOL>return cls(year, month, day)<EOL>
Parse a date given in arbitrary format.

        This attempts to parse the input date, given in an arbitrary format

        Args:
            date(str): date to normalize
            **kwargs: these are passed to the `dateutil.parser.parse` function
                which is used internally to parse the date. Most notably, the
                `yearfirst` and `datefirst` flags can be used if the ordering
                of the date parts is known.

        Returns:
            PartialDate: an object holding the parsed date.

        Raises:
            ValueError: when the date cannot be parsed or no year is present.

        Examples:
            >>> PartialDate.parse('30 Jun 1686')
            PartialDate(year=1686, month=6, day=30)