HEX
Server: Apache
System: Linux infong-uk86 4.4.400-icpu-106 #2 SMP Mon Sep 15 08:23:40 UTC 2025 x86_64
User: u44115835 (4976590)
PHP: 8.4.17
Disabled: NONE
Upload Files
File: //kunden/lib/python3/dist-packages/breezy/__pycache__/lazy_regex.cpython-39.pyc
a

�*�^��@sRdZddlmZddlZddlmZGdd�dej�ZGdd	�d	e�Z	d
d�Z
dS)a:Lazily compiled regex objects.

This module defines a class which creates proxy objects for regex
compilation.  This allows overriding re.compile() to return lazily compiled
objects.

We do this rather than just providing a new interface so that it will also
be used by existing Python modules that create regexs.
�)�absolute_importN�)�errorsc@seZdZdZdd�ZdS)�InvalidPatternz!Invalid pattern(s) found. %(msg)scCs
||_dS)N)�msg)�selfr�r�3/usr/lib/python3/dist-packages/breezy/lazy_regex.py�__init__&szInvalidPattern.__init__N)�__name__�
__module__�__qualname__Z_fmtr
rrrr	r"src@sTeZdZdZgd�Zgd�eZdd�Zdd�Zdd	�Zd
d�Z	dd
�Z
dd�ZdS)�	LazyRegexzDA proxy around a real regex, which won't be compiled until accessed.)
�__copy__�__deepcopy__�findall�finditer�match�scanner�search�split�sub�subn��_real_regex�_regex_args�
_regex_kwargscCsd|_||_||_dS)z�Create a new proxy object, passing in the args to pass to re.compile

        :param args: The `*args` to pass to re.compile
        :param kwargs: The `**kwargs` to pass to re.compile
        Nr)r�args�kwargsrrr	r
9szLazyRegex.__init__cCs:|j|ji|j��|_|jD]}t||t|j|��qdS)z$Actually compile the requested regexN)�_real_re_compilerrr�_regex_attributes_to_copy�setattr�getattr�r�attrrrr	�_compile_and_collapseCs

�
zLazyRegex._compile_and_collapsec
OsZztj|i|��WStjyT}z(td|ddt|���WYd}~n
d}~00dS)z%Thunk over to the original re.compile�"rz" N)�re�compile�errorr�str)rrr�errr	rJszLazyRegex._real_re_compilecCs|j|jd�S)z&Return the state to use when pickling.�rr)rr)rrrr	�__getstate__Ss�zLazyRegex.__getstate__cCs*d|_t|d|d�t|d|d�dS)zRestore from a pickled state.Nrrrr)rr!)r�dictrrr	�__setstate__ZszLazyRegex.__setstate__cCs|jdur|��t|j|�S)zrReturn a member from the proxied regex object.

        If the regex hasn't been compiled yet, compile it
        N)rr%r"r#rrr	�__getattr__`s
zLazyRegex.__getattr__N)rrr
�__doc__r �	__slots__r
r%rr-r/r0rrrr	r*s�
	rcOs
t||�S)zjCreate a proxy object which will compile the regex on demand.

    :return: a LazyRegex proxy object.
    )rr,rrr	�lazy_compilelsr3)r1Z
__future__rr'�rZBzrErrorr�objectrr3rrrr	�<module>s
B