# Buggy code
def __new__(
    cls,
    data=None,
    freq=None,
    start=None,
    end=None,
    periods=None,
    copy=False,
    name=None,
    tz=None,
    verify_integrity=True,
    normalize=False,
    **kwds,
):
    dayfirst = kwds.pop("dayfirst", None)
    yearfirst = kwds.pop("yearfirst", None)
    warn = False
    if "offset" in kwds and kwds["offset"]:
        freq = kwds["offset"]
        warn = True

    freq_infer = False
    if not isinstance(freq, DateOffset):
        if freq != "infer":
            freq = to_offset(freq)
        else:
            freq_infer = True
            freq = None

    if warn:
        import warnings

        warnings.warn(
            "parameter 'offset' is deprecated, please use 'freq' instead", FutureWarning
        )

    offset = freq

    if periods is not None:
        if com.is_float(periods):
            periods = int(periods)
        elif not com.is_integer(periods):
            raise ValueError("Periods must be a number, got %s" % str(periods))

    if data is None and offset is None:
        raise ValueError("Must provide freq argument if no data is supplied")

    if data is None:
        return cls._generate(
            start, end, periods, name, offset, tz=tz, normalize=normalize
        )

    if not isinstance(data, np.ndarray):
        if np.isscalar(data):
            raise ValueError(
                "DatetimeIndex() must be called with a "
                "collection of some kind, %s was passed" % repr(data)
            )

        # other iterable of some kind
        if not isinstance(data, (list, tuple)):
            data = list(data)

        data = np.asarray(data, dtype="O")

        # try a few ways to make it datetime64
        if lib.is_string_array(data):
            data = _str_to_dt_array(
                data, offset, dayfirst=dayfirst, yearfirst=yearfirst
            )
        else:
            data = tools.to_datetime(data)
            data.offset = offset
            if isinstance(data, DatetimeIndex):
                if name is not None:
                    data.name = name
                return data

    if issubclass(data.dtype.type, basestring):
        subarr = _str_to_dt_array(data, offset, dayfirst=dayfirst, yearfirst=yearfirst)
    elif issubclass(data.dtype.type, np.datetime64):
        if isinstance(data, DatetimeIndex):
            if tz is None:
                tz = data.tz

            subarr = data.values

            if offset is None:
                offset = data.offset
                verify_integrity = False
        else:
            if data.dtype != _NS_DTYPE:
                subarr = lib.cast_to_nanoseconds(data)
            else:
                subarr = data
    elif data.dtype == _INT64_DTYPE:
        if copy:
            subarr = np.asarray(data, dtype=_NS_DTYPE)
        else:
            subarr = data.view(_NS_DTYPE)
    else:
        try:
            subarr = tools.to_datetime(data)
        except ValueError:
            # tz aware
            subarr = tools.to_datetime(data, utc=True)

        if not np.issubdtype(subarr.dtype, np.datetime64):
            raise TypeError("Unable to convert %s to datetime dtype" % str(data))

    if isinstance(subarr, DatetimeIndex):
        if tz is None:
            tz = subarr.tz
    else:
        if tz is not None:
            tz = tools._maybe_get_tz(tz)
            # Convert local to UTC
            ints = subarr.view("i8")

            subarr = lib.tz_localize_to_utc(ints, tz)
            subarr = subarr.view(_NS_DTYPE)

    subarr = subarr.view(cls)
    subarr.name = name
    subarr.offset = offset
    subarr.tz = tz

    if verify_integrity and len(subarr) > 0:
        if offset is not None and not freq_infer:
            inferred = subarr.inferred_freq
            if inferred != offset.freqstr:
                raise ValueError("Dates do not conform to passed frequency")

    if freq_infer:
        inferred = subarr.inferred_freq
        if inferred:
            subarr.offset = to_offset(inferred)

    return subarr


# Traceback (TypeError)
building [html]: targets for 22 source files that are out of date
updating environment: 218 added, 0 changed, 0 removed
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-767-cc6f0e841b62> in <module>()
1 df = read_csv('tmp.csv', header=None, parse_dates=date_spec,
----> 2                date_parser=conv.parse_date_time)

/home/wesm/code/pandas/pandas/io/parsers.pyc in read_csv(filepath_or_buffer, sep, dialect, header, index_col, names, skiprows, na_values, keep_default_na, thousands, comment, parse_dates, keep_date_col, dayfirst, date_parser, nrows, iterator, chunksize, skip_footer, converters, verbose, delimiter, encoding, squeeze)
239         kwds['delimiter'] = sep
240
--> 241     return _read(TextParser, filepath_or_buffer, kwds)
242
243 @Appender(_read_table_doc)

/home/wesm/code/pandas/pandas/io/parsers.pyc in _read(cls, filepath_or_buffer, kwds)
192         return parser
193
--> 194     return parser.get_chunk()
195
196 @Appender(_read_csv_doc)

/home/wesm/code/pandas/pandas/io/parsers.pyc in get_chunk(self, rows)
812         columns = list(self.columns)
813         if self.parse_dates is not None:
--> 814             data, columns = self._process_date_conversion(data)
815
816         df = DataFrame(data=data, columns=columns, index=index)

/home/wesm/code/pandas/pandas/io/parsers.pyc in _process_date_conversion(self, data_dict)
989
990                 _, col, old_names = _try_convert_dates(
--> 991                     self._conv_date, colspec, data_dict, self.orig_columns)
992
993                 new_data[new_name] = col

/home/wesm/code/pandas/pandas/io/parsers.pyc in _try_convert_dates(parser, colspec, data_dict, columns)
1120     to_parse = [data_dict[c] for c in colspec if c in data_dict]
1121     try:
-> 1122         new_col = parser(*to_parse)
1123     except DateConversionError:
1124         new_col = parser(_concat_date_cols(to_parse))

/home/wesm/code/pandas/pandas/io/parsers.pyc in _conv_date(self, *date_cols)
951                     return lib.try_parse_dates(_concat_date_cols(date_cols),
952                                                parser=self.date_parser,
--> 953                                                dayfirst=self.dayfirst)
954
955     def _process_date_conversion(self, data_dict):

/home/wesm/code/pandas/pandas/lib.so in pandas.lib.try_parse_dates (pandas/src/tseries.c:98928)()

/home/wesm/code/pandas/pandas/lib.so in pandas.lib.try_parse_dates (pandas/src/tseries.c:98870)()

TypeError: parse_date_time() takes exactly 2 arguments (1 given)
reading sources... [100%] whatsnew
/home/wesm/code/pandas/doc/source/faq.rst:74: ERROR: Unknown interpreted text role "issue".
source/v0.8.0.txt:151: WARNING: Inline literal start-st

# Fixed code
def __new__(
    cls,
    data=None,
    freq=None,
    start=None,
    end=None,
    periods=None,
    copy=False,
    name=None,
    tz=None,
    verify_integrity=True,
    normalize=False,
    **kwds,
):
    dayfirst = kwds.pop("dayfirst", None)
    yearfirst = kwds.pop("yearfirst", None)
    warn = False
    if "offset" in kwds and kwds["offset"]:
        freq = kwds["offset"]
        warn = True

    freq_infer = False
    if not isinstance(freq, DateOffset):
        if freq != "infer":
            freq = to_offset(freq)
        else:
            freq_infer = True
            freq = None

    if warn:
        import warnings

        warnings.warn(
            "parameter 'offset' is deprecated, please use 'freq' instead", FutureWarning
        )

    offset = freq

    if periods is not None:
        if com.is_float(periods):
            periods = int(periods)
        elif not com.is_integer(periods):
            raise ValueError("Periods must be a number, got %s" % str(periods))

    if data is None and offset is None:
        raise ValueError("Must provide freq argument if no data is supplied")

    if data is None:
        return cls._generate(
            start, end, periods, name, offset, tz=tz, normalize=normalize
        )

    if not isinstance(data, np.ndarray):
        if np.isscalar(data):
            raise ValueError(
                "DatetimeIndex() must be called with a "
                "collection of some kind, %s was passed" % repr(data)
            )

        # other iterable of some kind
        if not isinstance(data, (list, tuple)):
            data = list(data)

        data = np.asarray(data, dtype="O")

        # try a few ways to make it datetime64
        if lib.is_string_array(data):
            data = _str_to_dt_array(
                data, offset, dayfirst=dayfirst, yearfirst=yearfirst
            )
        else:
            data = tools.to_datetime(data)
            data.offset = offset
            if isinstance(data, DatetimeIndex):
                if name is not None:
                    data.name = name
                return data

    if issubclass(data.dtype.type, basestring):
        subarr = _str_to_dt_array(data, offset, dayfirst=dayfirst, yearfirst=yearfirst)
    elif issubclass(data.dtype.type, np.datetime64):
        if isinstance(data, DatetimeIndex):
            if tz is None:
                tz = data.tz

            subarr = data.values

            if offset is None:
                offset = data.offset
                verify_integrity = False
        else:
            if data.dtype != _NS_DTYPE:
                subarr = lib.cast_to_nanoseconds(data)
            else:
                subarr = data
    elif data.dtype == _INT64_DTYPE:
        if isinstance(data, Int64Index):
            raise TypeError("cannot convert Int64Index->DatetimeIndex")
        if copy:
            subarr = np.asarray(data, dtype=_NS_DTYPE)
        else:
            subarr = data.view(_NS_DTYPE)
    else:
        try:
            subarr = tools.to_datetime(data)
        except ValueError:
            # tz aware
            subarr = tools.to_datetime(data, utc=True)

        if not np.issubdtype(subarr.dtype, np.datetime64):
            raise TypeError("Unable to convert %s to datetime dtype" % str(data))

    if isinstance(subarr, DatetimeIndex):
        if tz is None:
            tz = subarr.tz
    else:
        if tz is not None:
            tz = tools._maybe_get_tz(tz)
            # Convert local to UTC
            ints = subarr.view("i8")

            subarr = lib.tz_localize_to_utc(ints, tz)
            subarr = subarr.view(_NS_DTYPE)

    subarr = subarr.view(cls)
    subarr.name = name
    subarr.offset = offset
    subarr.tz = tz

    if verify_integrity and len(subarr) > 0:
        if offset is not None and not freq_infer:
            inferred = subarr.inferred_freq
            if inferred != offset.freqstr:
                raise ValueError("Dates do not conform to passed frequency")

    if freq_infer:
        inferred = subarr.inferred_freq
        if inferred:
            subarr.offset = to_offset(inferred)

    return subarr