%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/debian/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/debian/__pycache__/deb822.cpython-312.pyc

�

Cf�c^z��:�dZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZ	ddl
mZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZm Z m!Z!m"Z"m#Z#e"eeee$eeee$fZ%e"e$ee%fZ&eZ'ee(e'fZ)ee(e'fZ*ddl+Z+e!dd��Z,ddl-m.Z.m/Z/ddl1m2Z2m3Z3m4Z4m5Z5ddl6m7Z7ddl8Z9ddl:Z9	ddl;Z;e;jxd
Z=d�Z?ej�d�d��ZAeBdg�ZCdZDej�d�ZFGd�deG�ZHGd�deH�ZIe#re)ZJnej�j0ZJGd�deJ�ZLe#re*ZMnej�j2ZMGd�deM�ZNGd�deN�ZOe#ree(ee(fZPneQZPGd�deP�ZRGd�d eS�ZTe#ree(efZUneQZUGd!�d"eU�ZVe#rGd#�d$e�ZWGd%�d&eS�ZXGd'�d(eS�ZYGd)�d*eO�ZZGd+�d,eZ�Z[Gd-�d.e[eX�Z\Gd/�d0e[eX�Z]Gd1�d2e[eYeX�Z^Gd3�d4eZ�Z_Gd5�d6eZ�Z`Gd7�d8e\eY�ZaGd9�d:eOeYeX�ZbGd;�d<ej�d<d=��ZdGd>�d?eO�ZeGd@�dAeS�Zfy#e0$rdZ#e#sd	�Zd
�Ze$de(diZdZ)dZ&Y���wxYw#e0e>f$rdZ=Y���wxYw)Ba� Dictionary-like interfaces to RFC822-like files

The Python deb822 aims to provide a dict-like interface to various RFC822-like
Debian data formats, like Packages/Sources, .changes/.dsc, pdiff Index files,
etc. As well as the generic :class:`Deb822` class, the specialised versions
of these classes  (:class:`Packages`, :class:`Sources`, :class:`Changes` etc)
know about special fields that contain specially formatted data such as
dependency lists or whitespace separated sub-fields.

This module has few external dependencies, but can use python-apt if available
to parse the data, which gives a very significant performance boost when
iterating over big Packages files.

Whitespace separated data within fields are known as "multifields".
The "Files" field in Sources files, for instance, has three subfields, while
"Files" in .changes files, has five; the relevant classes here know this and
correctly handle these cases.

Key lookup in Deb822 objects and their multifields is case-insensitive, but
the original case is always preserved, for example when printing the object.

The Debian project and individual developers make extensive use of GPG
signatures including in-line signatures. GPG signatures are automatically
detected, verified and the payload then offered to the parser.

Relevant documentation on the Deb822 file formats available here.

- `deb-control(5)
  <https://manpages.debian.org/stretch/dpkg-dev/deb-control.5.html>`_,
  the `control` file in the binary package (generated from
  `debian/control` in the source package)
- `deb-changes(5)
  <https://manpages.debian.org/stretch/dpkg-dev/deb-changes.5.html>`_,
  `changes` files that developers upload to add new packages to the
  archive.
- `dsc(5) <https://manpages.debian.org/stretch/dpkg-dev/dsc.5.html>`_,
  Debian Source Control file that defines the files that are part of a
  source package.
- `Debian mirror format <http://wiki.debian.org/RepositoryFormat>`_,
  including documentation for Packages, Sources files etc.

Overview of deb822 Classes
--------------------------

Classes that deb822 provides:

  * :class:`Deb822` base class with no multifields. A Deb822 object holds a
    single entry from a Deb822-style file, where paragraphs are separated by
    blank lines and there may be many paragraphs within a file. The
    :func:`~Deb822.iter_paragraphs` function yields paragraphs from a data
    source.

  * :class:`Packages` represents a Packages file from a Debian mirror.
    It extends the Deb822 class by interpreting fields that
    are package relationships (Depends, Recommends etc). Iteration is forced
    through python-apt for performance and conformance.

  * :class:`Dsc` represents .dsc files (Debian Source Control) that are the
    metadata file of the source package.

    Multivalued fields:

      * Files: md5sum, size, name
      * Checksums-Sha1: sha1, size, name
      * Checksums-Sha256: sha256, size, name
      * Checksums-Sha512: sha512, size, name

  * :class:`Sources` represents a Sources file from a Debian mirror.
    It extends the Dsc class by interpreting fields that
    are package relationships (Build-Depends, Build-Conflicts etc).
    Iteration is forced through python-apt for performance and conformance.

  * :class:`Release` represents a Release file from a Debian mirror.

    Multivalued fields:

      * MD5Sum: md5sum, size, name
      * SHA1: sha1, size, name
      * SHA256: sha256, size, name
      * SHA512: sha512, size, name

  * :class:`Changes` represents a .changes file that is uploaded to "change
    the archive" by including new source or binary packages.

    Multivalued fields:

      * Files: md5sum, size, section, priority, name
      * Checksums-Sha1: sha1, size, name
      * Checksums-Sha256: sha256, size, name
      * Checksums-Sha512: sha512, size, name

  * :class:`PdiffIndex` represents a pdiff Index file (`foo`.diff/Index) file
    from a Debian mirror.

    Multivalued fields:

      * SHA1-Current: SHA1, size
      * SHA1-History: SHA1, size, date
      * SHA1-Patches: SHA1, size, date
      * SHA1-Download: SHA1, size, filename
      * X-Unmerged-SHA1-History: SHA1, size, date
      * X-Unmerged-SHA1-Patches: SHA1, size, date
      * X-Unmerged-SHA1-Download: SHA1, size, filename
      * SHA256-Current: SHA256, size
      * SHA256-History: SHA256, size, date
      * SHA256-Patches: SHA256, size, date
      * SHA256-Download: SHA256, size, filename
      * X-Unmerged-SHA256-History: SHA256, size, date
      * X-Unmerged-SHA256-Patches: SHA256, size, date
      * X-Unmerged-SHA256-Download: SHA256, size, filename

  * :class:`Removals` represents the ftp-master removals file listing when
    and why source and binary packages are removed from the archive.


Input
=====

Deb822 objects are normally initialized from a file object (from which
at most one paragraph is read) or a string. Alternatively, any sequence
that returns one line of input at a time may be used, e.g a list of strings.

PGP signatures, if present, will be stripped.

Example::

    >>> from debian.deb822 import Deb822
    >>> filename = '/var/lib/apt/lists/deb.debian.org_debian_dists_sid_InRelease'
    >>> with open(filename) as fh: # doctest: +SKIP
    ...     rel = Deb822(fh)
    >>> print('Origin: {Origin}\nCodename: {Codename}\nDate: {Date}'.format_map( # doctest: +SKIP
    ...       rel))
    Origin: Debian
    Codename: sid
    Date: Sat, 07 Apr 2018 14:41:12 UTC
    >>> print(list(rel.keys()))   # doctest: +SKIP
    ['Origin', 'Label', 'Suite', 'Codename', 'Changelogs', 'Date',
    'Valid-Until', 'Acquire-By-Hash', 'Architectures', 'Components',
    'Description', 'MD5Sum', 'SHA256']


In the above, the `MD5Sum` and `SHA256` fields are just a very long string. If
instead the :class:`Release` class is used, these fields are interpreted and
can be addressed::

    >>> from debian.deb822 import Release
    >>> filename = '/var/lib/apt/lists/deb.debian.org_debian_dists_sid_InRelease'
    >>> with open(filename) as fh: # doctest: +SKIP
    ...     rel = Release(fh)
    >>> wanted = 'main/binary-amd64/Packages'
    >>> [(l['sha256'], l['size']) for l in rel['SHA256'] if l['name'] == wanted]   # doctest: +SKIP
    [('c0f7aa0b92ebd6971c0b64f93f52a8b2e15b0b818413ca13438c50eb82586665', '45314424')]


Iteration
=========

All classes use the :func:`~Deb822.iter_paragraphs` class method to easily
iterate through each paragraph in a file that contains multiple entries
(e.g. a Packages.gz file).
For example::

    >>> with open('/mirror/debian/dists/sid/main/binary-i386/Sources') as f:  # doctest: +SKIP
    ...     for src in Sources.iter_paragraphs(f):
    ...         print(src['Package'], src['Version'])

The `iter_paragraphs` methods can use python-apt if available to parse
the data, since it significantly boosts performance.
If python-apt is not present and the
file is a compressed file, it must first be decompressed manually. Note that
python-apt should not be used on `debian/control` files since python-apt is
designed to be strict and fast while the syntax of `debian/control` is a
superset of what python-apt is designed to parse.
This function is overridden to force use of the
python-apt parser using `use_apt_pkg` in the :func:`~Packages.iter_paragraphs`
and :func:`~Sources.iter_paragraphs` functions.


Sample usage
============

Manipulating a .dsc file::

   from debian import deb822

   with open('foo_1.1.dsc') as f:
       d = deb822.Dsc(f)
   source = d['Source']
   version = d['Version']

   for f in d['Files']:
       print('Name:', f['name'])
       print('Size:', f['size'])
       print('MD5sum:', f['md5sum'])

    # If we like, we can change fields
    d['Standards-Version'] = '3.7.2'

    # And then dump the new contents
    with open('foo_1.1.dsc2', 'w') as new_dsc:
        d.dump(new_dsc)

(TODO: Improve, expand)

Deb822 Classes
--------------
�N)�Any�Callable�cast�Dict�	FrozenSet�	Generator�Iterator�Iterable�IO�List�Mapping�MutableMapping�Optional�overload�Protocol�Set�Text�Tuple�Type�TypeVar�Union�
TYPE_CHECKING�T_Deb822Dict�
Deb822Dict��bound)�Literal�	TypedDictFc��y�N���fs �//usr/lib/python3/dist-packages/debian/deb822.py�<lambda>r%,���c��|Sr r!)�t�vs  r$r%r%-s��A�r')�
OrderedSet�_CaseInsensitiveString�_strI�default_field_sort_key)�function_deprecated_byTc�d�	|j�y#ttjf$rYywxYw)zp test that a file-like object is really a filehandle

    Only filehandles can be given to apt_pkg.TagFile.
    TF)�fileno�AttributeError�io�UnsupportedOperationr"s r$�_has_filenor5Ks0���	���
����B�3�3�4����s��/�/�c��t|�Sr )r-)r*s r$�_cached_strIr8Ys
����8�Or'z&/usr/share/keyrings/debian-keyring.gpgz
/usr/bin/gpgvz
debian.deb822c��eZdZdZy)�Errorz0Base class for custom exceptions in this module.N��__name__�
__module__�__qualname__�__doc__r!r'r$r:r:fs��:r'r:c��eZdZdZy)�RestrictedFieldErrorz>Raised when modifying the raw value of a field is not allowed.Nr;r!r'r$rArAjs��Hr'rAc�8��eZdZdZ	d�fd�	Zd�Zd�Zd�Z�xZS)�TagSectionWrapperz�Wrap a TagSection object, using its find_raw method to get field values

    This allows us to pick which whitespace to strip off the beginning and end
    of the data, so we don't lose leading newlines.
    c�^��||_|xs
t�|_tt|��yr )�_TagSectionWrapper__section�_AutoDecoder�decoder�superrC�__init__)�self�sectionrG�	__class__s   �r$rIzTagSectionWrapper.__init__{s(���
!����0�,�.���
���/�1r'c#�vK�|jj�D]}|jd�r�|���y�w�N�#)rE�keys�
startswith�rJ�keys  r$�__iter__zTagSectionWrapper.__iter__�s3�����>�>�&�&�(�	�C��>�>�#�&��	�	�s�/9�9c��t|jj�D�cgc]}|jd�s|��c}�Scc}wrN)�lenrErPrQrRs  r$�__len__zTagSectionWrapper.__len__�sA���4�>�>�#6�#6�#8�0�C��>�>�#�.��0�1�	1��0s�Ac��|jj|�}|jj|�}|�t	|��||jd�dzd}|j
d�jd�S)N�:�z 	�
)rE�find_rawrG�decode�KeyError�find�lstrip�rstrip)rJrS�sraw�s�datas     r$�__getitem__zTagSectionWrapper.__getitem__�sq���~�~�&�&�s�+���L�L����%���9��3�-��������Q��� ���{�{�5�!�(�(��.�.r'r )	r<r=r>r?rIrTrWre�
__classcell__�rLs@r$rCrCts!�����2��1�
/r'rCc���eZdZdZ				d�fd�	Zd�Zd�Zd�Zd�Zd�Z	d	�Z
d
�Zd�Zd�Z
d
�Zdd�Zd�Zd�ZdZd�Z�xZS)ra3A dictionary-like object suitable for storing RFC822-like data.

    Deb822Dict behaves like a normal dict, except:
        - key lookup is case-insensitive
        - key order is preserved
        - if initialized with a _parsed parameter, it will pull values from
          that dictionary-like object as needed (rather than making a copy).
          The _parsed dict is expected to be able to handle case-insensitive
          keys.

    If _parsed is not None, an optional _fields parameter specifies which keys
    in the _parsed dictionary are exposed.
    Nc����i|_t�|_d|_||_t|j�|_tt|�'�|�;g}t|d�r|j�}nt|�}	|D]
\}}|||<�	|��||_|�=|jj|jD�cgc]
}t!|���c}�y|jj|D�
cgc]}
|
|jvs�t!|
���c}
�yy#t$r4t|j�}t||�}	td||	fz��wxYwcc}wcc}
w)N�itemszCdictionary update sequence element #%d has length %d; 2 is required)�_Deb822Dict__dictr+�_Deb822Dict__keys�_Deb822Dict__parsed�encodingrFrGrHrrI�hasattrrj�list�
ValueErrorrV�extendr8)rJ�_dict�_parsed�_fieldsrnrj�kr*�this�len_r#rLs           �r$rIzDeb822Dict.__init__�sI������ �l�����
� ��
�#�D�M�M�2���
�j�$�(�*����E��u�g�&����
���U���
?�!� �D�A�q��D��G� ���#�D�M������"�"�T�]�]�#K��L��O�#K�L����"�"�W�#[���T�]�]�HZ�L��O�#[�\����
?��4�;�;�'���5��;�'�� �/�26���>�?�?�
?��$L��#[s�?D�=E�0E�
E�=Ec#�HK�|jD]}t|����y�wr )rl�strrRs  r$rTzDeb822Dict.__iter__�s"�����;�;�	�C��c�(�N�	�s� "c�,�t|j�Sr )rVrl�rJs r$rWzDeb822Dict.__len__�s���4�;�;��r'c�n�t|�}|jj|�||j|<yr )r8rl�addrk)rJrS�value�keyis    r$�__setitem__zDeb822Dict.__setitem__�s,���C� ���������!����D�r'c���t|�}	|j|}|j
j
|�S#t$r.|j�||jvr|j|}n�Y�QwxYwr )r-rkr^rmrlrGr])rJrSr�rs    r$rezDeb822Dict.__getitem__�sq���S�z��	��K�K��%�E��|�|�"�"�5�)�)���	��}�}�(�T�T�[�[�-@��
�
�d�+����	�s�7�4A.�-A.c��t|�}|jj|�	|j|=y#t$rYywxYwr )r-rl�removerkr^�rJrSr�s   r$�__delitem__zDeb822Dict.__delitem__sB���S�z�������4� �	����D�!���	�
�	�s�
6�	A�Ac�4�t|�}||jvSr )r-rlr�s   r$�__contains__zDeb822Dict.__contains__s���S�z���t�{�{�"�"r'c�L�|jjt|��y)z9Re-order the given field so it is "last" in the paragraphN)rl�
order_lastr-�rJ�fields  r$r�zDeb822Dict.order_lasts��	
�����u�U�|�,r'c�L�|jjt|��y)z:Re-order the given field so it is "first" in the paragraphN)rl�order_firstr-r�s  r$r�zDeb822Dict.order_firsts��	
������e��-r'c�`�|jjt|�t|��y)z�Re-order the given field so appears directly after the reference field in the paragraph

        The reference field must be present.N)rl�order_beforer-�rJr��reference_fields   r$r�zDeb822Dict.order_before#s!��
	
��� � ��u��u�_�/E�Fr'c�`�|jjt|�t|��y)z�Re-order the given field so appears directly before the reference field in the paragraph

        The reference field must be present.
        N)rl�order_afterr-r�s   r$r�zDeb822Dict.order_after*s!��	
������e��e�O�.D�Er'c�^�|�t}tt|j|���|_y)a	Re-order all fields

        :param key: Provide a key function (same semantics as for sorted).  Keep in mind that
          Deb822 preserve the cases for field names - in generally, callers are recommended to use
          "lower()" to normalize the case.
        N)rS)r.r+�sortedrlrRs  r$�sort_fieldszDeb822Dict.sort_fields2s%���;�(�C� ������!=�>��r'c
��ddj|j�D��cgc]\}}|�d|����c}}�zScc}}w)Nz{%s}�, �: )�joinrj)rJrvr*s   r$�__repr__zDeb822Dict.__repr__>s3����	�	�����"N���A�q�!�#4�"N�O�O�O��"Ns�;c�d�t|�}t|�}||k(sy|D]}||||k7s�yy)NFT)r�)rJ�other�mykeys�	otherkeysrSs     r$�__eq__zDeb822Dict.__eq__BsF�������5�M�	���"���	�C��C�y�E�#�J�&��	�
r'c�(�|j|�}|Sr rg)rJ�copys  r$r�zDeb822Dict.copyTs���~�~�d�#���r')NNN�utf-8r )r<r=r>r?rIrTrWr�rer�r�r�r�r�r�r�r�r��__hash__r�rfrgs@r$rr�sm����"���!�	']�V�
 �"�*�$	�#�-�
.�
G�F�
?�P�� �H�r'c�P�eZdZdZ					d%d�Zer
edd��Ze					d&d��Z	e
d��ZdZe
jed	z�Ze
jd
�Z		d'd�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zed��Ze		d(d��Ze		d)d��Ze			d*d��Ze			d*d��Z			d*d�Ze
d��Zee�Ze
d��Zee�Z d�Z!ee!�Z"	d+d�Z#ee#�Z$e
jd�Z%e
	d+d��Z&e
	d+d ��Z'ed+d!��Z(d+d"�Z)d#�Z*d$�Z+y),�Deb822uZ Generic Deb822 data

    :param sequence: a string, or any object that returns a line of
        input each time, normally a file.  Alternately, sequence can
        be a dict that contains the initial key-value pairs. When
        python-apt is present, sequence can also be a compressed object,
        for example a file object associated to something.gz.

    :param fields: if given, it is interpreted as a list of fields that
        should be parsed (the rest will be discarded).

    :param _parsed: internal parameter.

    :param encoding: When parsing strings, interpret them in this encoding.
        (All values are given back as unicode objects, so an encoding is
        necessary in order to properly interpret the strings.)

    :param strict: Dict controlling the strictness of the internal parser
        to permit tuning of its behaviour between "generous in what it
        accepts" and "strict conformance". Known keys are described below.

    *Internal parser tuning*

    - `whitespace-separates-paragraphs`: (default: `True`)
      Blank lines between paragraphs should not have any whitespace in them
      at all. However:

      - Policy §5.1 permits `debian/control` in source packages to separate
        packages with lines containing whitespace to allow human edited
        files to have stray whitespace. Failing to honour this breaks
        tools such as
        `wrap-and-sort <https://manpages.debian.org/wrap-and-sort>`_
        (see, for example,
        `Debian Bug 715558 <https://bugs.debian.org/715558/>`_).
      - `apt_pkg.TagFile` accepts whitespace-only lines within the
        `Description` field; strictly matching the behaviour of apt's
        Deb822 parser requires setting this key to `False` (as is done
        by default for :class:`Sources` and :class:`Packages`.
        (see, for example,
        `Debian Bug 913274 <https://bugs.debian.org/913274/>`_).

    Note that these tuning parameter are only for the parser that is
    internal to `Deb822` and do not apply to python-apt's apt_pkg.TagFile
    parser which would normally be used for Packages and Sources files.
    Nc��i}d}t|d�rtt|�}ntt|�}tj|||||��|�	|j
|||�d|_yd|_y#t$r
Yd|_ywxYw)Nrj)rsrtrurn)	ror�
Deb822Mapping�
InputDataTyperrI�_internal_parser�EOFError�gpg_info)rJ�sequence�fieldsrtrn�strictrs�iterables        r$rIzDeb822.__init__�s��������8�W�%����1�E��M�8�4�H����D��w��%-�	�	/���
��%�%�h���?���
���
���
����
�
�s�A2�2	B�B�T_Deb822rc
#�"K�|xrt|�}|rtsd}tj|�n|r|sd}tj|�trF|rDt	j
|d��}	|	D]'}
||t
|
t|��|��}|s�$|���)yg}t|t�rt|j��}n5t|t�rt|j��}nt|�}	|||||��}
|
sy|
����w)a�Generator that yields a Deb822 object for each paragraph in sequence.

        :param sequence: same as in __init__.

        :param fields: likewise.

        :param use_apt_pkg: if sequence is a file, apt_pkg can be used
            if available to parse the file, since it's much much faster.  Set
            this parameter to True to enable use of apt_pkg. Note that the
            TagFile parser from apt_pkg is a much stricter parser of the
            Deb822 format, particularly with regards whitespace between
            paragraphs and comments within paragraphs. If these features are
            required (for example in debian/control files), ensure that this
            parameter is set to False.
        :param shared_storage: not used, here for historical reasons.  Deb822
            objects never use shared storage anymore.
        :param encoding: Interpret the paragraphs in this encoding.
            (All values are given back as unicode objects, so an encoding is
            necessary in order to properly interpret the strings.)
        :param strict: dict of settings to tune the internal parser if that is
            being used. See the documentation for :class:`Deb822` for details.
        z}Parsing of Deb822 data with python3-apt's apt_pkg was requested but this package is not importable. Is python3-apt installed?zjParsing of Deb822 data with python3-apt's apt_pkg was requested but this cannot be done on non-file input.T)�bytes)r�rtrn)rnr�N)
r5�
_have_apt_pkg�warnings�warn�apt_pkg�TagFilerCrF�
isinstancerz�iter�
splitlinesr�)�clsr�r��use_apt_pkg�shared_storagernr��apt_pkg_allowed�msg�parserrK�	paragraphr��xs              r$�iter_paragraphszDeb822.iter_paragraphs�s����D&�?�+�h�*?���}�,�
�

�M�M�#��
��G�
�
�M�M�#���_��_�_�X�T�:�F�!�
$���v�(9�'�<�PX�CY�(Z�)1�3�	��#�O�
$��H��(�C�(��� 3� 3� 5�6���H�e�,��� 3� 3� 5�6�� ��>�����&�8�F�K������	�s
�BD�A=Dc#�K�d}|D]N}t|t�r|j�}|jd�r�5|r|j	d�s�Id}|���Py�w)zyYields only lines that do not begin with '#'.

        Also skips any blank lines at the beginning of the input.
        T�#�
FN)r�rz�encoderQra)r��at_beginning�lines   r$�_skip_useless_lineszDeb822._skip_useless_lines�s^�������	�D��$��$��{�{�}�����t�$����{�{�7�+��$���J�	�s�AAz!^(?P<key>[^: \t\n\r\f\v]+)\s*:\s*z(?P<data>(?:\S+(\s+\S+)*)?)\s*$z((?P<source>[^ ]+)( \((?P<version>.+)\))?c����fd�}t|ttf�r|j�}d}d}|j	|j|�|�D]�}|jj|�}|jj|�}	|	r5|r|||<|	jd�}||�sd}�^|	jd�}�p|s�s|dj�s��|j�r��|d|zz
}��|r|||<yy)Nc����duxs|�vSr r!)r#r�s �r$�wanted_fieldz-Deb822._internal_parser.<locals>.wanted_field's����T�>�0�Q�&�[�0r'�rSrdrr[)r�rzr�r��_gpg_stripped_paragraphr�rG�decode_bytes�
_new_field_re�match�group�isspace)
rJr�r�r�r��curkey�content�	linebytesr��ms
  `       r$r�zDeb822._internal_parser s����	1��h��e��-��*�*�,�H������5�5��(�(��2�F�<�	�I��<�<�,�,�Y�7�D��"�"�(�(��.�A���#*�D��L�������#�F�+�!�F���'�'�&�/�����Q����)�$�,�,�.��4�$�;�&���+	�.�"�D��L�r'c�.�|j�}|�|SdS�Nr���dump�rJ�ds  r$�__str__zDeb822.__str__K����I�I�K���M�q�)�r�)r'c�.�|j�}|�|SdSr�r�r�s  r$�__unicode__zDeb822.__unicode__Pr�r'c�`�|j�}|�|j|j�SdS)Nr')r�r�rnr�s  r$�	__bytes__zDeb822.__bytes__Us)���I�I�K��*+�-�q�x�x��
�
�&�@�S�@r'c��t||�S)z�Return the self[key] as a string (or unicode)

        The default implementation just returns unicode(self[key]); however,
        this can be overridden in subclasses (e.g. _multivalued) that can take
        special values.
        �rzrRs  r$�
get_as_stringzDeb822.get_as_string\s���4��9�~�r'c#�zK�|D]2}|j|�}|r|ddk(r	|�d|�d�}n|�d|�d�}|���4y�w)Nrr[rYr�)r�)rJrSr�entrys    r$�_dump_formatzDeb822._dump_formatfsN�����
	�C��&�&�s�+�E��E�!�H��,�
&)�%�0��&)�5�1���K�
	�s�9;c�@�dj|j��Sr�)r�r�r|s r$�	_dump_strzDeb822._dump_strts���w�w�t�(�(�*�+�+r'c�n�|j�D]"}|j|j|���$yr )r��writer�)rJ�fdrnr�s    r$�
_dump_fd_bzDeb822._dump_fd_bxs1��
�&�&�(�	-�E��H�H�U�\�\�(�+�,�	-r'c�P�|j�D]}|j|��yr )r�r�)rJr�r�s   r$�
_dump_fd_tzDeb822._dump_fd_t�s'���&�&�(�	�E��H�H�U�O�	r'c��yr r!r|s r$r�zDeb822.dump�s��	
r'c��yr r!�rJr�rn�	text_modes    r$r�zDeb822.dump����	
r'c��yr r!r�s    r$r�zDeb822.dump�r�r'c��yr r!r�s    r$r�zDeb822.dump�r�r'c��yr r!r�s    r$r�zDeb822.dump�r�r'c���|�|j�S|r'|jttt|��y|�|j
}|j
ttt|�|�y)aDump the contents in the original format

        :param fd: file-like object to which the data should be written
            (see notes below)
        :param encoding: str, optional (Defaults to object default).
            Encoding to use when writing out the data.
        :param text_mode: bool, optional (Defaults to ``False``).
            Encoding should be undertaken by this function rather than by the
            caller.

        If fd is None, returns a unicode object.  Otherwise, fd is assumed to
        be a file-like object, and this method will write the data to it
        instead of returning a unicode object.

        If fd is not none and text_mode is False, the data will be encoded
        to a byte string before writing to the file.  The encoding used is
        chosen via the encoding parameter; None means to use the encoding the
        object was initialized with (utf-8 by default).  This will raise
        UnicodeEncodeError if the encoding can't support all the characters in
        the Deb822Dict values.
        N)r�r�rrrzrnr�r�r�s    r$r�zDeb822.dump�se��@�:��>�>�#�#���O�O�D��C��"�-�.��
�� �=�=���O�O�D��E��B�/��:�r'c�&�|jd�S)Nr[)�count�rcs r$�is_single_linezDeb822.is_single_line�s���7�7�4�=� � r'c�.�tj|�Sr )r�rrs r$�
is_multi_linezDeb822.is_multi_line�s���(�(��+�+�+r'c���|s|S|s|S|j|�rl|j|�r[d}||zjd�rd}t||z|zj|��}|dx}}|ddD]}||k(r�	||z|z}|}�|S|j	|�rE|j	|�r4|jd�D]}||jd�vs�|dz|z}� |St�)N� r�rrZTr[)rr�r��splitrr�rq)rJ�s1�s2�delim�L�prev�merged�items        r$�
_merge_fieldszDeb822._merge_fields�s��
��I���I����r�"�t�':�':�2�'>�
�E��R����t�$�����U�
�R��.�.�u�5�6�A��a�D� �D�6��!�"��
���4�<���%��$�.����
��M����b�!�d�&8�&8��&<��
�
�d�+�
*���r�}�}�T�2�2��d��T�)�B�
*��I��r'c��|�|}|}n|}|}||vr||vr|j||||�}n||vr||}n||vr||}nt�|�|||<y|Sr )rr^)rJrS�d1�d2�x1�x2rs       r$�merge_fieldszDeb822.merge_fieldss����:��B��B��B��B�
�"�9�����'�'��3���C��9�F�
�B�Y���W�F�
�B�Y���W�F��N��:��D��I���
r's=^-----(?P<action>BEGIN|END) PGP (?P<what>[^-]+)-----[\r\t ]*$c�B�d�|D�}tj||��S)a�Return a (gpg_pre, payload, gpg_post) tuple

        Each element of the returned tuple is a list of lines (with trailing
        whitespace stripped).

        :param sequence: iterable.
            An iterable that yields lines of data (str, unicode,
            bytes) to be parsed, possibly including a GPG in-line signature.
        :param strict: dict, optional.
            Control over the strictness of the parser. See the :class:`Deb822`
            class documentation for details.
        c3�`K�|]&}t|t�r|j�n|���(y�wr )r�rzr�)�.0r�s  r$�	<genexpr>z/Deb822.split_gpg_and_payload.<locals>.<genexpr>Vs$����W��:�a��+=�Q�X�X�Z�1�D�W�s�,.)r�)r��_split_gpg_and_payload)r�r��_encoded_sequences   r$�split_gpg_and_payloadzDeb822.split_gpg_and_payloadAs'��*X�h�W���,�,�->�v�,�N�Nr'c��|si}g}g}g}d}|jdd�}d}|D�]B}|jd�}|r|r|j�r�*d}|jd�rtj
j
|�nd}	|r|xs|j�n|}
|	sR|dk(r|
s|j|���|r��n�|dk(r|
rd}��|j|���|dk(s��|j|���|	jd	�d
k(r|	jd�}n'|	jd	�dk(r|j|�n-|
r��|s|j|���2|j|���E|r|||fStd
��)NsSAFE�whitespace-separates-paragraphsTr�F�-sSIGNED MESSAGEs	SIGNATURE�actionsBEGIN�whatsENDzonly blank lines found in input)
�get�stripr�rQr��_gpgrer��appendr�r�)r�r��
gpg_pre_lines�lines�gpg_post_lines�state�accept_empty_or_whitespace�
first_liner�r��
is_empty_lines           r$rzDeb822._split_gpg_and_payloadYs�����F��
�������&,�Z�Z�0Q�SW�%X�"��
��)	4�D��:�:�g�&�D���t�|�|�~��"�
�-1�_�_�T�-B��
�
�#�#�D�)��A�;U��H�6�����^b�Zb�M���G�#�(����T�*�,�"��/�/�$� '��%�,�,�T�2��l�*�"�)�)�$�/��7�7�8�$��0��G�G�F�O�E��W�W�X�&�&�0�"�)�)�$�/��$� �%�,�,�T�2�&�-�-�d�3�S)	4�V�!�5�.�9�9��8�9�9r'c�,�|j||�dS)NrZ)r)r�r�r�s   r$r�zDeb822._gpg_stripped_paragraph�s���)�)�(�F�;�A�>�>r'c��t|d�std��|j�&tj	|j
|��|_|jS)aReturn a GpgInfo object with GPG signature information

        This method will raise ValueError if the signature is not available
        (e.g. the original text cannot be found).

        :param keyrings: list of keyrings to use (see GpgInfo.from_sequence)
        �raw_textzoriginal text cannot be found)�keyrings)rorqr��GpgInfo�
from_sequencer.)rJr/s  r$�get_gpg_infozDeb822.get_gpg_info�sS���t�Z�(��<�=�=��=�=� �$�1�1�$�-�-�;C�2�E�D�M��}�}�r'c���d|vry|jd�rtd��t|j��D]6\}}|dk(r�|std��|dj	�r�-td��y)z�Raise ValueError if value is not a valid value for key

        Subclasses that do interesting things for different keys may wish to
        override this method.
        r[Nzvalue must not end in '\n'rzvalue must not have blank linesz$each line must start with whitespace)�endswithrq�	enumerater�r�)rJrSr�nor�s     r$�validate_inputzDeb822.validate_input�s����u����>�>�$���:�;�;�
"�%�"2�"2�"4�5�	I�H�B���Q�w��� �!B�C�C���7�?�?�$� �!G�H�H�
	Ir'c�V�|j||�tj|||�yr )r7rr�)rJrSrs   r$r�zDeb822.__setitem__�s$�����C��'����t�S�%�0r')NNNr�N)NFFr�N�NN�NF)NT)NNFr ),r<r=r>r?rIrrr��classmethodr��staticmethodr��	_key_part�re�compiler��_explicit_source_rer�r�r�r�r�r�r�r�r�rr�rr/�isSingleLiner�isMultiLiner�_mergeFieldsr�mergeFieldsr#rrr�r2r7r�r!r'r$r�r�]sA��,�^���!���8��:�X�6��� $�$)�',�!(�#�
M��M�b����.5�I��B�J�J�y�+M�M�N�M�
%�"�*�*�	#���!%� $�)#�V*�
*�
A���,�-���
��
����
��
����
��
�����
��
�����
��
����,�`�!��!�*�.�9�L��,��,�)��7�K�%�N*�-�8�L�
�"�H)��6�K��R�Z�Z�>�?�F��%)�O��O�.�&*�A:��A:�F�?��?��0I�:1r'r�c�z��eZdZdZdZ�fd�Zd�Zd�Zed
d��Z	e		dd��Z
ed��Zed	��Z
�xZS)r0a"A wrapper around gnupg parsable output obtained via --status-fd

    This class is really a dictionary containing parsed output from gnupg plus
    some methods to make sense of the data.
    Keys are keywords and values are arguments suitably split.
    See /usr/share/doc/gnupg/DETAILS.gz)�GOODSIG�EXPSIG�	EXPKEYSIG�	REVKEYSIG�BADSIGc�H��tt|�
|i|��d|_d|_yr )rHr0rI�out�err�rJ�args�kwargsrLs   �r$rIzGpgInfo.__init__�s%���
�g�t�%�t�6�v�6������r'c��d|vxsd|vS)zIs the signature valid?rF�VALIDSIGr!r|s r$�validz
GpgInfo.valid�s���D� �6�J�$�$6�6r'c��y)z>Return the primary ID of the signee key, None is not availableNr!r|s r$�uidzGpgInfo.uid�r&r'c��|�}t|t�r|jd�|_n||_t|t�r|jd�|_n||_d}|jD]�}|j|�s�|t
|�d}|jd�}|jd�}|d|}||jvr||dzdjdd�}n||dzdjd�}|dvr��|||<��|S)a" Create a GpgInfo object based on the gpg or gpgv output

        Create a new GpgInfo object from gpg(v) --status-fd output (out) and
        optionally collect stderr as well (err).

        Both out and err can be lines in newline-terminated sequence or
        regular strings.
        r[z	[GNUPG:] NrrZ)�NEWSI�NEWSIG�KEY_CONSIDERED�PROGRESS)
r�rzrrLrMrQrVr"r_�uidkeys)	r�rLrM�n�headerr�rcrSrs	         r$�from_outputzGpgInfo.from_outputs
��
�E���c�3���I�I�d�O�A�E��A�E��c�3���I�I�d�O�A�E��A�E����E�E�	�D��?�?�6�*����F���%�D��:�:�d�#�D��	�	�#��A��r��(�C��c�k�k�!��Q�q�S�T�
�(�(��a�0���Q�q�S�T�
�(�(��-���G�G���A�c�F�/	�0�r'c�<�|xst}|xstg}t|�}|jddg�|D]}|jd|g��d|vrt	d��tj|t
jt
jt
jd��5}t|t�r|}n|j|�}|j|�\}}	ddd�|jjd�	jd��S#1swY�9xYw)	a�Create a new GpgInfo object from the given sequence.

        :param sequence: sequence of lines of bytes or a single byte string

        :param keyrings: list of keyrings to use (default:
            ['/usr/share/keyrings/debian-keyring.gpg'])

        :param executable: list of args for subprocess.Popen, the first element
            being the gpgv executable (default: ['/usr/bin/gpgv'])
        z--status-fd�1z	--keyringz'cannot access any of the given keyringsF)�stdin�stdout�stderr�universal_newlinesNr�)�GPGV_DEFAULT_KEYRINGS�GPGV_EXECUTABLErprr�IOError�
subprocess�Popen�PIPEr�r��_get_full_bytes�communicater^r])
r�r�r/�
executablerOrv�p�inprLrMs
          r$r1zGpgInfo.from_sequence3s��$�4�4���4�O�#4�
��J������]�C�(�)��	*�A��K�K��a�(�)�	*��d�"��C�D�D�
�
�
��
���
���
���$�
�
	*���(�E�*����)�)�(�3���}�}�S�)�H�C��
	*����s�z�z�'�2�"�z�z�'�2�4�	4�
	*�
	*�s�!9D�Dc��t|�}	t|�}d}|jd�rd}||z|j	|�zS#t$rYywxYw)z�Return a byte string from a sequence of lines of bytes.

        This method detects if the sequence's lines are newline-terminated, and
        constructs the byte string appropriately.
        r'�
)r��next�
StopIterationr4r�)r��
sequence_iterr*�join_strs    r$rkzGpgInfo._get_full_bytesasc���X��
�	��m�,�J������u�%��H��H�$�x�}�}�]�'C�C�C���	��	�s�A�	A�Ac�r�t|d�5}|j|g|��i|��cddd�S#1swYyxYw)z]Create a new GpgInfo object from the given file.

        See GpgInfo.from_sequence.
        �rbN)�openr1)r��targetrOrP�target_files     r$�	from_filezGpgInfo.from_filetsC���&�$�
�	C�;�$�3�$�$�[�B�4�B�6�B�	C�	C�	C�s�-�6r r9)r<r=r>r?r[rIrSrUr;r^r1r<rkr{rfrgs@r$r0r0�s~���+�H�G��7�M��0��0�d� $�!%�+4��+4�Z�D��D�$�C��Cr'r0c��eZdZdZej
d�Zej
d�Zej
d�Zej
d�Z	ej
d�Z
ej
d�Zejdd	d
g�Zejdd	dg�Zer)ed
eeeeeeefeedeeedd��Zed��Zed��Zy)�PkgRelationz�Inter-package relationships

    Structured representation of the relationships of a package to another,
    i.e. of what can appear in a Deb882 field like Depends, Recommends,
    Suggests, ... (see Debian Policy 7.1).
    z�^\s*(?P<name>[a-zA-Z0-9][a-zA-Z0-9.+\-]*)(:(?P<archqual>([a-zA-Z0-9][a-zA-Z0-9-]*)))?(\s*\(\s*(?P<relop>[>=<]+)\s*(?P<version>[0-9a-zA-Z:\-+~.]+)\s*\))?(\s*\[(?P<archs>[\s!\w\-]+)\])?\s*((?P<restrictions><.+>))?\s*$z\s*,\s*z\s*\|\s*z\s+z>\s*<z#(?P<enabled>\!)?(?P<profile>[^\s]+)�ArchRestriction�enabled�arch�BuildRestriction�profile�ParsedRelationzPkgRelation.ArchRestrictionzPkgRelation.BuildRestriction��name�archqual�versionr��restrictionsc
������fd���fd�����fd�}�jj|j��}t�jj|�}|D��cgc]}|D�cgc]
}||���c}��c}}Scc}wcc}}w)z|Parse a package relationship string (i.e. the value of a field like
        Depends, Recommends, Build-Depends ...)
        c����g}�jj|j��D]3}|ddk(}|r|dd}|j�j	||���5|S)Nr�!rZ)�_PkgRelation__blank_sep_RErr"r$r~)�raw�archsr��disabledr�s    �r$�parse_archsz0PkgRelation.parse_relations.<locals>.parse_archs�so����E��*�*�0�0�����=�
F����7�c�>������8�D����S�0�0�X��t�D�E�	
F�
�Lr'c	���g}�jj|j�jd��}|D]�}g}�jj|�D]Z}�j
j
|�}|s�!|j�}|j�j|ddk7|d���\|j|���|S)aZ split a restriction formula into a list of restriction lists

            Each term in the restriction list is a namedtuple of form:

                (enabled, label)

            where
                enabled: bool: whether the restriction is positive or negative
                profile: the profile name of the term e.g. 'stage1'
            z<> rr�r�)
� _PkgRelation__restriction_sep_REr�lowerr"r��_PkgRelation__restriction_REr��	groupdictr$r�)	r�r��groups�rgrpr��restrictionr��partsr�s	        �r$�parse_restrictionsz7PkgRelation.parse_relations.<locals>.parse_restrictions�s�����L��-�-�3�3�C�I�I�K�4E�4E�e�4L�M�F��
+����#&�#5�#5�#;�#;�D�#A��K��0�0�6�6�{�C�E�� %��� 1������0�0� %�i� 0�C� 7� %�i� 0���	��#�#�E�*�
+� �r'c�4���jj|�}|r]|j�}|d|ddddd�}|ds|dr
|d|df|d<|dr�|d�|d<|dr�|d�|d<|Stj	d	|�|ddddd�S)
Nr�r�r��relopr�r�r�r�z8cannot parse package relationship "%s", returning it raw)�_PkgRelation__dep_REr�r��logger�warning)r�r�r�r�r�r�r�s    ���r$�	parse_relz.PkgRelation.parse_relations.<locals>.parse_rel�s�����L�L�&�&�s�+�E�����)��!�&�M� %�j� 1�#� �$(�����>�U�9�%5�$)�'�N�E�)�4D�#E�A�i�L���>� +�E�'�N� ;�A�f�I���(�(:��n�-�)/�A�n�%����N�N�7�8;�
=�� ��� $��
r')�_PkgRelation__comma_sep_RErr"�map�_PkgRelation__pipe_sep_RE)	r�r�r��tl_deps�cnf�or_deps�or_depr�r�s	`      @@r$�parse_relationszPkgRelation.parse_relations�sp���		�	 �8	�@�$�$�*�*�3�9�9�;�7���#�#�#�)�)�7�3��IL�M�g��9�v��6�"�9�M�M��9��Ms�#	B	�,B�;B	�B	c�\����d��d����fd��djt�fd�|��S)z�Format to string structured inter-package relationships

        Perform the inverse operation of parse_relations, returning a string
        suitable to be written in a package stanza.
        c�>�|jrdnd�|j��S)Nr�r�)rr�)�	arch_specs r$�pp_archz PkgRelation.str.<locals>.pp_archs%�� �'�'��S�0�����
r'c��g}|D]/}|j|jrdnd�|j����1ddj|�zS)Nr�r�z<%s>r)r$rr�r�)r�rc�terms   r$�pp_restrictionsz(PkgRelation.str.<locals>.pp_restrictionssQ���A�$�
�����"�l�l���3������
��C�H�H�Q�K�'�'r'c�P��|d}|jd��|d|dzz
}|jd�}|�|d|zz
}|jd�}|�!|ddjt�|��zz
}|jd	�}|�!|d
djt�|��zz
}|S)Nr�r�z:%sr�z (%s %s)r�z [%s]rr�� %s)r!r�r�)�deprcr*�a�rr�r�s     ��r$�
pp_atomic_depz&PkgRelation.str.<locals>.pp_atomic_deps�����F��A��w�w�z�"�.��U�S��_�,�,�����	�"�A��}��Z�!�^�#�������A��}��W�s�x�x��G�Q��8�8�8������'�A��}��U�S�X�X�c�/�1�&=�>�>�>���Hr'r�c�:��djt�|��S)Nz | �r�r�)�depsr�s �r$r%z!PkgRelation.str.<locals>.<lambda>+s���U�Z�Z��M�4�(@�A�r'r�)�relsr�r�r�s @@@r$rzzPkgRelation.str�s2���	�
	(�	�&�y�y��A�4�H�J�	Jr'N)r<r=r>r?r>r?r�r�r�r�r�r��collections�
namedtupler~r�rrrzrrrr�r;r�r<r!r'r$r}r}s7����r�z�z�	
��H� �R�Z�Z�
�+�N��B�J�J�{�+�M��R�Z�Z��'�N�%�2�:�:�h�/��!�r�z�z�	� ��-�k�,�,�->�.7��-@�B�O�-�{�-�-�.@�/8�)�.D�F���"���$�S�M�#�E�#�s�(�O�4� ��&C�!D�E� (��d�3Q�.R�)S� T�
�	
���NN��NN�`�.J��.Jr'r}c��eZdZdZd�Zy)�_lowercase_dictz4Dictionary wrapper which lowercase keys upon lookup.c�J�tj||j��Sr )�dictrer�rRs  r$rez_lowercase_dict.__getitem__7s������c�i�i�k�2�2r'N)r<r=r>r?rer!r'r$r�r�4s
��>�3r'r�c��eZdZd�Zd�Zy)�_HasVersionFieldProtocolc��yr r!)rJrcs  r$rez$_HasVersionFieldProtocol.__getitem__?���r'c��yr r!)rJrcr*s   r$r�z$_HasVersionFieldProtocol.__setitem__Cr�r'N)r<r=r>rer�r!r'r$r�r�=s��	�	r'r�c��eZdZdZd�Zd�Zy)�_VersionAccessorMixinz>Give access to Version keys as debian_support.Version objects.c�F�tjj|d�S�N�Version)�debian�debian_supportr�r|s r$�get_versionz!_VersionAccessorMixin.get_versionJs���$�$�,�,�T�)�_�=�=r'c� �t|�|d<yr�r�)rJr�s  r$�set_versionz!_VersionAccessorMixin.set_versionNs���g�,��Y�r'N)r<r=r>r?r�r�r!r'r$r�r�Hs��H�>�'r'r�c�*�eZdZdZgZd�Zed��Zy)�_PkgRelationMixina�Package relationship mixin

    Inheriting from this mixin you can extend a :class:`Deb822` object with
    attributes letting you access inter-package relationship in a structured
    way, rather than as strings.
    For example, while you can usually use ``pkg['depends']`` to
    obtain the Depends string of package pkg, mixing in with this class you
    gain pkg.depends to access Depends as a Pkgrel instance

    To use, subclass _PkgRelationMixin from a class with a _relationship_fields
    attribute. It should be a list of field names for which structured access
    is desired; for each of them a method wild be added to the inherited class.
    The method name will be the lowercase version of field name; '-' will be
    mangled as '_'. The method would return relationships in the same format of
    the PkgRelation' relations property.

    See Packages and Sources as examples.
    c��ti�|_d|_|jD]5}|j	�}||vrd|j|<�'g|j|<�7yr:)r��_PkgRelationMixin__relations�#_PkgRelationMixin__parsed_relations�_relationship_fieldsr�)rJrOrPr��keynames     r$rIz_PkgRelationMixin.__init__isd��
+�2�.���"'����-�-�	/�D��j�j�l�G��t�|�,0�� � ��)�-/�� � ��)�	/r'c�����jsZt�fd��jj��}|D]'}tj�|��j|<�)d�_�jS)a�Return a dictionary of inter-package relationships among the current
        and other packages.

        Dictionary keys depend on the package kind. Binary packages have keys
        like 'depends', 'recommends', ... while source packages have keys like
        'build-depends', 'build-depends-indep' and so on. See the Debian policy
        for the comprehensive field list.

        Dictionary values are package relationships returned as lists of lists
        of dictionaries (see below for some examples).

        The encoding of package relationships is as follows:

        - the top-level lists corresponds to the comma-separated list of
          :class:`Deb822`, their components form a conjunction, i.e. they
          have to be AND-ed together
        - the inner lists corresponds to the pipe-separated list of
          :class:`Deb822`,
          their components form a disjunction, i.e. they have to be OR-ed
          together
        - member of the inner lists are dictionaries with the following keys:

          ``name``
            package (or virtual package) name
          ``version``
            A pair <`operator`, `version`> if the relationship is
            versioned, None otherwise. operator is one of ``<<``,
            ``<=``, ``=``, ``>=``, ``>>``; version is the given version as
            a string.
          ``arch``
            A list of pairs <`enabled`, `arch`> if the
            relationship is architecture specific, None otherwise.
            Enabled is a boolean (``False`` if the architecture is
            negated with ``!``, ``True`` otherwise), arch the
            Debian architecture name as a string.
          ``restrictions``
            A list of lists of tuples <`enabled`, `profile`>
            if there is a restriction formula defined, ``None``
            otherwise. Each list of tuples represents a restriction
            list while each tuple represents an individual term
            within the restriction list. Enabled is a boolean
            (``False`` if the restriction is negated with ``!``,
            ``True`` otherwise). The profile is the name of the
            build restriction.
            https://wiki.debian.org/BuildProfileSpec

          The arch and restrictions tuples are available as named tuples so
          elements are available as `term[0]` or alternatively as
          `term.enabled` (and so forth).

        Examples:

        ``"emacs | emacsen, make, debianutils (>= 1.7)"``
        becomes::

          [
            [ {'name': 'emacs'}, {'name': 'emacsen'} ],
            [ {'name': 'make'} ],
            [ {'name': 'debianutils', 'version': ('>=', '1.7')} ]
          ]

        ``"tcl8.4-dev, procps [!hurd-i386]"``
        becomes::

          [
            [ {'name': 'tcl8.4-dev'} ],
            [ {'name': 'procps', 'arch': (false, 'hurd-i386')} ]
          ]

        ``"texlive <!cross>"``
        becomes::

          [
            [ {'name': 'texlive', 'restriction': [[(false, 'cross')]]} ]
          ]
        c�&���j|duSr )r�)r\rJs �r$r%z-_PkgRelationMixin.relations.<locals>.<lambda>�s����)9�)9�!�)<��)D�r'T)r��filterr�rPr}r�)rJ�	lazy_relsr\s`  r$�	relationsz_PkgRelationMixin.relations�st���^�&�&��D�#�/�/�4�4�6�8�I��
K��&1�&A�&A�$�q�'�&J�� � ��#�
K�'+�D�#����r'N)r<r=r>r?r�rI�propertyr�r!r'r$r�r�Ts*���$��/�.�U ��U r'r�c�2��eZdZdZiZd�Z�fd�Zd�Z�xZS)�_multivaluedaUA class with (R/W) support for multivalued fields.

    To use, create a subclass with a _multivalued_fields attribute.  It should
    be a dictionary with *lower-case* keys, with lists of human-readable
    identifiers of the fields as the values.
    Please see :class:`Dsc`, :class:`Changes`, and :class:`PdiffIndex`
    as examples.
    c��tj|g|��i|��|jj�D]�\}}	||}|j|�rg||<||j}nt�||<||j}td|j��D]+}|tt||j�����-��y#t$rY��wxYwr )
r�rI�_multivalued_fieldsrjr^rr$r�updater�r��zipr)rJrOrPr�r��contents�updater_methodr�s        r$rIz_multivalued.__init__�s�������.�t�.�v�.�!�5�5�;�;�=�	F�M�E�6�
���;���!�!�(�+� ��U��!%�e��!3�!3��(�l��U��!%�e��!3�!3���t�X�%8�%8�%:�;�
F���z�#�f�d�j�j�l�*C�D�E�
F�	F���
��
�s�C
�
	C�Cc�h��|j�|jvrytt|�||�yr )r�r�rHr�r7)rJrSrrLs   �r$r7z_multivalued.validate_input�s-����9�9�;�$�2�2�2�

��,��4�S�%�@r'c��|j�}||jvr�tj�}t	||d�r||g}n|jd�||}|j|}i}	|j}|D]k}|D]S}t||�}		|||}
|
t|	�z
dz|	z}d|vrtd|z��|jd|z��U|jd��m|j�jd�Stj||�S#t$rY��wxYw#t$r|	}Y��wxYw)NrPr[rz5'\n' not allowed in component of multivalued field %sr�)r�r�r3�StringIOror��_fixed_field_lengthsr2rzrVr^rq�getvaluerar�r�)rJrS�keylr��array�order�
field_lengthsr
r��	raw_value�lengthrs            r$r�z_multivalued.get_as_stringsk���y�y�{���4�+�+�+�����B��t�C�y�&�)��c����������S�	���,�,�T�2�E��M�
� $� 9� 9�
��

���,�A� #�D��G��I�L�!.�t�!4�Q�!7��"(�#�i�.�!8�C� ?�)� K���u�}�(�*@�BE�*F�G�G��H�H�U�U�]�+�,������

��;�;�=�'�'��-�-��#�#�D�#�.�.��%"�
��
��$�*� )��*�s$�1D"�D1�"	D.�-D.�1D?�>D?)	r<r=r>r?r�rIr7r�rfrgs@r$r�r��s!������F�(	A�!/r'r�c�&�eZdZdZd�Zed��Zy)�_gpg_multivalueda�A _multivalued class that can support gpg signed objects

    This class's feature is that it stores the raw text before parsing so that
    gpg can verify the signature.  Use it just like you would use the
    _multivalued class.

    This class only stores raw text if it is given a raw string, or if it
    detects a gpg signature when given a file or sequence of lines (see
    Deb822.split_gpg_and_payload for details).
    c����
�d�_	|d}|jdd�}|��^t|dd�xs|jdd�xsd�
t	|t
�r	|�_�n t	|t�r|j�
��_n�t|d�rn�	�j�
�fd�|D�|�\}}}|r�|r�tj�}|jdj|��|jd	�|jdj|��|jd	�|jdj|��|j��_	t!|�}	||	d<t#|	�}t%j&�g|��i|��y#t$r|jdd�}Y���wxYw#t$r
gx}x}}Y��wxYw#t$r||d<Y�bwxYw)
Nrr�r�rnr�rjc3�B�K�|]}�j|�����y�wr )�_bytes)rrcrnrJs  ��r$rz,_gpg_multivalued.__init__.<locals>.<genexpr>Qs�����H�!�T�[�[��H�5�H�s�rqs

)r.�
IndexErrorr!�getattrr�r�rzr�rorr�r3�BytesIOr�r�r�rp�tupler�rI)rJrOrPr�r�r%r&r'r.�argslrns`         @r$rIz_gpg_multivalued.__init__3s������
�	4��A�w�H����H�d�+���� ��*�d�;�F�!�:�:�j�'�:�F�>E�
��(�E�*� (��
��H�c�*� (���� 9��
���7�+��@��2�2�H�x�H�"�$�9�M�5�.�!�^�!�z�z�|�H��N�N�5�:�:�m�#<�=��N�N�7�+��N�N�5�:�:�e�#4�5��N�N�7�+��N�N�5�:�:�n�#=�>�$,�$5�$5�$7�D�M�/� ��J�E�$�E�!�H� ��<�D�	���d�4�T�4�V�4��[�	4��z�z�*�d�3�H�	4��6 �@�=?�?�M�?�E�N�@��"�/�).�F�:�&�/�s5�F� F?�(G�F<�;F<�?G�G�G&�%G&c��t|t�r|St|t�r|j|�St	dt|�z��)ztConverts s to bytes if necessary, using encoding.

        If s is already bytes type, returns it directly.
        z(bytes or unicode/string required, not %s)r�r�rzr��	TypeError�type)rcrns  r$r�z_gpg_multivalued._bytesgsA���a����H��a����8�8�H�%�%��B�T�!�W�L�M�Mr'N)r<r=r>r?rIr<r�r!r'r$r�r�'s#��	�25�h�
N��
Nr'r�c�.�eZdZdZgd�gd�gd�gd�d�Zy)�Dscz� Representation of a .dsc (Debian Source Control) file

    This class is a thin wrapper around the transparent GPG handling
    of :class:`_gpg_multivalued` and the parsing of :class:`Deb822`.
    ��md5sum�sizer���sha1rr���sha256rr���sha512rr���files�checksums-sha1�checksums-sha256�checksums-sha512N)r<r=r>r?r�r!r'r$r�r�us���,�2�6�6�	�r'r�c�4�eZdZdZgd�gd�gd�gd�d�Zd�Zy)	�Changesz� Representation of a .changes (archive changes) file

    This class is a thin wrapper around the transparent GPG handling
    of :class:`_gpg_multivalued` and the parsing of :class:`Deb822`.
    )r�rrK�priorityr�rrrrc���|ddd}	|jd�\}}|djd�r	|ddd	}n|dd}d
|�d|�d|d��S#t$rd}Y�@wxYw)z>Return the path in the pool where the files would be installedrrrK�/�main�source�libN�zpool/)rrqrQ)rJrcrK�_�subdirs     r$�
get_pool_pathzChanges.get_pool_path�s���
��M�!��Y�'��	������J�G�Q�
��>�$�$�U�+��(�^�B�Q�'�F��(�^�A�&�F��")�6�4��>�B�B���	��G�	�s�A�A"�!A"N)r<r=r>r?r�rr!r'r$r
r
�s$���C�2�6�6�	��Cr'r
c��eZdZdZgd�gd�gd�gd�d�ZdgZd�Zd	�Zd
�Zd�Z	d�Z
d
�Zd�Zd�Z
d�Zd�Zd�ZGd�d�Zed��Zy)�	BuildInfoaW Representation of a .buildinfo (build environment description) file

    This class is a thin wrapper around the transparent GPG handling
    of :class:`_gpg_multivalued`, the field parsing of
    :class:`_PkgRelationMixin`,
    and the format parsing of :class:`Deb822`.

    Note that the 'relations' structure returned by the `relations` method
    is identical to that produced by other classes in this module.
    Consequently, existing code to consume this structure can be used here,
    although it means that there are redundant lists and tuples within the
    structure.

    Example::

        >>> from debian.deb822 import BuildInfo
        >>> filename = 'package.buildinfo'
        >>> with open(filename) as fh:    # doctest: +SKIP
        ...     info = BuildInfo(fh)
        >>> print(info.get_environment())    # doctest: +SKIP
        {'DEB_BUILD_OPTIONS': 'parallel=4',
        'LANG': 'en_AU.UTF-8',
        'LC_ALL': 'C.UTF-8',
        'LC_TIME': 'en_GB.UTF-8',
        'LD_LIBRARY_PATH': '/usr/lib/libeatmydata',
        'SOURCE_DATE_EPOCH': '1601784586'}
        >>> installed = info.relations['installed-build-depends']  # doctest: +SKIP
        >>> for dep in installed:  # doctest: +SKIP
        ...     print("Installed %s/%s" % (dep[0]['name'], dep[0]['version'][1]))
        Installed autoconf/2.69-11.1
        Installed automake/1:1.16.2-4
        Installed autopoint/0.19.8.1-10
        Installed autotools-dev/20180224.1
        ... etc ...
        >>> changelog = info.get_changelog() # doctest: +SKIP
        >>> print(changelog.author) # doctest: +SKIP
        'xyz Build Daemon (xyz-01) <buildd_xyz-01@buildd.debian.org>'
        >>> print(changelog[0].changes()) # doctest: +SKIP
        ['',
        '  * Binary-only non-maintainer upload for amd64; no source changes.',
        '  * Add Python 3.9 as supported version',
        '']
    )�md5rr�rrr)z
checksums-md5r	r
rzinstalled-build-dependsc�h�tj|g|��i|��tj|g|��i|��yr )r�rIr��rJrOrPs   r$rIzBuildInfo.__init__�s2���!�!�$�8��8��8��"�"�4�9�$�9�&�9r'c��||vrtdj|���t||jdd�j	�j��S)Nz'{}' not found in buildinfor[r�)r^�formatrp�replacer"rr�s  r$�_get_array_valuezBuildInfo._get_array_value�sO������8�?�?��F�G�G��D��K�'�'��b�1�7�7�9�?�?�A�B�Br'c�^�ttj|jdd���S)z�Return the build environment that was recorded

        The environment is returned as a dict in the style of `os.environ`.
        The backslash quoting of values described in deb-buildinfo(5) is
        removed.
        �Environmentr�)r�r�_env_deserialiser!r|s r$�get_environmentzBuildInfo.get_environment�s%���I�.�.�t�x�x�
�r�/J�K�L�Lr'c��d|vry|dj�}|D�cgc]}|dk(rdn|dd��}}tjj|�Scc}w)z�Return the changelog entry from the buildinfo (for binNMUs)

        If no "Binary-Only-Changes" field is present in the buildinfo file
        then `None` is returned.
        zBinary-Only-ChangesNz .r�rZ)r�r��	changelog�	Changelog)rJ�chlinesrcs   r$�
get_changelogzBuildInfo.get_changelog�sf��!��,���,�-�8�8�:��7>�?�!��d��2��!�"��-�?��?����)�)�'�2�2��@s�Ac��d|vrtd��|jj|d�}|std��|j	d�|j	d�fS)Nrz%'Source' field not found in buildinfoz Invalid 'Source' field specifiedr�)r^r@r�rqr��rJ�matchess  r$�
get_sourcezBuildInfo.get_sources\���4���B�C�C��*�*�0�0��h��@����?�@�@��}�}�X�&��
�
�i�(@�@�@r'c�$�|jd�S)N�Binary�r r|s r$�
get_binaryzBuildInfo.get_binarys���$�$�X�.�.r'c��d|vrtd��tjj|d�}|�t	d��tjj|�}tjj|�S)Nz
build-datez)'Build-Date' field not found in buildinfoz$Invalid 'Build-Date' field specified)r^�email�utils�parsedate_tzrq�	mktime_tz�datetime�
fromtimestamp�rJ�	timearray�tss   r$�get_build_datezBuildInfo.get_build_datesl���t�#��F�G�G��K�K�,�,�T�,�-?�@�	����C�D�D�
�[�[�
"�
"�9�
-��� � �.�.�r�2�2r'c�$�|jd�S)N�Architecturer0r|s r$�get_architecturezBuildInfo.get_architectures���$�$�^�4�4r'c�l�|j�D�cgc]	}|dk(r|��}}t|�dk(Scc}w)NrrZ�r?rV�rJr��archess   r$�is_build_sourcezBuildInfo.is_build_source#sC��#'�#8�#8�#:�'�4��X�%��'��'��6�{�a����'s�1c�&�d|j�vS)N�all)r?r|s r$�is_build_arch_allzBuildInfo.is_build_arch_all)s����-�-�/�/�/r'c�j�|j�D�cgc]}|dvr|��
}}t|�dk(Scc}w)N)rFrrZrArBs   r$�is_build_arch_anyzBuildInfo.is_build_arch_any-sD��#'�#8�#8�#:�4�4��!2�2��4��4��6�{�a����4s�
0c� �eZdZdZdZdZdZdZy)�BuildInfo._EnvParserStaterrZ��rN)r<r=r>�IGNORE_WHITESPACE�VAR_NAME�START_VALUE_QUOTE�VALUE�VALUE_BACKSLASH_ESCAPEr!r'r$�_EnvParserStaterK3s����������!"�r'rSc#� K�tjj}d}d}|D�]�}|tjjk(r-|j�stjj}|}�N|tjjk(r(|dk7r||z
}ntjj
}d}��|tjj
k(r,|dk(rtjj}ntd����|tjjk(rr|dk(rtjj}nP|dk(rB|dk(rtd��|�td��||f��tjj}d}d}n	|�J�||z
}��k|tjjk(s���|dk(r$|�J�||z
}tjj}ntd	�����|tjjk7rtd
�yy�w)a� extract the environment variables and values from the text

        Format is:
            VAR_NAME="value"

        with ignorable whitespace around the construct (and separating each
        item). Quote characters within the value are backslash escaped.

        When producing the buildinfo file, dpkg only includes specifically
        allowed environment variables and thus there is no defined quoting
        rules for the variable names.

        The format is described by deb-buildinfo(5) and implemented in
        dpkg source scripts/dpkg-genbuildinfo.pl:cleansed_environment(),
        while the environment variables that are included in the output are
        listed in dpkg source scripts/Dpkg/Build/Info.pm
        r�N�=�"z6Improper quoting in Environment: begin quote not found�\z;Improper formatting in Environment: variable name not foundz<Improper formatting in Environment: variable value not foundzIImproper formatting in Environment: couldn't interpret backslash sequencez4Improper quoting in Environment: end quote not found)	rrSrNr�rOrPrQrqrR)�
serialisedr(r�r�chs     r$r#zBuildInfo._env_deserialise;s����,�)�)�;�;�������<	�B��	�1�1�C�C�C��z�z�|�%�5�5�>�>�E��D���	�1�1�:�:�:���9��B�J�D�%�5�5�G�G�E��E���	�1�1�C�C�C���9�%�5�5�;�;�E�$�0�����	�1�1�7�7�7���:�%�5�5�L�L�E��3�Y��r�z�(�6����}�(�7���
��+�%�%�5�5�G�G�E��D� �E� �,�,�,��R�K�E���	�1�1�H�H�H���9� �,�,�,��R�K�E�%�5�5�;�;�E�$�@����y<	�|�I�-�-�?�?�?��&�
�@�s
�F)H�-A!HN)r<r=r>r?r�r�rIr r$r)r-r1r<r?rDrGrIrSr<r#r!r'r$rr�s���*�X1�2�6�6�	��	"���:�
C�M�3� A�/�3�5� �0� �#�#��[��[r'rc��eZdZdZddggd�gd�gd�gd�gd�gd�ddggd�gd�gd�gd�gd�gd�d	�Zed
��Zd�Zy)
�
PdiffIndexz� Representation of a foo.diff/Index file from a Debian mirror

    This class is a thin wrapper around the transparent GPG handling
    of :class:`_gpg_multivalued` and the parsing of :class:`Deb822`.
    �SHA1r)r\r�date)r\r�filename�SHA256)r_rr])r_rr^)zsha1-currentzsha1-historyzsha1-patchesz
sha1-downloadzx-unmerged-sha1-historyzx-unmerged-sha1-patcheszx-unmerged-sha1-downloadzsha256-currentzsha256-historyzsha256-patcheszsha256-downloadzx-unmerged-sha256-historyzx-unmerged-sha256-patcheszx-unmerged-sha256-downloadc�|�i}|jD]*}t||d�r�|j|�}d|i||<�,|S)NrPr)r�ro�_get_size_field_length�rJ�fixed_field_lengthsrSr�s    r$r�zPdiffIndex._fixed_field_lengths�sZ��!���+�+�	8�C��t�C�y�&�)���0�0��5�F�(.��'7���$�
	8�#�"r'c	�p�||D�cgc]}tt|d����}}t|�Scc}w�Nr)rVrz�max�rJrSr
�lengthss    r$raz!PdiffIndex._get_size_field_length�s7��6:�3�i�@�d�3�s�4��<�(�)�@��@��7�|���As�3N)r<r=r>r?r�r�r�rar!r'r$r[r[�s^��� ��(�0�0�5�#;�#;�$@�#�V�,�4�4�9�%?�%?�&D���"�
#��
#�r'r[c�b�eZdZdZgd�gd�gd�gd�d�ZdZd�Zed	�e�Zed
��Z	d�Z
y)
�Releasea9Represents a Release file

    Set the size_field_behavior attribute to "dak" to make the size field
    length only as long as the longest actual value.  The default,
    "apt-ftparchive" makes the field 16 characters long regardless.

    This class is a thin wrapper around the parsing of :class:`Deb822`.
    r�rrr)r�rrr�apt-ftparchivec�0�|dvrtd��||_y)N)rk�dakz<size_field_behavior must be either 'apt-ftparchive' or 'dak')rq�_Release__size_field_behavior�rJrs  r$�set_size_field_behaviorzRelease.set_size_field_behavior�s'���1�1��9�:�
:�&+��"r'c��|jSr )rnr|s r$r%zRelease.<lambda>�s���0J�0J�r'c�\�i}|jD]}|j|�}d|i||<�|Sre)r�rarbs    r$r�zRelease._fixed_field_lengths�sG��!���+�+�	8�C��0�0��5�F�(.��'7���$�	8�#�"r'c	���|jdk(ry|jdk(r2||D�cgc]}tt|d����}}t|�St	d��cc}w)Nrk�rmrz%Illegal value for size_field_behavior)�size_field_behaviorrVrzrfrqrgs    r$razRelease._get_size_field_length�sc���#�#�'7�7���#�#�u�,�:>�s�)�D�$�s�3�t�F�|�,�-�D�G�D��w�<���@�A�A��Es�AN)r<r=r>r?r�rnrpr�rur�rar!r'r$rjrj�sW���-�(�,�,�	��-��+�#�#J�#:�<���#��#�Br'rjc�F��eZdZdZgd�Zd�Ze					d�fd�	�Z�xZS)�Sourcesz�Represent an APT source package list

    This class is a thin wrapper around the parsing of :class:`Deb822`,
    using the field parsing of :class:`_PkgRelationMixin`.
    )z
build-dependszbuild-depends-indepzbuild-depends-archzbuild-conflictszbuild-conflicts-indepzbuild-conflicts-arch�binaryc�h�tj|g|��i|��tj|g|��i|��yr )r�rIr�rs   r$rIzSources.__init__	s0�����T�+�D�+�F�+��"�"�4�9�$�9�&�9r'c�@��|sddi}tt|�||||||�S)a	Generator that yields a Deb822 object for each paragraph in Sources.

        Note that this overloaded form of the generator uses apt_pkg (a strict
        but fast parser) by default.

        See the :func:`~Deb822.iter_paragraphs` function for details.
        rF)rHrwr��r�r�r�r�r�rnr�rLs       �r$r�zSources.iter_paragraphs	s9���"�1�5��F��W�c�2��f�k�>�8�V�M�	Mr'�NTFr�N)	r<r=r>r?r�rIr;r�rfrgs@r$rwrw�s<����
��:�
� $�$(�',�!(�#�
M��Mr'rwc�f��eZdZdZgd�Zd�Ze					d�fd�	�Zed��Z	ed��Z
�xZS)�Packagesz�Represent an APT binary package list

    This class is a thin wrapper around the parsing of :class:`Deb822`,
    using the field parsing of :class:`_PkgRelationMixin`.
    )
�dependszpre-depends�
recommends�suggests�breaks�	conflicts�provides�replaces�enhanceszbuilt-usingc�h�tj|g|��i|��tj|g|��i|��yr )r�rIr�rs   r$rIzPackages.__init__-	s0������.�t�.�v�.��"�"�4�9�$�9�&�9r'c�@��|sddi}tt|�||||||�S)a
Generator that yields a Deb822 object for each paragraph in Packages.

        Note that this overloaded form of the generator uses apt_pkg (a strict
        but fast parser) by default.

        See the :func:`~Deb822.iter_paragraphs` function for details.
        rF)rHr~r�r{s       �r$r�zPackages.iter_paragraphs2	s9���"�1�5��F��X�s�3��f�k�>�8�V�M�	Mr'c�x�d|vr|dS|jj|d�}|r|jd�Sy)�� source package that generates the binary package

        If the source package and source package version are the same as the
        binary package, an explicit "Source" field will not be within the
        paragraph.
        r�packageN)r@r�r�r+s  r$rzPackages.sourceJ	sE���4���	�?�"��*�*�0�0��h��@����=�=��*�*�r'c��d|vr|j�S|jj|d�}|r#|jd�r|jd�}n|d}tj
j
|�S)r�rr�r�)r�r@r�r�r�r�r�)rJr,r�s   r$�source_versionzPackages.source_version[	sq���4���#�#�%�%��*�*�0�0��h��@���w�}�}�Y�/��m�m�I�.�G��9�o�G��$�$�,�,�W�5�5r'r|)r<r=r>r?r�rIr;r�r�rr�rfrgs@r$r~r~!	sd����
��:�
� $�$(�',�!(�#�
M��M�.���� �6��6r'r~c�*��eZdZdZ			d�fd�	Z�xZS)�RestrictedFieldz�Placeholder for a property providing access to a restricted field.

    Use this as an attribute when defining a subclass of RestrictedWrapper.
    It will be replaced with a property.  See the RestrictedWrapper
    documentation for an example.
    c�4��tt|�|||||��S)a�Create a new RestrictedField placeholder.

        The getter that will replace this returns (or applies the given to_str
        function to) None for fields that do not exist in the underlying data
        object.

        :param name: The name of the deb822 field.
        :param from_str: The function to apply for getters (default is to
            return the string directly).
        :param to_str: The function to apply for setters (default is to use the
            value directly).  If allow_none is True, this function may return
            None, in which case the underlying key is deleted.
        :param allow_none: Whether it is allowed to set the value to None
            (which results in the underlying key being deleted).
        )�from_str�to_str�
allow_none)rHr��__new__)r�r�r�r�r�rLs     �r$r�zRestrictedField.__new__x	s*���,�_�c�2�����!�3�#�	#r')NNT)r<r=r>r?r�rfrgs@r$r�r�o	s�������	#�#r'r�zname from_str to_str allow_nonec����eZdZdZej
d�Zej
d�Z�fd�Ze	d��Z
e	d��Ze	d��Ze	d��Z
e	d	��Ze	d
��Z�xZS)�Removalsa6Represent an ftp-master removals.822 file

    Removal of packages from the archive are recorded by ftp-masters.
    See https://ftp-master.debian.org/#removed

    Note: this API is experimental and backwards-incompatible changes might be
    required in the future. Please use it and help us improve it!
    z*\s*(?P<package>.+?)_(?P<version>[^\s]+)\s*z;\s*(?P<package>.+?)_(?P<version>[^\s]+)\s+\[(?P<archs>.+)\]c�H��tt|�
|i|��d|_d|_yr )rHr�rI�_sources�	_binariesrNs   �r$rIzRemovals.__init__�	s%���
�h��&��7��7���
���r'c���tjj|d�}|�td��tjj	|�}t
j
j
|�S)z* a datetime object for the removal action r]zNo date specified)r3r4r5rqr6r7r8r9s   r$r]z
Removals.date�	sY���K�K�,�,�T�&�\�:�	����0�1�1�
�[�[�
"�
"�9�
-��� � �.�.�r�2�2r'c�n�d|vrgS|djd�D�cgc]
}t|���c}Scc}w)z� list of bug numbers that had requested the package removal

        The bug numbers are returned as integers.

        Note: there is normally only one entry in this list but there may be
        more than one.
        �bug�,�r�int�rJ�bs  r$r�zRemovals.bug�	s8������I� $�U�� 1� 1�#� 6�7�1��A��7�7��7��2c�n�d|vrgS|djd�D�cgc]
}t|���c}Scc}w)zk list of WNPP bug numbers closed by the removal

        The bug numbers are returned as integers.
        z	also-wnpprr�r�s  r$�	also_wnppzRemovals.also_wnpp�	s9���d�"��I� $�[� 1� 7� 7�� <�=�1��A��=�=��=r�c�n�d|vrgS|djd�D�cgc]
}t|���c}Scc}w)z� list of bug numbers in the package closed by the removal

        The bug numbers are returned as integers.

        Removal of a package implicitly also closes all bugs associated with
        the package.
        z	also-bugsrr�r�s  r$�	also_bugszRemovals.also_bugs�	s9���d�"��I� $�[� 1� 7� 7�� <�=�1��A��=�=��=r�c� �|j�|jSg}d|vrh|dj�D]R}|jj|�}|s�!|j	|jd�|jd�d���T||_|S)a} list of source packages that were removed

        A list of dicts is returned, each dict has the form::

            {
                'source': 'some-package-name',
                'version': '1.2.3-1'
            }

        Note: There may be no source packages removed at all if the removal is
        only of a binary package. An empty list is returned in that case.
        �sourcesr�r�)rr�)r�r��_Removals__sources_line_rer�r$r�)rJrcr�r,s    r$r�zRemovals.sources�	s����=�=�$��=�=� �������Y��2�2�4�
���0�0�6�6�t�<����H�H�&-�m�m�I�&>�'.�}�}�Y�'?���
���
��r'c
�p�|j�|jSg}d|vr�|dj�D]z}|jj|�}|s�!|j	|jd�|jd�t
|jd�jd��d���|||_|S)a list of binary packages that were removed

        A list of dicts is returned, each dict has the form::

            {
                'package': 'some-package-name',
                'version': '1.2.3-1',
                'architectures': set(['i386', 'amd64'])
            }
        �binariesr�r�r�r�)r�r��
architectures)r�r��_Removals__binaries_line_rer�r$r��setr)rJr�r�r,s    r$r�zRemovals.binaries
s����>�>�%��>�>�!�������Z�(�3�3�5�
���1�1�7�7��=����H�H�#*�=�=��#;�#*�=�=��#;���
�
�g� 6� <� <�T� B�C�	��
�����r')r<r=r>r?r>r?r�r�rIr�r]r�r�r�r�r�rfrgs@r$r�r��	s�����#��
�
�	���$����	�����3��3��8��8��>��>��>��>�����<���r'r�c� �eZdZdd�Zd�Zd�Zy)rFNc��|xsd|_y)NzUTF-8)rn)rJrns  r$rIz_AutoDecoder.__init__"
s�� �+�G��
r'c�H�t|t�r|j|�S|S)z9If value is not already Unicode, decode it intelligently.)r�r�r�ros  r$r]z_AutoDecoder.decode&
s$���e�U�#��$�$�U�+�+��r'c�0�	|j|j�S#t$ro}tj	d|j�tj|�}	|j|d�}|d|_|cYd}~S#t$r|�wxYwd}~wwxYw)Nz?decoding from %s failed; attempting to detect the true encodingrn)r]rn�UnicodeDecodeErrorr�r��chardet�detect)rJr�e�result�decodeds     r$r�z_AutoDecoder.decode_bytes-
s���	��<�<��
�
�.�.��!�	�
�N�N�/�04�
�
�
?��^�^�E�*�F�
��,�,�v�j�'9�:��!'�z� 2��
����%�
���
��	�s,��	B�5B�B�;B�B
�
B�Br )r<r=r>rIr]r�r!r'r$rFrF 
s��,��r'rF)gr?�collections.abcr�r7�email.utilsr3�	functools�loggingr3r>rhr�r��typingrrrrrrr	r
rrr
rrrrrrrrrrrr��IterableInputDataTyper��Deb822ValueTyperzr��Deb822MutableMapping�builtinsr�typing_extensionsrr�ImportError�debian._utilr+r,r-r.�debian.deprecationr/�debian.debian_supportr��debian.changelogr�r�r�r2r5�	lru_cacher8�	frozensetrerf�	getLoggerr��	Exceptionr:rA�_TagSectionWrapper_base�abcrC�_Deb822Dict_baserr��_BaseGpgInfor�r0�objectr}�_lowercase_dict_baser�r�r�r�r�r�r�r
rr[rjrwr~r�r�r�rFr!r'r$�<module>r�s���N�H�����	�	����@�������2"�
�4��
�5�	�������	����
���	��M��O��C��0�1�M�)�#��*>�?����>��>�L��0��
6������O�O��M�

�����S�����
"�#K�"L�M��!��
��	�	�?�	+��;�I�;�I�5�I��+��)�o�o�5�5��,/�/�,/�^�+��"���5�5��o�!�o�h}	1�Z�}	1�@���T�#�Y��'�L��L�XC�l�XC�vlJ�&�lJ�^���S��>����3�*�3���8��'�F�'�B ��B �JK/�6�K/�\KN�|�KN�\�
�1��#C�� 5�#C�Ln� �"3�5J�n�b'��'�T0B�l�0B�f'M�c�$�'M�TK6�v�(�*?�K6�\!#�,�k�,�,��<�>�!#�FK�v�K�\�6���yG���M��"�����4���
���
��
����F	�^�$���M��s$�A3I-�:J
�-J
�	J
�
	J�J

Zerion Mini Shell 1.0