File: //lib/python3.9/site-packages/up2date_client/__pycache__/getMethod.cpython-39.pyc
a
c8h� � @ s� d dl Z d dlZd dlZd dlmZ zd dlmZ W n eyJ eZY n0 G dd� de �Z
dd� Zdd � Ze
d
kr�g d�ZeD ]bZede � zeed
�ZW n< e
y� e�� d Zeded�eeej��f � Y q�0 e� q�dS )� N)�
raise_with_tb)� ClassTypec @ s e Zd ZdZdS )�GetMethodExceptionzException classN)�__name__�
__module__�__qualname__�__doc__� r r �</usr/lib/python3.9/site-packages/up2date_client/getMethod.pyr s r c C sj t jt j }|t j d }| D ]F}t|�s2td��|D ]}||vr6td| ��q6|d |vrtd��qd S )N�_zEmpty method componentz)Invalid character '%s' in the method namer z6Method names should start with an alphabetic character)�stringZascii_lowercaseZascii_uppercase�digits�lenr )�methodNameCompsZalphaZallowedChars�comp�cr r r
�sanity s ��r c
C sp |� d�| � d� }t|� tt|�dd�D ]^}d�|d |� �}zt|�}W n6 tyd Y q,Y n" ty� tt d| �� Y n0 q�q,t d| ��|}|}tdt|��D ]�}|| }||k r�t
||�s�t dd�|d |� �|f ��t||�}q�t
|d��st d d�|d |� � ��t|d�} || v�rNt d
d�|d |� �|f ��t||�}t|�t
u r�|� }q�|S )N�.r ���zCould not import module %szAction %s could not be imported� zClass %s has no attribute %sZ
__rhnexport__zClass %s is not RHN-compliantzClass %s does not export '%s')�splitr �ranger �join�
__import__�ImportError� Exceptionr r �hasattr�getattr�typer )
Z
methodNameZ baseClassr �indexZ
modulename�actionsZfIndexZ classNamer Zexportr r r
� getMethod. sH
�
�
�
r! �__main__)za.b.c.d.e.fza.b.c.d.e.foo.hz
a.b.c.d.e.g.hz
a.b.d.d.e.g.hza.b.d.d._e.g.hza.b.d.d.e_.g.hza.b.d.d.e-.g.hza.b.d.d..g.hz----Running method %s: ZActionsr zError getting the method %s: %s� )�osr �sysZrhn.tbr �typesr r r r r r r! r �methods�m�print�method�exc_info�er �map�str�argsr r r r
�<module>
s,
=�