
x\c           @   sD  d  d l  m Z m Z m Z d  d l m Z d  d l Z d  d l m Z m	 Z	 d  d l
 Z
 d  d l
 m Z d  d l Z d  d l Z d  d l m Z m Z d  d l m Z m Z d  d l j j Z d  d l Z e
 j j d d	 d
 d e
 j d e
 j j  f e
 j j! d  d   Z" d   Z# e j$ d e%  d    Z& e j$ d e%  d    Z' e j$ d d d d d d d d g  d    Z( e j$ d d d d d g d d     d!    Z) e) Z* e j$ d d d g d d"    d#    Z+ e j$ d$    Z, e j$ d e% e- d g  d%    Z/ d& d' d( d) d* d+ d, d- d. d/ d0 d1 d2 d3 g Z0 e sde0 j1 d4 d5 g  n  e j$ d e0  d6    Z2 d7 d8 d9 d: d; d< d= d> d? d@ g
 Z3 e j$ d e3  dA    Z4 dB dC g Z5 e j$ d e5  dD    Z6 e j7 j8 j9 j: j;   Z: e j$ d e< e:   dE    Z= dF   Z> e j$ d dG dH dI dJ dK dL g  dM    Z? e j$ d d dN dO dP e j@ dQ dR e jA g  dS    ZB e j$ d dN dO dP e j@ dQ dR e jA g  dT    ZC e j$ d e% e- g  dU    ZD e j$ dV dW  dX    ZE dY dZ e e	   g ZF e rCd  d[ l  mG ZG eF jH eG j  n  e j$ d eF  d\    ZI e j$ d d] d^ d_ d` g  da    ZJ e j$ db    ZK e j$ dc    ZL e j$ dd    ZM e j$ d de df g  dg    ZN e j$ d d_ d` dh di g  dj    ZO e j$ d d_ d` dh di g  dk    ZP e j$ d d e jQ e jR eS dl  e jS dm  g  dn    ZT eT ZU e j$ d d e jQ e jR g  do    ZV eV ZW d dp dq dr ds dt e	   e   e du  e d  e dv  g ZX e jY eZ eX   e j$ d eX  dw     Z[ e jY eZ eX d   e j$ d eX d  dx     Z\ dy dz d{ d| g Z] d} d~ d d g Z^ e_ d d d d g Z` d d d d g Za e] e` Zb e^ ea Zc eS d d g Zd ee d d g Zf eZ d d g Zg d d g Zh d d g Zi ej d g Zk el d g Zm en d g Zo ed eb Zp ep ef eg eh ei ek eo em e Zq e j$ d eg  d    Zr e j$ d ed  d    Zs e j$ d ef  d    Zt e j$ d e`  d    Zu e j$ d e]  d    Zv e j$ d eb  d    Zw e j$ d ep  d    Zx e j$ d eq  d    Zy d d e jQ d g f e s7d n d e d  e jQ e d  g f e rdd n d d e jQ d g f d e jQ e jQ e jQ g f d g  f d d e jQ d g f d d e jQ d g f d d e jQ d g f d d e jQ d g f d d e jQ d g f d e d  e jQ e d  g f d e% e jQ e- g f d e jz d  e jQ e jz d  g f d e j{ d  e jQ e j{ d  g f d e d d d  e jQ e d d d  g f d e d  e jQ e d  g f d e d  e jQ e d  g f d e j| d  e jR e j| d  g f d e j} d d  e jQ e j} d d  g f g Z~ e e~   \ Z Z e j$ d e~ d e  d    Z e j$ d g  e j j D]9 Z e e e j e  e j j  r
e e j e  ^ q
 d    Z x` d j   D]R Z e e j j e  Z e j e e j e d e j d d  d e j    q
Wxx d j   D]j Z e e j j e  Z e j e e j e d e j d d  d e j   d e j d d d d   qWWxx d j   D]j Z e e j j e  Z e j e e j e d e j d d  d e j   d e j d d d d   qWd S(   i(   t   datet   timet	   timedelta(   t   DecimalN(   t   tzlocalt   tzutc(   t
   strategies(   t   FixedOffsett   utc(   t   PY3t   ut   cit   deadlinei  t   timeoutt   suppress_health_checkc         C   s   |  j  d d d d d |  j  d d d d d |  j  d d d d d	 |  j  d
 d d d d |  j  d d d d d |  j  d d d d d d  S(   Ns   --skip-slowt   actiont
   store_truet   helps   skip slow testss   --skip-networks   skip network testss	   --skip-dbs   skip db testss   --run-high-memorys   run high memory testss   --only-slows   run only slow testss   --strict-data-filess0   Fail if a test is skipped for missing data file.(   t	   addoption(   t   parser(    (    s.   lib/python2.7/site-packages/pandas/conftest.pyt   pytest_addoption   s    c         C   s   d |  j  k r1 |  j j d  r1 t j d  n  d |  j  k rb |  j j d  rb t j d  n  d |  j  k r |  j j d  r t j d  n  d	 |  j  k r |  j j d
  r t j d  n  d |  j  k r |  j j d  r t j d  n  d  S(   Nt   slows   --skip-slows   skipping due to --skip-slows   --only-slows   skipping due to --only-slowt   networks   --skip-networks   skipping due to --skip-networkt   dbs	   --skip-dbs   skipping due to --skip-dbt   high_memorys   --run-high-memorys=   skipping high memory test since --run-high-memory was not set(   t   keywordst   configt	   getoptiont   pytestt   skip(   t   item(    (    s.   lib/python2.7/site-packages/pandas/conftest.pyt   pytest_runtest_setup.   s    !!!!
t   autousec           C   s   t  j d d  d  S(   Nt   chained_assignmentt   raise(   t   pdt
   set_option(    (    (    s.   lib/python2.7/site-packages/pandas/conftest.pyt   configure_testsC   s    c         C   s   t  |  d <t |  d <d  S(   Nt   npR#   (   R&   R#   (   t   doctest_namespace(    (    s.   lib/python2.7/site-packages/pandas/conftest.pyt   add_importsJ   s    
t   paramst   bsrt   coot   csct   csrt   diat   dokt   lilc         C   s$   d d l  m } t | |  j d  S(   Ni(   t   sparset   _matrix(   t   scipyR1   t   getattrt   param(   t   requestR1   (    (    s.   lib/python2.7/site-packages/pandas/conftest.pyt   spmatrixP   s    i    i   t   indext   columnst   idsc         C   s   d j  |   S(   Ns	   axis {!r}(   t   format(   t   x(    (    s.   lib/python2.7/site-packages/pandas/conftest.pyt   <lambda>W   s    c         C   s   |  j  S(   sB   
     Fixture for returning the axis numbers of a DataFrame.
     (   R5   (   R6   (    (    s.   lib/python2.7/site-packages/pandas/conftest.pyt   axisV   s    c         C   s   d j  |   S(   Ns	   axis {!r}(   R;   (   R<   (    (    s.   lib/python2.7/site-packages/pandas/conftest.pyR=   b   s    c         C   s   |  j  S(   s?   
     Fixture for returning the axis numbers of a Series.
     (   R5   (   R6   (    (    s.   lib/python2.7/site-packages/pandas/conftest.pyt   axis_seriesb   s    c          C   s*   t  j d d d d d l m }  |    S(   sj   
    Get an instance of IPython.InteractiveShell.

    Will raise a skip if IPython is not installed.
    t   IPythont
   minversions   6.0.0i(   t   InteractiveShell(   R   t   importorskipt   IPython.core.interactiveshellRB   (   RB   (    (    s.   lib/python2.7/site-packages/pandas/conftest.pyt   ipj   s    c         C   s   |  j  S(   sz   pass in the observed keyword to groupby for [True, False]
    This indicates whether categoricals should return values for
    values which are not in the grouper [False / None], or only values which
    appear in the grouper [True]. [None] is supported for future compatiblity
    if we decide to change the default (and would need to warn if this
    parameter is not passed)(   R5   (   R6   (    (    s.   lib/python2.7/site-packages/pandas/conftest.pyt   observedw   s    t   __add__t   __radd__t   __sub__t   __rsub__t   __mul__t   __rmul__t   __floordiv__t   __rfloordiv__t   __truediv__t   __rtruediv__t   __pow__t   __rpow__t   __mod__t   __rmod__t   __div__t   __rdiv__c         C   s   |  j  S(   sC   
    Fixture for dunder names for common arithmetic operations
    (   R5   (   R6   (    (    s.   lib/python2.7/site-packages/pandas/conftest.pyt   all_arithmetic_operators   s    t   sumt   maxt   mint   meant   prodt   stdt   vart   mediant   kurtt   skewc         C   s   |  j  S(   s-   
    Fixture for numeric reduction names
    (   R5   (   R6   (    (    s.   lib/python2.7/site-packages/pandas/conftest.pyt   all_numeric_reductions   s    t   allt   anyc         C   s   |  j  S(   s-   
    Fixture for boolean reduction names
    (   R5   (   R6   (    (    s.   lib/python2.7/site-packages/pandas/conftest.pyt   all_boolean_reductions   s    c         C   s   |  j  S(   N(   R5   (   R6   (    (    s.   lib/python2.7/site-packages/pandas/conftest.pyt   cython_table_items   s    c         C   so   g  } xb | D]Z \ } } | j  |  | | f  | g  t D]' \ } } | | k r9 |  | | f ^ q9 7} q W| S(   s  combine frame, functions from SelectionMixin._cython_table
    keys and expected result.

    Parameters
    ----------
    ndframe : DataFrame or Series
    func_names_and_expected : Sequence of two items
        The first item is a name of a NDFrame method ('sum', 'prod') etc.
        The second item is the expected return value

    Returns
    -------
    results : list
        List of three items (DataFrame, function, expected result)
    (   t   appendt   _cython_table(   t   ndframet   func_names_and_expectedt   resultst	   func_namet   expectedt   funct   name(    (    s.   lib/python2.7/site-packages/pandas/conftest.pyt   _get_cython_table_params   s    &t   __eq__t   __ne__t   __le__t   __lt__t   __ge__t   __gt__c         C   s   |  j  S(   su   
    Fixture for dunder names for common compare operations

    * >=
    * >
    * ==
    * !=
    * <
    * <=
    (   R5   (   R6   (    (    s.   lib/python2.7/site-packages/pandas/conftest.pyt   all_compare_operators   s    t   gzipt   bz2t   zipt   xzt   marksc         C   s   |  j  S(   sJ   
    Fixture for trying common compression types in compression tests
    (   R5   (   R6   (    (    s.   lib/python2.7/site-packages/pandas/conftest.pyt   compression   s    c         C   s   |  j  S(   sj   
    Fixture for trying common compression types in compression tests excluding
    uncompressed case
    (   R5   (   R6   (    (    s.   lib/python2.7/site-packages/pandas/conftest.pyt   compression_only   s    c         C   s   |  j  S(   s+   
    Fixture that an array is writable
    (   R5   (   R6   (    (    s.   lib/python2.7/site-packages/pandas/conftest.pyt   writable   s    t   scopet   modulec          C   s   d d l  m }  |  j S(   Ni(   t   timezone(   t   datetimeR   R   (   R   (    (    s.   lib/python2.7/site-packages/pandas/conftest.pyt   datetime_tz_utc   s    R   s   dateutil/UTC(   R   c         C   s   |  j  S(   sP   
    Fixture to provide variants of UTC timezone strings and tzinfo objects
    (   R5   (   R6   (    (    s.   lib/python2.7/site-packages/pandas/conftest.pyt   utc_fixture  s    t   innert   outert   leftt   rightc         C   s   |  j  S(   s9   
    Fixture for trying all types of join operations
    (   R5   (   R6   (    (    s.   lib/python2.7/site-packages/pandas/conftest.pyt	   join_type  s    c         C   s   |  j  d  S(   Ns   --strict-data-files(   R   (   t   pytestconfig(    (    s.   lib/python2.7/site-packages/pandas/conftest.pyt   strict_data_files  s    c            s7   t  j j t  j j t  d       f d   } | S(   s?  Get the path to a data file.

    Parameters
    ----------
    path : str
        Path to the file, relative to ``pandas/tests/``

    Returns
    -------
    path : path including ``pandas/tests``.

    Raises
    ------
    ValueError
        If the path doesn't exist and the --strict-data-files option is set.
    t   testsc             sn   t  j j   |   } t  j j |  sj  rK d } t | j |    qj d } t j | j |   n  | S(   Ns6   Could not find file {} and --strict-data-files is set.s   Could not find {}.(   t   ost   patht   joint   existst
   ValueErrorR;   R   R   (   t   argsR   t   msg(   t	   BASE_PATHR   (    s.   lib/python2.7/site-packages/pandas/conftest.pyt   deco-  s    (   R   R   R   t   dirnamet   __file__(   R   R   (    (   R   R   s.   lib/python2.7/site-packages/pandas/conftest.pyt   datapath  s    !
c         C   s   t  j |  d d   S(   s    The iris dataset as a DataFrame.t   datas   iris.csv(   R#   t   read_csv(   R   (    (    s.   lib/python2.7/site-packages/pandas/conftest.pyt   iris:  s    t   nlargestt	   nsmallestc         C   s   |  j  S(   s0   
    Fixture for trying all nselect methods
    (   R5   (   R6   (    (    s.   lib/python2.7/site-packages/pandas/conftest.pyt   nselect_method@  s    t   botht   neitherc         C   s   |  j  S(   s;   
    Fixture for trying all interval closed parameters
    (   R5   (   R6   (    (    s.   lib/python2.7/site-packages/pandas/conftest.pyt   closedH  s    c         C   s   |  j  S(   sR   
    Secondary closed fixture to allow parametrizing over all pairs of closed
    (   R5   (   R6   (    (    s.   lib/python2.7/site-packages/pandas/conftest.pyt   other_closedP  s    t   nant   NaNc         C   s   |  j  S(   s.   
    Fixture for each null type in pandas
    (   R5   (   R6   (    (    s.   lib/python2.7/site-packages/pandas/conftest.pyt   nulls_fixtureX  s    c         C   s   |  j  S(   sK   
    Fixture for each null type in pandas, each null type exactly once
    (   R5   (   R6   (    (    s.   lib/python2.7/site-packages/pandas/conftest.pyt   unique_nulls_fixturec  s    t   UTCs
   US/Easterns
   Asia/Tokyos   dateutil/US/Pacifics   dateutil/Asia/Singaporei,  ic         C   s   |  j  S(   sD   
    Fixture for trying timezones including default (None): {0}
    (   R5   (   R6   (    (    s.   lib/python2.7/site-packages/pandas/conftest.pyt   tz_naive_fixturet  s    c         C   s   |  j  S(   s4   
    Fixture for trying explicit timezones: {0}
    (   R5   (   R6   (    (    s.   lib/python2.7/site-packages/pandas/conftest.pyt   tz_aware_fixture}  s    t   uint8t   uint16t   uint32t   uint64t   UInt8t   UInt16t   UInt32t   UInt64t   int8t   int16t   int32t   int64t   Int8t   Int16t   Int32t   Int64t   float32t   float64t	   complex64t
   complex128t   strt   Us   datetime64[ns]s   M8[ns]s   timedelta64[ns]s   m8[ns]t   boolt   bytest   objectc         C   s   |  j  S(   sM   Parametrized fixture for string dtypes.

    * str
    * 'str'
    * 'U'
    (   R5   (   R6   (    (    s.   lib/python2.7/site-packages/pandas/conftest.pyt   string_dtype  s    c         C   s   |  j  S(   s^   
    Parameterized fixture for float dtypes.

    * float
    * 'float32'
    * 'float64'
    (   R5   (   R6   (    (    s.   lib/python2.7/site-packages/pandas/conftest.pyt   float_dtype  s    
c         C   s   |  j  S(   sg   
    Parameterized fixture for complex dtypes.

    * complex
    * 'complex64'
    * 'complex128'
    (   R5   (   R6   (    (    s.   lib/python2.7/site-packages/pandas/conftest.pyt   complex_dtype  s    
c         C   s   |  j  S(   s|   
    Parameterized fixture for signed integer dtypes.

    * int
    * 'int8'
    * 'int16'
    * 'int32'
    * 'int64'
    (   R5   (   R6   (    (    s.   lib/python2.7/site-packages/pandas/conftest.pyt
   sint_dtype  s    c         C   s   |  j  S(   sx   
    Parameterized fixture for unsigned integer dtypes.

    * 'uint8'
    * 'uint16'
    * 'uint32'
    * 'uint64'
    (   R5   (   R6   (    (    s.   lib/python2.7/site-packages/pandas/conftest.pyt
   uint_dtype  s    c         C   s   |  j  S(   s   
    Parameterized fixture for any integer dtype.

    * int
    * 'int8'
    * 'uint8'
    * 'int16'
    * 'uint16'
    * 'int32'
    * 'uint32'
    * 'int64'
    * 'uint64'
    (   R5   (   R6   (    (    s.   lib/python2.7/site-packages/pandas/conftest.pyt   any_int_dtype  s    c         C   s   |  j  S(   s   
    Parameterized fixture for any (purely) real numeric dtype.

    * int
    * 'int8'
    * 'uint8'
    * 'int16'
    * 'uint16'
    * 'int32'
    * 'uint32'
    * 'int64'
    * 'uint64'
    * float
    * 'float32'
    * 'float64'
    (   R5   (   R6   (    (    s.   lib/python2.7/site-packages/pandas/conftest.pyt   any_real_dtype  s    c         C   s   |  j  S(   s  
    Parameterized fixture for all numpy dtypes.

    * bool
    * 'bool'
    * int
    * 'int8'
    * 'uint8'
    * 'int16'
    * 'uint16'
    * 'int32'
    * 'uint32'
    * 'int64'
    * 'uint64'
    * float
    * 'float32'
    * 'float64'
    * complex
    * 'complex64'
    * 'complex128'
    * str
    * 'str'
    * 'U'
    * bytes
    * 'bytes'
    * 'datetime64[ns]'
    * 'M8[ns]'
    * 'timedelta64[ns]'
    * 'm8[ns]'
    * object
    * 'object'
    (   R5   (   R6   (    (    s.   lib/python2.7/site-packages/pandas/conftest.pyt   any_numpy_dtype  s    #t   stringt   at   ct   unicodet   emptys   mixed-integeri   t   mixedg       @t   floatingg      ?t   integers   mixed-integer-floatt   decimalt   booleant
   datetime64s
   2013-01-01s
   2018-01-01R   t   20130101t   20180101R    i  i  R   R   t   periodt   intervalc         C   s.   |  j  \ } } t j | d t } | | f S(   s  
    Fixture for all inferred dtypes from _libs.lib.infer_dtype

    The covered (inferred) types are:
    * 'string'
    * 'unicode' (if PY2)
    * 'empty'
    * 'bytes' (if PY3)
    * 'mixed'
    * 'mixed-integer'
    * 'mixed-integer-float'
    * 'floating'
    * 'integer'
    * 'decimal'
    * 'boolean'
    * 'datetime64'
    * 'datetime'
    * 'date'
    * 'timedelta'
    * 'time'
    * 'period'
    * 'interval'

    Returns
    -------
    inferred_dtype : str
        The string for the inferred dtype from _libs.lib.infer_dtype
    values : np.ndarray
        An array of object dtype that will be inferred to have
        `inferred_dtype`

    Examples
    --------
    >>> import pandas._libs.lib as lib
    >>>
    >>> def test_something(any_skipna_inferred_dtype):
    ...     inferred_dtype, values = any_skipna_inferred_dtype
    ...     # will pass
    ...     assert lib.infer_dtype(values, skipna=True) == inferred_dtype
    t   dtype(   R5   R&   t   arrayR   (   R6   t   inferred_dtypet   values(    (    s.   lib/python2.7/site-packages/pandas/conftest.pyt   any_skipna_inferred_dtypeN  s    *c         C   s   |  j  S(   sN   
    Fixture for Tick based datetime offsets available for a time series.
    (   R5   (   R6   (    (    s.   lib/python2.7/site-packages/pandas/conftest.pyt   tick_classes  s    s)   MonthBegin MonthEnd BMonthBegin BMonthEndt   niic   t	   normalizes%   YearBegin YearEnd BYearBegin BYearEndii   t   montht	   min_valuet	   max_valuei   s1   QuarterBegin QuarterEnd BQuarterBegin BQuarterEndii   t   startingMonth(   R   R    R   R   R   R   R   t   dateutil.tzR   R   t
   hypothesisR   t   stt   numpyR&   R   t   pytzR   R   t   pandas.compatR	   R
   t   pandas.util._test_decoratorst   utilt   _test_decoratorst   tdt   pandasR#   t   settingst   register_profilet	   unlimitedt   HealthCheckt   too_slowt   load_profileR   R   t   fixturet   TrueR%   R(   R7   R>   t
   axis_frameR?   RE   t   Falset   NoneRF   t   _all_arithmetic_operatorst   extendRW   t   _all_numeric_reductionsRb   t   _all_boolean_reductionsRe   t   coret   baset   SelectionMixinRh   t   itemst   listRf   Rp   Rw   R5   t   skip_if_no_lzmaR}   R~   R   R   t   utc_objsR   Rg   R   R   R   R   R   R   R   R   R   t   NaTt   floatR   t   nulls_fixture2R   t   unique_nulls_fixture2t	   TIMEZONESt   parametrize_fixture_docR   R   R   t   UNSIGNED_INT_DTYPESt   UNSIGNED_EA_INT_DTYPESt   intt   SIGNED_INT_DTYPESt   SIGNED_EA_INT_DTYPESt   ALL_INT_DTYPESt   ALL_EA_INT_DTYPESt   FLOAT_DTYPESt   complext   COMPLEX_DTYPESt   STRING_DTYPESt   DATETIME_DTYPESt   TIMEDELTA_DTYPESR   t   BOOL_DTYPESR   t   BYTES_DTYPESR   t   OBJECT_DTYPESt   ALL_REAL_DTYPESt   ALL_NUMPY_DTYPESR   R   R   R   R   R   R   R   R   t	   Timestampt   Periodt   Intervalt   _any_skipna_inferred_dtypeRz   R:   t   _R   t   offsetst   __all__t   ot
   issubclassR4   t   TickR   t   splitRo   t   tseriest   clst   register_type_strategyt   buildst   integerst   booleans(    (    (    s.   lib/python2.7/site-packages/pandas/conftest.pyt   <module>   s$  				0*$	!	''	!'!!''?*	"



&(-!	!'-!!'3!1E 