관리-도구
편집 파일: getMethod.cpython-36.pyc
3 e�$g� � @ s� d dl Z d dlZd dlZd dlmZ yd dlmZ W n ek rL eZY nX G dd� de �Z dd� Zdd � Ze d kr�ddd dddddgZxleD ]dZede � yeed�ZW n> e k r� ej� d Zededjeeej��f � Y q�X e� q�W dS )� N)� raise_with_tb)� ClassTypec @ s e Zd ZdZdS )�GetMethodExceptionzException classN)�__name__� __module__�__qualname__�__doc__� r r �/usr/lib/python3.6/getMethod.pyr s r c C sr t jt j }|t j d }xR| D ]J}t|�s4td��x |D ]}||kr:td| ��q:W |d |kr td��q W d S )N�_zEmpty method componentz)Invalid character '%s' in the method namer z6Method names should start with an alphabetic character)�stringZascii_lowercaseZascii_uppercaseZdigits�lenr )�methodNameCompsZalphaZallowedChars�comp�cr r r �sanity s r c C sz |j d�| j d� }t|� x~tt|�dd �D ]^}dj|d |� �}yt|�}W n8 tk rf w.Y n$ tk r� tt d| �� Y nX P q.W t d| ��|}|}x�tdt|��D ]�}|| }||k � r�t ||�s�t ddj|d |� �|f ��t||�}q�t |d��s$t ddj|d |� � ��t|d�} || k�rVt d dj|d |� �|f ��t||�}t|�t kr�|� }q�W |S )N�.r � zCould not import module %szAction %s could not be importedzClass %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 modulenameZactionsZfIndexZ classNamer Zexportr r r � getMethod. sB 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> s8 =