ó
çiõ\c           @   sˆ   d  Z  d d l Z d d l Z d d l m Z e j d e f d „  ƒ  Yƒ Z d e f d „  ƒ  YZ d d	 d
 g Z	 d „  Z
 d „  Z d S(   sS   
this is a place where we put datastructures used by legacy apis
we hope ot remove
iÿÿÿÿN(   t
   UsageErrort   MarkMappingc           B   s2   e  Z d  Z e j ƒ  Z e d „  ƒ Z d „  Z RS(   sf   Provides a local mapping for markers where item access
    resolves to True if the marker is present. c         C   s    d „  | j  ƒ  Dƒ } |  | ƒ S(   Nc         S   s   h  |  ] } | j  ’ q S(    (   t   name(   t   .0t   mark(    (    s2   lib/python2.7/site-packages/_pytest/mark/legacy.pys	   <setcomp>   s   	 (   t   iter_markers(   t   clst   itemt
   mark_names(    (    s2   lib/python2.7/site-packages/_pytest/mark/legacy.pyt	   from_item   s    c         C   s   | |  j  k S(   N(   t   own_mark_names(   t   selfR   (    (    s2   lib/python2.7/site-packages/_pytest/mark/legacy.pyt   __getitem__   s    (	   t   __name__t
   __module__t   __doc__t   attrt   ibR
   t   classmethodR	   R   (    (    (    s2   lib/python2.7/site-packages/_pytest/mark/legacy.pyR      s   t   KeywordMappingc           B   s/   e  Z d  Z d „  Z e d „  ƒ Z d „  Z RS(   sw   Provides a local mapping for keywords.
    Given a list of names, map any substring of one of these names to True.
    c         C   s   | |  _  d  S(   N(   t   _names(   R   t   names(    (    s2   lib/python2.7/site-packages/_pytest/mark/legacy.pyt   __init__"   s    c         C   s°   t  ƒ  } d d  l } x9 | j ƒ  D]+ } t | | j ƒ s" | j | j ƒ q" q" W| j | j ƒ  ƒ t	 | d ƒ r‰ | j | j
 j ƒ n  | j d „  | j ƒ  Dƒ ƒ |  | ƒ S(   Niÿÿÿÿt   functionc         s   s   |  ] } | j  Vq d  S(   N(   R   (   R   R   (    (    s2   lib/python2.7/site-packages/_pytest/mark/legacy.pys	   <genexpr>8   s    (   t   sett   pytestt	   listchaint
   isinstancet   Instancet   addR   t   updatet   listextrakeywordst   hasattrR   t   __dict__R   (   R   R   t   mapped_namesR   (    (    s2   lib/python2.7/site-packages/_pytest/mark/legacy.pyR	   %   s    	c         C   s(   x! |  j  D] } | | k r
 t Sq
 Wt S(   N(   R   t   Truet   False(   R   t   subnameR   (    (    s2   lib/python2.7/site-packages/_pytest/mark/legacy.pyR   <   s    (   R   R   R   R   R   R	   R   (    (    (    s2   lib/python2.7/site-packages/_pytest/mark/legacy.pyR      s   	t   ort   andt   notc         C   sM   y t  | i  t j |  ƒ ƒ SWn) t k
 rH } t t | ƒ d ƒ ‚ n Xd S(   sB   Tries to match on any marker names, attached to the given colitem.s(   
Marker expression must be valid Python!N(   t   evalR   R	   t   SyntaxErrort   str(   t   colitemt   markexprt   e(    (    s2   lib/python2.7/site-packages/_pytest/mark/legacy.pyt	   matchmarkF   s    c         C   sÚ   t  j |  ƒ } d | k r# | | S| j d ƒ rO d | d k rO | | d SxG | j ƒ  D]9 } t j | ƒ r\ | t k r\ t d j | ƒ ƒ ‚ q\ q\ Wy t	 | i  | ƒ SWn& t
 k
 rÕ t d j | ƒ ƒ ‚ n Xd S(   s|  Tries to match given keyword expression to given collector item.

    Will match on the name of colitem, including the names of its parents.
    Only matches names of items which are either a :class:`Class` or a
    :class:`Function`.
    Additionally, matches on names in the 'extra_keyword_matches' set of
    any item, as well as names directly assigned to test functions.
    t    s   not i   s>   Python keyword '{}' not accepted in expressions passed to '-k's#   Wrong expression passed to '-k': {}N(   R   R	   t
   startswitht   splitt   keywordt	   iskeywordt   python_keywords_allowed_listR    t   formatR)   R*   (   R,   t   keywordexprt   mappingt   kwd(    (    s2   lib/python2.7/site-packages/_pytest/mark/legacy.pyt   matchkeywordN   s    	(   R   R3   R   t   _pytest.configR    t   st   objectR   R   R5   R/   R:   (    (    (    s2   lib/python2.7/site-packages/_pytest/mark/legacy.pyt   <module>   s   	&	