3 g@sddlZddlZddlZddlmZyddlmZWnek rLeZYnXGddde Z ddZ dd Z e d krd d d dddddgZxleD]dZedeye edZWn>e k rejdZededjeeejfYqXeqWdS)N) raise_with_tb) ClassTypec@seZdZdZdS)GetMethodExceptionzException classN)__name__ __module__ __qualname____doc__r r /usr/lib/python3.6/getMethod.pyrsrcCsrtjtj}|tjd}xR|D]J}t|s4tdx |D]}||kr:td|q:W|d|kr tdq WdS)N_zEmpty method componentz)Invalid character '%s' in the method namerz6Method names should start with an alphabetic character)stringZascii_lowercaseZascii_uppercaseZdigitslenr)methodNameCompsZalphaZ allowedCharscompcr r r sanitys    rc Csz|jd|jd}t|x~tt|dd D]^}dj|d|}y t|}Wn8tk rfw.Yn$tk rtt d|YnXPq.Wt d||}|}xtdt|D]}||}||krt ||st ddj|d||ft ||}qt |ds$t ddj|d|t |d} || krVt d dj|d||ft ||}t |t kr|}qW|S) N.rzCould 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')splitrranger join __import__ ImportError Exceptionrrhasattrgetattrtyper) Z methodNameZ baseClassrindexZ modulenameZactionsZfIndexZ classNamerZexportr r r getMethod.sB           r__main__z a.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.hz a.b.d.d..g.hz----Running method %s: ZActionsrzError getting the method %s: %s)osr sysZrhn.tbrtypesrrrrrrrrmethodsmprintmethodexc_infoermapstrargsr r r r  s8  =