Repository URL to install this package:
|
Version:
1.0.11 ▾
|
wlanpi-profiler
/
opt
/
wlanpi-profiler
/
lib
/
python3.7
/
site-packages
/
pyparsing
/
__pycache__
/
actions.cpython-37.pyc
|
|---|
B
fúvKãÏã @ sp d dl mZ d dlmZ G dd dZdd Zdd Zd d
Zdd Ze e_
dddZeZeZ
eZeZeZdS )é )ÚParseException)Úcolc @ 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 ÚcallableÚcalled)ÚselfZmethod_callr © r
ú/build/wlanpi-profiler-7IIg1Q/wlanpi-profiler-1.0.11/debian/wlanpi-profiler/opt/wlanpi-profiler/lib/python3.7/site-packages/pyparsing/actions.pyÚ__init__ s
zOnlyOnce.__init__c C s. | j s| |||¡}d| _ |S t||dd S )NTz.OnlyOnce obj called multiple times w/out reset)r r r )r ÚsÚlÚtÚresultsr
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 Úformat)ÚstrgÚlocnÚtoks)Únr
r Ú
verify_col' s z%match_only_at_col.<locals>.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<ParserElement.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
OneOrMore(term).parse_string("324 234 N/A 234") # -> [324, 234, nan, 234]
c s gS )Nr
)r
r r )Úrepl_strr
r Ú<lambda><