403Webshell
Server IP : 35.236.43.222  /  Your IP : 216.73.216.143
Web Server : Apache
System : Linux order-form-vm-001 5.10.0-37-cloud-amd64 #1 SMP Debian 5.10.247-1 (2025-12-11) x86_64
User : deploy ( 1002)
PHP Version : 8.1.31
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /lib/python3/dist-packages/debianbts/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/debianbts/__pycache__/debianbts.cpython-39.pyc
a

]f�_�F�@s�dZddlZddlmZddlZddlZddlmZddlZddl	Z	ddl
Z
ddlZddlm
Z
ddlmZe
�e�ZdZej�e�r�eejd<eej�ed	�kZd
ZdZdZd
Zdddddddd�ZGdd�de�Zdd�Z d:dd�Z!dd�Z"dd�Z#d d!�Z$d"d#�Z%ed$ed%d&�Z&e	j'j(dk�r^e	j'd'k�r^zdd(l)m*Z*Wne+�yTYn
0e*e&d)<d*d+�Z,d,d-�Z-d.d/�Z.d0d1�Z/d2d3�Z0d4d5�Z1d6d7�Z2d8d9�Z3dS);z�
Query Debian's Bug Tracking System (BTS).

This module provides a layer between Python and Debian's BTS. It
provides methods to query the BTS using the BTS' SOAP interface, and the
Bugreport class which represents a bugreport from the BTS.
�N)�LooseVersion)�datetime)�
SoapClient)�SimpleXMLElementz/etc/ssl/ca-debianZSSL_CERT_DIRz1.16.2z(https://bugs.debian.org/cgi-bin/soap.cgizDebbugs/SOAP/V1zhttps://bugs.debian.org/i��������)ZcriticalZgraveZseriousZ	importantZnormal�minorZwishlistc@sXeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�ZdS)�	Bugreporta�Represents a bugreport from Debian's Bug Tracking System.

    A bugreport object provides all attributes provided by the SOAP
    interface. Most of the attributes are strings, the others are
    marked.

    Attributes
    ----------

    bug_num : int
        The bugnumber
    severity : str
        Severity of the bugreport
    tags : list of strings
        Tags of the bugreport
    subject : str
        The subject/title of the bugreport
    originator : str
        Submitter of the bugreport
    mergedwith : list of ints
        List of bugnumbers this bug was merged with
    package : str
        Package of the bugreport
    source : str
        Source package of the bugreport
    date : datetime
        Date of bug creation
    log_modified : datetime
        Date of update of the bugreport
    done : boolean
        Is the bug fixed or not
    done_by : str or None
        Name and Email or None
    archived : bool
        Is the bug archived or not
    unarchived : bool
        Was the bug unarchived or not
    fixed_versions : list of strings
        List of versions, can be empty even if bug is fixed
    found_versions : list of strings
        List of version numbers where bug was found
    forwarded : str
        A URL or email address
    blocks: list of ints
        List of bugnumbers this bug blocks
    blockedby : list of int
        List of bugnumbers which block this bug
    pending : str
        Either 'pending' or 'done'
    msgid : str
        Message ID of the bugreport
    owner : str
        Who took responsibility for fixing this bug
    location : str
        Either 'db-h' or 'archive'
    affects : list of str
        List of Packagenames
    summary : str
        Arbitrary text
    cCs�d|_d|_d|_d|_d|_d|_d|_d|_d|_d|_	d|_
d|_d|_d|_
d|_d|_d|_d|_d|_d|_d|_d|_d|_d|_dS�N)�
originator�date�subject�msgid�package�tags�done�	forwarded�
mergedwith�severity�owner�found_versions�fixed_versions�blocks�	blockedby�
unarchived�summary�affects�log_modified�location�archived�bug_num�source�pending)�self�r)�5/usr/lib/python3/dist-packages/debianbts/debianbts.py�__init__ws0zBugreport.__init__cCs"d�dd�|j��D��}|dS)N�
css|]\}}d�||�VqdS)z{}: {}N)�format)�.0�key�valuer)r)r*�	<genexpr>�s�z$Bugreport.__str__.<locals>.<genexpr>)�join�__dict__�items)r(�sr)r)r*�__str__�s
�zBugreport.__str__cCs|��|��kS)a�Compare a bugreport with another.

        The more open and urgent a bug is, the greater the bug is:

            outstanding > resolved > archived

            critical > grave > serious > important > normal > minor > wishlist.

        Openness always beats urgency, eg an archived bug is *always*
        smaller than an outstanding bug.

        This sorting is useful for displaying bugreports in a list and
        sorting them in a useful way.

        ��
_get_value�r(�otherr)r)r*�__lt__�szBugreport.__lt__cCs|�|�Sr)�__gt__r9r)r)r*�__le__�szBugreport.__le__cCs|��|��kSrr7r9r)r)r*r<�szBugreport.__gt__cCs|�|�Sr)r;r9r)r)r*�__ge__�szBugreport.__ge__cCs|��|��kSrr7r9r)r)r*�__eq__�szBugreport.__eq__cCs|�|�Sr)r?r9r)r)r*�__ne__�szBugreport.__ne__cCs.|jrd}n|jrd}nd}|t|j7}|S)Nr�
�)r$r�
SEVERITIESr)r(�valr)r)r*r8�szBugreport._get_valueN)
�__name__�
__module__�__qualname__�__doc__r+r6r;r=r<r>r?r@r8r)r)r)r*r9s=!rc
Gs�t|ttf�s|g}|r,t�d�|�|�t�}g}tdt|�t	�D]d}|||t	�}t
d�}td||�|�d|�}|d��
�p�gD]}|�
�d}	|�t|	��q�qF|S)a�Returns a list of Bugreport objects.

    Given a list of bugnumbers this method returns a list of Bugreport
    objects.

    Parameters
    ----------
    nrs : int or list of ints
        The bugnumbers
    additional : int
        Deprecated! The remaining positional arguments are treated as
        bugnumbers. This is deprecated since 2.10.0, please use the
        `nrs` parameter instead.

    Returns
    -------
    bugs : list of Bugreport objects

    zdCalling get_status with bugnumbers as positional arguments is deprecated, please use a list instead.rz<get_status></get_status>Zarg0�
get_status�	s-gensym3r)�
isinstance�list�tuple�logger�warning�extend�_build_soap_client�range�len�
BATCH_SIZEr�_build_int_array_el�call�children�append�
_parse_status)
ZnrsZ
additional�soap_clientZbugs�iZslice_�	method_el�replyZbug_item_el�bug_elr)r)r*rI�s 

rIc
Gs�|durg}t|ttf�s |g}|r8t�d�|�|�td|g|�R�}|d�}i}|���d�}|r�|j	dkr�|�
�p|gD]2}t|d��}|d�}	d	d
�|	�
�p�gD�||<q~n4|�
�p�gD]&}|��}dd
�|�
�p�gD�||<q�|S)a�Get buglists by usertags.

    Parameters
    ----------
    email : str
    tags : list of strings
        If tags are given the dictionary is limited to the matching
        tags, if no tags are given all available tags are returned.
    moretags : str
        Deprecated! The remaining positional arguments are treated as
        tags. This is deprecated since 2.10.0, please use the `tags`
        parameter instead.

    Returns
    -------
    mapping : dict
        a mapping of usertag -> buglist

    NzbCalling get_getusertag with tags as positional arguments is deprecated, please use a list instead.�get_usertagrJ�xsi:typezapachens:Mapr/r0cSsg|]}t|��qSr)��int�r.�bugr)r)r*�
<listcomp>#�zget_usertag.<locals>.<listcomp>cSsg|]}t|��qSr)rarcr)r)r*re'rf)
rKrLrMrNrOrP�_soap_client_call�
attributes�getr0rW�strZget_name)
�emailrZmoretagsr]Zmap_el�mappingZ	type_attrZ
usertag_el�tagZ
buglist_elr)r)r*r_�s(

r_cCs�td|�}|d�}g}|��D]�}i}t|d��|d<t|d��|d<t|d��|d<g|d<tjjtjjd�}|�	|d�
��|�	d�
��|�	|d�
��|��|d	<|�|�q|S)
adGet Buglogs.

    A buglog is a dictionary with the following mappings:
        * "header" => string
        * "body" => string
        * "attachments" => list
        * "msg_num" => int
        * "message" => email.message.Message

    Parameters
    ----------
    nr : int
        the bugnumber

    Returns
    -------
    buglogs : list of dicts

    �get_bug_log�
soapenc:Array�header�bodyZmsg_numZattachments)�policyz

�message)
rgrW�_parse_string_elrbrkZ
feedparserZBytesFeedParserrrZSMTPZfeed�encode�closerX)Znrr]�items_elZbuglogsZ	buglog_elZbuglogZmail_parserr)r)r*rn+s$
�rncCs(td|�}|d�}dd�|��p"gD�S)aHReturns the newest bugs.

    This method can be used to query the BTS for the n newest bugs.

    Parameters
    ----------
    amount : int
        the number of desired bugs. E.g. if `amount` is 10 the method
        will return the 10 latest bugs.

    Returns
    -------
    bugs : list of int
        the bugnumbers

    �newest_bugsrocSsg|]}t|��qSr)ra�r.�item_elr)r)r*reirfznewest_bugs.<locals>.<listcomp>)rgrW)Zamountr]rwr)r)r*rxVs
rxcOs�g}|��D]\}}|�||g�qt|�dkrJt|dt�rJt|d�}|rbt�d�|�|�td�}t	|�D]<\}}dt
|�}t|ttf�r�t|||�qr|�||�qrt
�}	|	�d|�}
|
d�}dd	�|��p�gD�S)
a�Get list of bugs matching certain criteria.

    The conditions are defined by the keyword arguments.

    Arguments
    ---------
    key_value : str
        Deprecated! The positional arguments are treated as key-values.
        This is deprecated since 2.10.0, please use the `kwargs`
        parameters instead.
    kwargs :
        Possible keywords are:
            * "package": bugs for the given package
            * "submitter": bugs from the submitter
            * "maint": bugs belonging to a maintainer
            * "src": bugs belonging to a source package
            * "severity": bugs with a certain severity
            * "status": can be either "done", "forwarded", or "open"
            * "tag": see http://www.debian.org/Bugs/Developer#tags for
               available tags
            * "owner": bugs which are assigned to `owner`
            * "bugs": takes single int or list of bugnumbers, filters the list
               according to given criteria
            * "correspondent": bugs where `correspondent` has sent a mail to
            * "archive": takes a string: "0" (unarchived), "1"
              (archived) or "both" (un- and archived). if omitted, only
              returns un-archived bugs.

    Returns
    -------
    bugs : list of ints
        the bugnumbers

    Examples
    --------
    >>> get_bugs(package='gtk-qt-engine', severity='normal')
    [12345, 23456]

    rrz_Calling get_bugs with positional arguments is deprecated, please use keyword arguments instead.z<get_bugs></get_bugs>�arg�get_bugsrocSsg|]}t|��qSr)raryr)r)r*re�rfzget_bugs.<locals>.<listcomp>)r4rPrSrKrLrMrNrOr�	enumeraterjrUZmarshallrQrVrW)�	key_value�kwargs�args�k�vr\�arg_nZkvZarg_namerZr]rwr)r)r*r|ls$*

r|cCsxt�}dD]}t||t||���q
t�t|d���|_t�t|d���|_dd�t|d���	�D�|_
t|d��|_|jr�t|d��nd|_
t|d	��|_t|d
��|_t|d��|_dd�t|d
���	�D�|_dd�t|d���	�D�|_dd�t|d���	�D�|_dd�|d����p"gD�|_dd�|d����p@gD�|_dd�t|d���	d�D�}dd�|D�|_|S)z9Return a bugreport object from a given status xml element)rrrrrrr r#r&r'rrr"cSsg|]}|�qSr)r))r.rmr)r)r*re�rfz!_parse_status.<locals>.<listcomp>rrNr$rr%cSsg|]}t|��qSr)ra�r.r[r)r)r*re�rfrcSsg|]}t|��qSr)rar�r)r)r*re�rfrcSsg|]}t|��qSr)rar�r)r)r*re�rfrcSsg|]}t|��qSr)�rj�r.�elr)r)r*re�rfrcSsg|]}t|��qSr)r�r�r)r)r*re�rfrcSsg|]}|r|�qSr)r))r.Z_fr)r)r*re�rfr!�,cSsg|]}|���qSr))�strip)r.�ar)r)r*re�rf)r�setattrrtrZutcfromtimestamp�floatrr"rj�splitr�_parse_boolrZdone_byr$rrbr%rrrrWrrr!)r^rdZfieldr!r)r)r*rY�s.��
rY�Zsoap)r#�action�	namespaceZsoap_ns)r
r	r
)�CA_CERTSZcacertcCs|td<dS)z�Set proxy for SOAP client.

    You must use this method after import to set the proxy.

    Parameters
    ----------
    proxy_arg : str

    �proxyN��_soap_client_kwargs)Z	proxy_argr)r)r*�set_soap_proxy�s
r�cCstSrr�r)r)r)r*�get_soap_client_kwargssr�cCstfit��S)z�Factory method that creates a SoapClient.

    For thread-safety we create SoapClients on demand instead of using a
    module-level one.

    Returns
    -------
    sc : SoapClient instance

    )rr�r)r)r)r*rQsrQcGs0g}t|�D]\}}|�dt|�|f�q|S)z�Convert arguments to be consumed by a SoapClient method

    Soap client required a list of named arguments:
    >>> _convert_soap_method_args('a', 1)
    [('arg0', 'a'), ('arg1', 1)]

    r{)r}rXrj)r��	soap_argsr�r{r)r)r*�_convert_soap_method_argssr�cGs:t�}t|�}tr t||�|�St||�|g|�R�SdS)z!Wrapper to call SoapClient methodN)rQr��PYSIMPLESOAP_1_16_2�getattr)Zmethod_namer�rZr�r)r)r*rg!s
rgcCsb|�|�}|�dd�|�dd�|�dd�t|���|D] }|�dt|��}|�dd�q<|S)	zNbuild a soapenc:Array made of ints called `el_name` as a child
    of `parent`z
xmlns:soapencz)http://schemas.xmlsoap.org/soap/encoding/r`rozsoapenc:arrayTypez
xsd:int[{:d}]�itemzxsd:int)Z	add_childZ
add_attributer-rSrj)Zel_name�parentZlist_r�r�rzr)r)r*rU.s
�rUcCst|�}|��dvS)z(parse a boolean value from a xml element)r��0)rjr�)r�r0r)r)r*r�<sr�cCs@t|�}|���d�}|r<|jdkr<t�|�}|jddd�}|S)z.read a string element, maybe encoded in base64r`zxsd:base64Binaryzutf-8�replace)�errors)rjrhrir0�base64Z	b64decode�decode)r�r0Zel_typer)r)r*rtBs
rt)N)4rHr�Zdistutils.versionrZemail.feedparserrkZemail.policyr�os�sysZloggingZpysimplesoapZpysimplesoap.clientrZpysimplesoap.simplexmlrZ	getLoggerrErNZca_path�path�isdir�environ�__version__r�ZURLZNSZBTS_URLrTrC�objectrrIr_rnrxr|rYr��version_info�majorZhttplib2r��ImportErrorr�r�rQr�rgrUr�rtr)r)r)r*�<module>sr	

��-
2+K/�



Youez - 2016 - github.com/yon3zu
LinuXploit