Current File : //lib/python3.6/site-packages/cssselect/__pycache__/xpath.cpython-36.opt-1.pyc |
3
ǁaW�a � @ s� d Z ddlZddlZddlmZmZmZ ejd dk r@eZ e
ZneZ eZddd�Z
G dd� dee�ZG d d
� d
e�Zejd�jZejd�jZejd
�jZG dd� de�ZG dd� de�ZdS )a
cssselect.xpath
===============
Translation of parsed CSS selectors to XPath expressions.
:copyright: (c) 2007-2012 Ian Bicking and contributors.
See AUTHORS for more details.
:license: BSD, see LICENSE for more details.
� N)�parse�parse_series�
SelectorError� c C s |j dd�jd�}t| ||�S )N�ascii�replace)�encode�decode�getattr)�obj�name�default� r �/usr/lib/python3.6/xpath.py�_unicode_safe_getattr s r c @ s e Zd ZdZdS )�ExpressionErrorz3Unknown or unsupported selector (eg. pseudo-class).N)�__name__�
__module__�__qualname__�__doc__r r r r r # s r c @ sF e Zd Zddd�Zdd� Zdd � Zd
d� Zdd
� Zdd� Zdd� Z dS )� XPathExpr� �*Fc C s || _ || _|| _d S )N)�path�element� condition)�selfr r r Zstar_prefixr r r �__init__+ s zXPathExpr.__init__c C s, t | j�t | j� }| jr(|d| j 7 }|S )Nz[%s])�_unicoder r r )r r r r r �__str__0 s zXPathExpr.__str__c C s d| j j| f S )Nz%s[%s])� __class__r )r r r r �__repr__6 s zXPathExpr.__repr__c C s"