관리-도구
편집 파일: pyparsing.cpython-37.pyc
B ��Re�+ � t @ s d Z dZdZdZddlZddlmZ ddlZddl Z ddl Z ddlZddlZddl Z ddlZddlZddlZddlmZ ddlmZ ddlZdd lmZ dd lmZ yddlmZ W n ek r� ddlmZ Y nX ydd lmZ W n" ek �r dd lmZ Y nX y ddlm Z ddlm!Z!m"Z" W n2 ek �r\ ddl m Z ddl m!Z!m"Z" Y nX yddl m#Z$ W nB ek �r� yddl%m#Z$ W n ek �r� dZ$Y nX Y nX yddlm&Z& W n$ ek �r� G dd� d�Z&Y nX e&� Z'de'_ de'_(e&� Z)de)_ de)_*de)_+de)_,de)_-de)_.dd� e/e)�D �e)_0dd� Z1e1e)_2ddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDdEdFdGdHdIdJdKdLdMdNdOdPdQdRdSdTdUdVdWdXdYdZd[d\d]d^d_d`dadbdcdddedfdgdhdidjdkdldmdndodpdqdrdsdtdudvdwdxdydzd{d|d}d~dd�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�gtZ3e4e j5�dd�� Z6e6d d�kZ7e7�r�e j8Z9e:Z;e<Z=e:Z>e:Z?e@eAeBeCeDe4eEeFeGeHeIgZJnbe jKZ9eLZMd�d�� Z?g ZJddlNZNxBd��O� D ]6ZPyeJ�QeReNeP�� W n eSk �r� �w�Y nX �q�W eTd�d�� eMd��D ��ZUd�d�� ZVejWejX ZYd�ZZeZd� Z[eYeZ Z\e<d��Z]d��^d�d�� ej_D ��Z`�dad�d��ZaG d�d9� d9eb�ZcG d�d;� d;ec�ZdG d�d=� d=ec�ZeG d�d?� d?ee�ZfG d�dB� dBeb�ZgG d�d�� d�eh�ZiG d�d>� d>eh�Zje!�kej� d�dV� Zld�dg� Zmd�dd� Znd�d�� Zod�d�� Zpd�d�� Zqd�dn� Zr�dbd�d��ZsG d�d@� d@eh�ZtG d�d�� d�et�ZuG d�dH� dHet�ZvG d�d(� d(ev�ZwG d�d3� d3ev�ZxG d�d0� d0ev�ZyG d�d�� d�ey�ZzeyZ{eyet_|G d�d-� d-ev�Z}G d�d#� d#ey�Z~G d�d"� d"e}�ZG d�d�� d�ev�Z�G d�dK� dKev�Z�G d�dÄ d�e��Z�G d�dO� dOe��Z�G d�dC� dCev�Z�G d�dA� dAev�Z�G d�d$� d$ev�Z�G d�dJ� dJev�Z�G d�dʄ d�ev�Z�G d�d+� d+e��Z�G d�d/� d/e��Z�G d�d.� d.e��Z�G d�dF� dFe��Z�G d�dE� dEe��Z�G d�dM� dMe��Z�G d�dL� dLe��Z�G d�d<� d<et�Z�G d�d!� d!e��Z�G d�d8� d8e��Z�G d�d2� d2e��Z�G d�d'� d'e��Z�G d�d:� d:et�Z�G d�d)� d)e��Z�G d�d1� d1e��Z�G d�d4� d4e��Z�G d�d܄ d�e��Z�G d�d5� d5e��Z�G d�dN� dNe��Z�G d�d� d�eh�Z�G d�d7� d7e��Z�G d�dD� dDe��Z�G d�d*� d*e��Z�G d�dI� dIe��Z�G d�d%� d%e��Z�G d�d,� d,e��Z�G d�d&� d&e��Z�G d�dG� dGe��Z�G d�d6� d6eh�Z�d�d� Z��dcd�d]�Z��ddd�dY�Z�d�d� Z�d�dl� Z�d�dk� Z�d�d� Z��ded�dp�Z�d�d^� Z��dfd�d��Z�d�d�� Z�d�d�� Z�ew� ��d`�Z�e�� ��df�Z�e�� ��de�Z�e�� ��d~�Z�e�� ��d}�Z�e�e]d�d�d����d�d�� �Z�e�d����d�d�� �Z�e�d�����d d�� �Z�e�e�B e�B e��dd�d��B Z�e�e�e��d� e� �Z�ey�d�e��d����d� e�e�e�e�B �����d� �d Z��dd|� Z��d dj� Z��d dy� Zddw� ZÐdd�� Z�eĐd d�� �Z�eĐdd�� �Z�e��d�e��d�f�d�d�Zǐddh� ZȐddi� Zɐdd�� Z�eh� e�_ːdg�dd��Z�e&� Z�eh� e�_�eh� e�_�e��d�e��d�f�dd��Z�e�Z�e�e��d��d ����d�Z�e�e��d��d ����d�Z�e�e��d��d e��d��d B ����d �Z�e�e{�d!�eԠ� ����d"�ZՐd�ddeԠ� f�d#dm�Zdh�d$d��Z�e��d%�Z�e��d&�Z�e�e�eYe\�d' ����d(��\Z�Z�e�eݐd)�O� �d*��Z�e��d+�d,�^eޠߡ � �d- ����d.�Z�d/dx� Z�e�e��d0��d1 ����d2�Z�e��d3����d4�Z�e��d5��� ���d6�Z�e��d7����d8�Z�e�e��d0��d1 e�B ����d9�Z�e�Z�e��d:����d;�Z�e�e�e�e`d�d<�e�e��d=�eyd� e�� � ���� ���d>�Z�e�e�eԠ� e�B d��d?����dW�Z�G �d@d�� d��Z�G �dA�dB� �dBeh�Z�G �dCd�� d�eh�Z�G �dDd�� d�e�Z�e�j�j�j�e�j�j�j� e�j�j�j� e�j�_�e7� r�e�e�dEe�j�� e�e�dFe�j�� e�e�dGe�j�� e�e�dHe�j�� e�e�dIe�j�� e�e�dJe�j� e�e�j�dKe�j�j� e�e�j�dLe�j�j�� e�e�j�dMe�j�j� e�e�dNe�j�� e�e�dOe�j�� e�e�dPe�j�� G �dQ�dR� �dR�Z��e �dSk�re~�dT��Ze~�dU��Ze�eYe\�dV ��Ze��e�dWd�dX���eš�Ze�e��e�����dY��Z�dZ�eB �Ze��e�dWd�dX���eš�Ze�e��e�����d[��Z�e�d\��e�dY� �e �e�d[� �Z �e �� �d]� e�j�� �d^� e�j�� �d^� e�j �� �d_� dd�l�Ze�j��eĐe�j�� e�j�� �d`� dS (i a� pyparsing module - Classes and methods to define and execute parsing grammars ============================================================================= The pyparsing module is an alternative approach to creating and executing simple grammars, vs. the traditional lex/yacc approach, or the use of regular expressions. With pyparsing, you don't need to learn a new syntax for defining grammars or matching expressions - the parsing module provides a library of classes that you use to construct the grammar directly in Python. Here is a program to parse "Hello, World!" (or any greeting of the form ``"<salutation>, <addressee>!"``), built up using :class:`Word`, :class:`Literal`, and :class:`And` elements (the :class:`'+'<ParserElement.__add__>` operators create :class:`And` expressions, and the strings are auto-converted to :class:`Literal` expressions):: from pip._vendor.pyparsing import Word, alphas # define grammar of a greeting greet = Word(alphas) + "," + Word(alphas) + "!" hello = "Hello, World!" print (hello, "->", greet.parseString(hello)) The program outputs the following:: Hello, World! -> ['Hello', ',', 'World', '!'] The Python representation of the grammar is quite readable, owing to the self-explanatory class names, and the use of '+', '|' and '^' operators. The :class:`ParseResults` object returned from :class:`ParserElement.parseString` can be accessed as a nested list, a dictionary, or an object with named attributes. The pyparsing module handles some of the problems that are typically vexing when writing text parsers: - extra or missing whitespace (the above program will also handle "Hello,World!", "Hello , World !", etc.) - quoted strings - embedded comments Getting Started - ----------------- Visit the classes :class:`ParserElement` and :class:`ParseResults` to see the base classes that most other pyparsing classes inherit from. Use the docstrings for examples of how to: - construct literal match expressions from :class:`Literal` and :class:`CaselessLiteral` classes - construct character word-group expressions using the :class:`Word` class - see how to create repetitive expressions using :class:`ZeroOrMore` and :class:`OneOrMore` classes - use :class:`'+'<And>`, :class:`'|'<MatchFirst>`, :class:`'^'<Or>`, and :class:`'&'<Each>` operators to combine simple expressions into more complex ones - associate names with your parsed results using :class:`ParserElement.setResultsName` - access the parsed data, which is returned as a :class:`ParseResults` object - find some helpful expression short-cuts like :class:`delimitedList` and :class:`oneOf` - find more useful common expressions in the :class:`pyparsing_common` namespace class z2.4.7z30 Mar 2020 00:43 UTCz*Paul McGuire <ptmcg@users.sourceforge.net>� N)�ref)�datetime)� itemgetter)�wraps)�contextmanager)�filterfalse)�ifilterfalse)�RLock)�Iterable)�MutableMapping�Mapping)�OrderedDict)�SimpleNamespacec @ s e Zd ZdS )r N)�__name__� __module__�__qualname__� r r ��/builddir/build/BUILDROOT/alt-python37-pip-20.2.4-6.el8.x86_64/opt/alt/python37/lib/python3.7/site-packages/pip/_vendor/pyparsing.pyr � s r aA A cross-version compatibility configuration for pyparsing features that will be released in a future version. By setting values in this configuration to True, those features can be enabled in prior versions for compatibility development and testing. - collect_all_And_tokens - flag to enable fix for Issue #63 that fixes erroneous grouping of results names when an And expression is nested within an Or or MatchFirst; set to True to enable bugfix released in pyparsing 2.3.0, or False to preserve pre-2.3.0 handling of named results Ta� Diagnostic configuration (all default to False) - warn_multiple_tokens_in_named_alternation - flag to enable warnings when a results name is defined on a MatchFirst or Or expression with one or more And subexpressions (only warns if __compat__.collect_all_And_tokens is False) - warn_ungrouped_named_tokens_in_collection - flag to enable warnings when a results name is defined on a containing expression with ungrouped subexpressions that also have results names - warn_name_set_on_empty_Forward - flag to enable warnings whan a Forward is defined with a results name, but has no contents defined - warn_on_multiple_string_args_to_oneof - flag to enable warnings whan oneOf is incorrectly called with multiple str arguments - enable_debug_on_named_expressions - flag to auto-enable debug on all subsequent calls to ParserElement.setName() Fc C s$ g | ]}|� d �s|� d�r|�qS )Zenable_Zwarn_)� startswith)�.0�nmr r r � <listcomp>� s r c C s dt _dt _dt _dt _d S )NT)�__diag__�)warn_multiple_tokens_in_named_alternation�)warn_ungrouped_named_tokens_in_collection�warn_name_set_on_empty_Forward�%warn_on_multiple_string_args_to_oneofr r r r �_enable_all_warnings� s r �__version__�__versionTime__� __author__� __compat__r �And�CaselessKeyword�CaselessLiteral� CharsNotIn�Combine�Dict�Each�Empty� FollowedBy�Forward� GoToColumn�Group�Keyword�LineEnd� LineStart�Literal� PrecededBy� MatchFirst�NoMatch�NotAny� OneOrMore�OnlyOnce�Optional�Or�ParseBaseException�ParseElementEnhance�ParseException�ParseExpression�ParseFatalException�ParseResults�ParseSyntaxException� ParserElement�QuotedString�RecursiveGrammarException�Regex�SkipTo� StringEnd�StringStart�Suppress�Token�TokenConverter�White�Word�WordEnd� WordStart� ZeroOrMore�Char� alphanums�alphas� alphas8bit�anyCloseTag� anyOpenTag� cStyleComment�col�commaSeparatedList�commonHTMLEntity�countedArray�cppStyleComment�dblQuotedString�dblSlashComment� delimitedList�dictOf�downcaseTokens�empty�hexnums�htmlComment�javaStyleComment�line�lineEnd� lineStart�lineno�makeHTMLTags�makeXMLTags�matchOnlyAtCol�matchPreviousExpr�matchPreviousLiteral� nestedExpr�nullDebugAction�nums�oneOf�opAssoc�operatorPrecedence� printables�punc8bit�pythonStyleComment�quotedString�removeQuotes�replaceHTMLEntity�replaceWith� restOfLine�sglQuotedString�srange� stringEnd�stringStart�traceParseAction� unicodeString�upcaseTokens� withAttribute� indentedBlock�originalTextFor�ungroup� infixNotation�locatedExpr� withClass� CloseMatch�tokenMap�pyparsing_common�pyparsing_unicode�unicode_set�conditionAsParseAction�re� c C s` t | t�r| S yt| �S tk rZ t| ��t�� d�}td�}|�dd� � |� |�S X dS )a Drop-in replacement for str(obj) that tries to be Unicode friendly. It first tries str(obj). If that fails with a UnicodeEncodeError, then it tries unicode(obj). It then < returns the unicode object | encodes it with the default encoding | ... >. �xmlcharrefreplacez&#\d+;c S s$ dt t| d dd� ��dd � S )Nz\ur � ���)�hex�int)�tr r r �<lambda>� � z_ustr.<locals>.<lambda>N) � isinstance�unicode�str�UnicodeEncodeError�encode�sys�getdefaultencodingrD �setParseAction�transformString)�obj�retZ xmlcharrefr r r �_ustr� s r� z6sum len sorted reversed list tuple set any all min maxc c s | ] }|V qd S )Nr )r �yr r r � <genexpr> s r� � c C s>