✏️ 编辑:string.cpython-39.pyc
路径:
/usr/lib64/python3.9/__pycache__/string.cpython-39.pyc
大小:7 KB · 修改:2026-08-12 15:51:23 · 权限:0644 · 只读(保存会失败)
← 返回目录
👁 查看
⬇ 下载
检测到二进制内容,直接保存可能损坏文件。请改用「上传替换」。
a �iF) � @ s� d Z g d�ZddlZdZdZdZee ZdZed d Zd Z dZ ee e e Zddd �Zddl ZddlmZ i ZG dd� d�Ze�� G dd� d�ZdS )an A collection of string constants. Public module variables: whitespace -- a string containing all ASCII whitespace ascii_lowercase -- a string containing all ASCII lowercase letters ascii_uppercase -- a string containing all ASCII uppercase letters ascii_letters -- a string containing all ASCII letters digits -- a string containing all ASCII decimal digits hexdigits -- a string containing all ASCII hexadecimal digits octdigits -- a string containing all ASCII octal digits punctuation -- a string containing all ASCII punctuation characters printable -- a string containing all ASCII characters considered printable )� ascii_letters�ascii_lowercase�ascii_uppercase�capwords�digits� hexdigits� octdigits� printable�punctuation� whitespace� Formatter�Template� Nz �abcdefghijklmnopqrstuvwxyz�ABCDEFGHIJKLMNOPQRSTUVWXYZ� 0123456789ZabcdefZABCDEF�01234567z !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~c C s |pd� dd� | �|�D ��S )a� capwords(s [,sep]) -> string Split the argument into words using split, capitalize each word using capitalize, and join the capitalized words using join. If the optional second argument sep is absent or None, runs of whitespace characters are replaced by a single space and leading and trailing whitespace are removed, otherwise sep is used to split and join the words. � c s s | ]}|� � V qd S �N)� capitalize)�.0�x� r �/usr/lib64/python3.9/string.py� <genexpr>0 � zcapwords.<locals>.<genexpr>)�join�split)�s�sepr r r r % s r )�ChainMapc sZ e Zd ZdZdZdZdZejZ � fdd�Z dd� Zd d � Ze fdd�Ze fd d�Z� ZS )r z.A string class for supporting $-substitutions.�$z(?a:[_a-z][_a-z0-9]*)Nc sr t � �� d| jv r| j}n<t�| j�}| j}| jp8| j}d|� d|� d|� d|� d� }t� || j tjB �| _d S )N�patternz z(?: (?P<escaped>zC) | # Escape sequence of two delimiters (?P<named>zJ) | # delimiter and a Python identifier {(?P<braced>z�)} | # delimiter and a braced identifier (?P<invalid>) # Other ill-formed delimiter exprs ) )�super�__init_subclass__�__dict__r! �_re�escape� delimiter� idpattern�braceidpattern�compile�flags�VERBOSE)�clsr! �delim�id�bid�� __class__r r r# E s ����zTemplate.__init_subclass__c C s || _ d S r )�template)�selfr3 r r r �__init__W s zTemplate.__init__c C sd |� d�}| jd |� jdd�}|s.d}d}n"|td�|d d� �� }t|�}td||f ��d S )N�invalidT)�keepends� � ���z.Invalid placeholder in string: line %d, col %d)�startr3 � splitlines�lenr � ValueError)r4 �mo�i�lines�colno�linenor r r �_invalid\ s �zTemplate._invalidc s: � t u r|� n|rt|� �� � �fdd�}�j�|�j�S )Nc sd | � d�p| � d�}|d ur(t� | �S | � d�d ur<�jS | � d�d urT��| � td�j��d S �N�named�braced�escapedr6 z#Unrecognized named group in pattern)�group�strr'