Spamworldpro Mini Shell
Spamworldpro


Server : Apache/2.4.52 (Ubuntu)
System : Linux webserver 6.8.0-49-generic #49~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Nov 6 17:42:15 UTC 2 x86_64
User : www-data ( 33)
PHP Version : 8.1.2-1ubuntu2.21
Disable Function : NONE
Directory :  /lib/python3/dist-packages/debian/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/debian/__pycache__/copyright.cpython-310.pyc
o

���a�`�@s�dZddlZddlZddlZddlZddlZz&ddlmZmZm	Z	m
Z
mZmZm
Z
mZmZmZmZmZedZedZWneyGdZYnwddlmZdZeeg�Ze�e�ZGd	d
�d
e�ZGdd�de�Z Gd
d�dee!�Z"dd�Z#Gdd�de$�Z%dd�Z&Gdd�de$�Z'Gdd�de$�Z(dd�Z)dd�Z*dd�Z+dd �Z,Gd!d"�d"e�-d"d#��Z.d$d%�Z/Gd&d'�d'ej0�Z1Gd(d)�d)ej0�Z2Gd*d+�d+ej0�Z3dS),a9Utilities for parsing and creating machine-readable debian/copyright files.

The specification for the format (also known as DEP5) is available here:
https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/

Start from the Copyright docstring for usage information.

Copyright Classes
-----------------
�N)�Any�Callable�IO�Iterable�Iterator�List�Optional�Pattern�Text�Tuple�Union�
TYPE_CHECKING)�FilesParagraph�LicenseParagraph)�HeaderrrF)�deb822zBhttps://www.debian.org/doc/packaging-manuals/copyright-format/1.0/c@�eZdZdZdS)�Errorz)Base class for exceptions in this module.N��__name__�
__module__�__qualname__�__doc__�rr�2/usr/lib/python3/dist-packages/debian/copyright.pyrG�rc@r)�NotMachineReadableErrorzFRaised when the input is not a machine-readable debian/copyright file.NrrrrrrKrrc@r)�MachineReadableFormatErrorz�Raised when the input is not valid.

    This is both a `copyright.Error` and a `ValueError` to ease handling of
    errors coming from this module.
    NrrrrrrOrrcCs|rt|��t�|�dS�N)r�logger�warning)�msg�strictrrr�	_complainWsr#cs~eZdZdZd�fdd�	Zedd��Zejd	d��Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zddd�Z�ZS)�	Copyrighta�Represents a debian/copyright file.

    A Copyright object contains a Header paragraph and a list of additional
    Files or License paragraphs.  It provides methods to iterate over those
    paragraphs, in addition to adding new ones.  It also provides a mechanism
    for finding the Files paragraph (if any) that matches a particular
    filename.

    Typical usage::

        with io.open('debian/copyright', 'rt', encoding='utf-8') as f:
            c = copyright.Copyright(f)

            header = c.header
            # Header exposes standard fields, e.g.
            print('Upstream name: ', header.upstream_name)
            lic = header.license
            if lic:
                print('Overall license: ', lic.synopsis)
            # You can also retrieve and set custom fields.
            header['My-Special-Field'] = 'Very special'

            # Find the license for a given file.
            paragraph = c.find_files_paragraph('debian/rules')
            if paragraph:
                print('License for debian/rules: ', paragraph.license)

            # Dump the result, including changes, to another file.
            with io.open('debian/copyright.new', 'wt', encoding='utf-8') as f:
                c.dump(f=f)

    It is possible to build up a Copyright from scratch, by modifying the
    header and using add_files_paragraph and add_license_paragraph.  See the
    associated method docstrings.
    N�utf-8Tc	s�tt|���g|_|durZttjj||d��}|std��t	|d�|_
tdt|��D]+}||}d|vrBt
||�}|j�|�q,d|vrRt||�}|j�|�q,td|�q,dSt	�|_
dS)	a� Create a new copyright file in the current format.

        :param sequence: Sequence of lines, e.g. a list of strings or a
            file-like object.  If not specified, a blank Copyright object is
            initialized.
        :param encoding: Encoding to use, in case input is raw byte strings.
            It is recommended to use unicode objects everywhere instead, e.g.
            by opening files in text mode.
        :param strict: Raise if format errors are detected in the data.

        Raises:
            :class:`NotMachineReadableError` if 'sequence' does not contain a
                machine-readable debian/copyright file.
            MachineReadableFormatError if 'sequence' is not a valid file.
        N)�sequence�encodingzno paragraphs in inputr��Files�Licensez=Non-header paragraph has neither "Files" nor "License" fields)�superr$�__init__�_Copyright__paragraphs�listr�Deb822�iter_paragraphsrr�_Copyright__header�range�lenr�appendrr#)	�selfr&r'r"�
paragraphs�i�p�pf�pl��	__class__rrr,�s,�

��
zCopyright.__init__cCs|jS)zThe file header paragraph.)r1�r5rrr�header�szCopyright.headercCst|t�s	td��||_dS)Nzvalue must be a Header object)�
isinstancer�	TypeErrorr1)r5�hdrrrrr>�s

cCst�|jgdd�|jD��S)aReturns an iterator over all paragraphs (header, Files, License).

        The header (returned first) will be returned as a Header object; file
        paragraphs as FilesParagraph objects; license paragraphs as
        LicenseParagraph objects.

        css�|]}|VqdSrr��.0r8rrr�	<genexpr>�s�z+Copyright.all_paragraphs.<locals>.<genexpr>)�	itertools�chainr>r-r=rrr�all_paragraphs�s	zCopyright.all_paragraphscCs|��S)zXIterate over all paragraphs

        see all_paragraphs() for more information

        )rGr=rrr�__iter__�szCopyright.__iter__cC�dd�|jD�S)z>Returns an iterator over the contained FilesParagraph objects.cs��|]
}t|t�r|VqdSr)r?rrBrrrrD���z1Copyright.all_files_paragraphs.<locals>.<genexpr>�r-r=rrr�all_files_paragraphs��zCopyright.all_files_paragraphscCs$d}|��D]	}|�|�r|}q|S)z�Returns the FilesParagraph for the given filename.

        In accordance with the spec, this method returns the last FilesParagraph
        that matches the filename.  If no paragraphs matched, returns None.
        N)rM�matches)r5�filename�resultr8rrr�find_files_paragraph�s
�zCopyright.find_files_paragraphcCsNt|t�s	td��d}t|j�D]\}}t|t�r|}q|j�|d|�dS)z�Adds a FilesParagraph to this object.

        The paragraph is inserted directly after the last FilesParagraph (which
        might be before a standalone LicenseParagraph).
        z+paragraph must be a FilesParagraph instance���r(N)r?rr@�	enumerater-�insert)r5�	paragraph�last_ir7r8rrr�add_files_paragraph�s

�zCopyright.add_files_paragraphcCrI)z=Returns an iterator over standalone LicenseParagraph objects.csrJr)r?rrBrrrrD�rKz3Copyright.all_license_paragraphs.<locals>.<genexpr>rLr=rrr�all_license_paragraphs�rNz Copyright.all_license_paragraphscCs"t|t�s	td��|j�|�dS)zoAdds a LicenceParagraph to this object.

        The paragraph is inserted after any other paragraphs.
        z-paragraph must be a LicenseParagraph instanceN)r?rr@r-r4)r5rVrrr�add_license_paragraph�s
zCopyright.add_license_paragraphcCs\d}|durd}t��}|jj|dd�|jD]}|�d�|j|dd�q|r,|��SdS)aaDumps the contents of the copyright file.

        If f is None, returns a unicode object.  Otherwise, writes the contents
        to f, which must be a file-like object that is opened in text mode
        (i.e. that accepts unicode objects directly).  It is thus up to the
        caller to arrange for the file to do any appropriate encoding.
        FNT)�	text_mode�
)�io�StringIOr>�dumpr-�write�getvalue)r5�f�
return_stringr8rrrr_�s	

zCopyright.dump)Nr%Tr)rrrrr,�propertyr>�setterrGrHrMrRrXrYrZr_�
__classcell__rrr;rr$^s$*

	

r$cCsd|vrtd��|S)zNReturns s if it is a single line; otherwise raises MachineReadableFormatError.r\zmust be single line)r��srrr�_single_linesric@s(eZdZdZedd��Zedd��ZdS)�
_LineBasedz@Namespace for conversion methods for line-based lists as tuples.cCs(tdd�dd�|p
d����D�D��S)z?Returns the lines in 's', with whitespace stripped, as a tuple.cs��|]}|r|VqdSrr�rC�vrrrrD$s��z&_LineBased.from_str.<locals>.<genexpr>css�|]}|��VqdSr)�strip)rC�linerrrrD%���)�tuplern�
splitlinesrgrrr�from_str s�z_LineBased.from_strcCs\t|�}|sdSdd�}t|�dkr||d�Sdg}|D]}|�d||��qd�|�S)	z�Returns the sequence as a string with each element on its own line.

        If 'seq' has one element, the result will be on a single line.
        Otherwise, the first line will be blank.
        NcSs(|��}|s
td��d|vrtd��|S)N�values must not be emptyr\z values must not contain newlines)rnrrgrrr�process_and_validate4s�z/_LineBased.to_str.<locals>.process_and_validater(rrq� r\)r.r3r4�join)�seq�lrv�tmprhrrr�to_str(s

z_LineBased.to_strN)rrrr�staticmethodrtr|rrrrrjs
rjc@s2eZdZdZe�d�Zedd��Ze	dd��Z
dS)�_SpaceSeparatedzENamespace for conversion methods for space-separated lists as tuples.z\scCstdd�|pd��D��S)z>Returns the values in s as a tuple (empty if only whitespace).csrkrrrlrrrrDQrpz+_SpaceSeparated.from_str.<locals>.<genexpr>rq)rr�splitrgrrrrtMsz_SpaceSeparated.from_strcCsZt|�}|sdSg}|D]}|j�|�rtd��|��}|s"td��|�|�qd�|�S)zAReturns the sequence as a space-separated string (None if empty).Nz"values must not contain whitespacerurw)r.�
_has_space�searchrrnr4rx)�clsryrzr{rhrrrr|Ss�
z_SpaceSeparated.to_strN)rrrr�re�compiler�r}rt�classmethodr|rrrrr~Gs

r~cCs|durdSt|���S)z�Formats multiline text for insertion in a Deb822 field.

    Each line except for the first one is prefixed with a single space.  Lines
    that are blank or only whitespace are replaced with ' .'
    N)�format_multiline_linesrsrgrrr�format_multilinehsr�cCsFg}t|�D]\}}|dkr|��sd}d|}|�|�qd�|�S)z?Same as format_multline, but taking input pre-split into lines.r�.rwr\)rTrnr4rx)�lines�	out_linesr7rorrrr�ts
r�cCs|durdSd�t|��S)agInverse of format_multiline.

    Technically it can't be a perfect inverse, since format_multline must
    replace all-whitespace lines with ' .'.  Specifically, this function:

      - Does nothing to the first line
      - Removes first character (which must be ' ') from each proceeding line.
      - Replaces any line that is '.' with an empty line.
    Nr\)rx�parse_multiline_as_linesrgrrr�parse_multiline�sr�cCs\|��}t|�D]#\}}|dkrq|�d�r|dd�}ntd��|dkr'd}|||<q|S)zpSame as parse_multiline, but returns a list of lines.

    (This is the inverse of format_multiline_lines.)
    rrwr(Nz"continued line must begin with " "r�rq)rsrT�
startswithr)rhr�r7rorrrr��s
�
r�cs6eZdZdZd	�fdd�	Zedd��Zdd�Z�ZS)
r*z7Represents the contents of a License field.  Immutable.rqcstt|�j|t|�|pdd�S)a�Creates a new License object.

        :param synopsis: The short name of the license, or an expression giving
            alternatives.  (The first line of a License field.)
        :param text: The full text of the license, if any (may be None).  The
            lines should not be mangled for "deb822"-style wrapping - i.e. they
            should not have whitespace prefixes or single '.' for empty lines.
        rq)�synopsis�text)r+r*�__new__ri)r�r�r�r;rrr��s

�zLicense.__new__c	Cs@|durdSt|�}|s|d�S||dd�t�|dd��d�S)Nrqrr\r()r�)r�rxrE�islice)r�rhr�rrrrt�s zLicense.from_strcCst|jg|j���Sr)r�r�r�rsr=rrrr|�szLicense.to_str)rq)	rrrrr�r�rtr|rfrrr;rr*�s

r*z
synopsis textcCst��}t|�D]g\}}|dkr|�d�d}t|�}||kro||}|d7}|dkr1|�d�n:|dkr;|�d�n0|dkrc||krL||}|d7}ntd	��|d
vr]|�t�|��ntd|��|�t�|��||ksq|�d�t�|�	�tj
tjB�S)
a^Returns an re object for the given globs.

    Only * and ? wildcards are supported.  Literal * and ? may be matched via
    \* and \?, respectively.  A literal backslash is matched \\.  Any other
    character after a backslash is forbidden.

    Empty globs match nothing.

    Raises MachineReadableFormatError if any of the globs is illegal.
    r�|r(�*z.*�?r��\z#single backslash not allowed at endz\?*zinvalid escape sequence: \%sz\Z)r]r^rTr`r3rr��escaper�ra�	MULTILINE�DOTALL)�globs�bufr7�glob�n�crrr�globs_to_re�s<

����
r�cs�eZdZdZe�d�Zd�fdd�	Zedd��Z	dd	�Z
d
d�Zej
dejejd
d�Zej
dd
d�Zej
dejejd
d�Ze�
d�Z�ZS)rz�Represents a Files paragraph of a debian/copyright file.

    This kind of paragraph is used to specify the copyright and license for a
    particular set of files in the package.
    rqTcshtt|��|�|r,d|vrtd��d|vrtd|�d|vr$td|�|js,td|�d|jf|_dS)	Nr)z"Files" field requiredr$z'Files paragraph missing Copyright fieldr*z%Files paragraph missing License fieldz%Files paragraph has empty Files fieldrq)r+rr,rr#�files�_default_re�!_FilesParagraph__cached_files_pat)r5�data�_internal_validater"r;rrr,s


zFilesParagraph.__init__cCs&|t��dd�}||_||_||_|S)z�Create a new FilesParagraph from its required parts.

        :param files: The list of file globs.
        :param copyright: The copyright for the files (free-form text).
        :param license: The Licence for the files.
        F�r�)rr/r��	copyright�license)r�r�r�r�r8rrr�creates
zFilesParagraph.createcCs0|d}|jd|kr|t|j�f|_|jdS)z�Returns a regular expression equivalent to the Files globs.

        Caches the result until files is set to a different value.

        Raises ValueError if any of the globs are invalid.
        r�rr()r�r�r�)r5�	files_strrrr�
files_pattern&s
zFilesParagraph.files_patterncCs"|��}|dur
dS|�|�duS)z8Returns True iff filename is matched by a glob in Files.NF)r��match)r5rP�patrrrrO3szFilesParagraph.matchesr)F�rtr|�
allow_noner$)r�r*�Comment)TT)rrrrr�r�r�r,r�r�r�rOr�RestrictedFieldr~rtr|r�r�r*r��commentrfrrr;rr�s$


�
�rcsXeZdZdZd�fdd�	Zedd��Zejde	j
e	jdd	�Ze�d
�Z
e�d�Z�ZS)
ra Represents a standalone license paragraph of a debian/copyright file.

    Minimally, this kind of paragraph requires a 'License' field and has no
    'Files' field.  It is used to give a short name to a license text, which
    can be referred to from the header or files paragraphs.
    Tcs<tt|��|�|rd|vrtd��d|vrtd��dSdS)Nr*z"License" field requiredr)z%input appears to be a Files paragraph)r+rr,r)r5r�r�r;rrr,Ps��zLicenseParagraph.__init__cCs,t|t�s	td��|t��dd�}||_|S)z2Returns a LicenseParagraph with the given license.z"license must be a License instanceFr�)r?r*r@rr/r�)r�r�rVrrrr�Zs

zLicenseParagraph.creater*Fr�r�r))T)rrrrr,r�r�rr�r*rtr|r�r��_LicenseParagraph__filesrfrrr;rrHs


�
rcs�eZdZdZd�fdd�	Zdd�Zdd�Zejd	e	d
d�Z
ejde	d
�Zejdej
ejd�Ze�d�Ze�d�Ze�d�Zejdej
ejd�Ze�d�Zejdej
ejd�Zejdej
ejd�Z�ZS)rz�Represents the header paragraph of a debian/copyright file.

    Property values are all immutable, such that in order to modify them you
    must explicitly set them (rather than modifying a returned reference).
    Ncs�|durt��}t|d<d|vrt�d�|d|d<|d=tt|��|�t�}|j	}|tkrV|durV|�
d�s=|d7}|�d�rJd|dd�}|tvrVt�d	�||_	|dur^t
d
��|tvrjt�d|�dSdS)z�Initializer.

        :param data: A deb822.Deb822 object for underlying data.  If None, a
            new one will be created.
        N�FormatzFormat-SpecificationzEuse of deprecated "Format-Specification" field; rewriting as "Format"�/zhttp:zhttps:%s�zFixing Format URLz0input is not a machine-readable debian/copyrightzformat not known: %r)rr/�_CURRENT_FORMATrr r+rr,�str�format�endswithr��_KNOWN_FORMATSr)r5r��fmtr;rrr,ys2



��zHeader.__init__cCs
|jtvS)z%Returns True iff the format is known.)r�r�r=rrr�known_format��
zHeader.known_formatcCs
|jtkS)z2Returns True iff the format is the current format.)r�r�r=rrr�current_format�r�zHeader.current_formatr�F)r|r�z
Upstream-Name)r|zUpstream-Contact)rtr|�Source�
Disclaimerr�r*r$zFiles-ExcludedzFiles-Includedr)rrrrr,r�r�rr�rir��
upstream_namerjrtr|�upstream_contact�source�
disclaimerr�r*r�r��files_excluded�files_includedrfrrr;rrrs<(���



�
��r)4r�collectionsrE�loggingr]r��typingrrrrrrrr	r
rrr
�ParagraphTypes�AllParagraphTypes�ImportError�debianrr��	frozensetr��	getLoggerrr�	Exceptionrr�
ValueErrorrr#�objectr$rirjr~r�r�r�r��
namedtupler*r��RestrictedWrapperrrrrrrr�<module>sL8���
7+!
#.Q*

Spamworldpro Mini