/usr/local/lib/python3.6/site-packages/pyparsing/__pycache__
Edit: /usr/local/lib/python3.6/site-packages/pyparsing/__pycache__/actions.cpython-36.pyc (7138B)
3
Eg @ s d dl mZ d dlmZmZ G dd dZdd Zdd Zd d
Zdd Z e
e _dddZedeZ
edeZede ZedeZedeZdS ) )ParseException)colreplaced_by_pep8c @ s( e Zd ZdZdd Zdd Zdd ZdS ) OnlyOncezI
Wrapper for parse actions, to ensure they are only called once.
c C s ddl m} ||| _d| _d S )Nr )_trim_arityF)corer callablecalled)selfZmethod_callr r ;/usr/local/lib/python3.6/site-packages/pyparsing/actions.py__init__ s
zOnlyOnce.__init__c C s. | j s| j|||}d| _ |S t||dd S )NTz.OnlyOnce obj called multiple times w/out reset)r r r )r
sltresultsr r r __call__ s
zOnlyOnce.__call__c C s
d| _ dS )zK
Allow the associated parse action to be called once more.
FN)r )r
r r r reset s zOnlyOnce.resetN)__name__
__module____qualname____doc__r
r r r r r r r s r c s fdd}|S )zt
Helper method for defining parse actions that require matching at
a specific column in the input text.
c s$ t || kr t| |d d S )Nzmatched token not at column )r r )strglocntoks)nr r
verify_col' s z%match_only_at_col.
.verify_colr )r r r )r r match_only_at_col! s r c s fddS )a
Helper method for common parse actions that simply return
a literal value. Especially useful when used with
:class:`transform_string` ().
Example::
num = Word(nums).set_parse_action(lambda toks: int(toks[0]))
na = one_of("N/A NA").set_parse_action(replace_with(math.nan))
term = na | num
term[1, ...].parse_string("324 234 N/A 234") # -> [324, 234, nan, 234]
c s gS )Nr )r r r )repl_strr r <