e,SrSSKrSSKrSSKr/SQr0r"SS5r"SS\5r"SS \5r SS jr SS jr SS jr SS jr SSjr"SS\R5rSrSr\S:Xa\"5 gg)aParse a Python module and describe its classes and functions. Parse enough of a Python file to recognize imports and class and function definitions, and to find out the superclasses of a class. The interface consists of a single function: readmodule_ex(module, path=None) where module is the name of a Python module, and path is an optional list of directories where the module is to be searched. If present, path is prepended to the system search path sys.path. The return value is a dictionary. The keys of the dictionary are the names of the classes and functions defined in the module (including classes that are defined via the from XXX import YYY construct). The values are instances of classes Class and Function. One special key/value pair is present for packages: the key '__path__' has a list as its value which contains the package search path. Classes and Functions have a common superclass: _Object. Every instance has the following attributes: module -- name of the module; name -- name of the object; file -- file in which the object is defined; lineno -- line in the file where the object's definition starts; end_lineno -- line in the file where the object's definition ends; parent -- parent of this object, if any; children -- nested objects contained in this object. The 'children' attribute is a dictionary mapping names to objects. Instances of Function describe functions with the attributes from _Object, plus the following: is_async -- if a function is defined with an 'async' prefix Instances of Class describe classes with the attributes from _Object, plus the following: super -- list of super classes (Class instances if possible); methods -- mapping of method names to beginning line numbers. If the name of a super class is not recognized, the corresponding entry in the list of super classes is not a class instance but a string giving the name of the super class. Since import statements are recognized and imported modules are scanned as well, this shouldn't happen often. N) readmodule readmodule_exClassFunctionc\rSrSrSrSrSrg)_Object5z+Information about Python class or function.c~XlX lX0lX@lXPlX`l0UlUbXR U'ggN)modulenamefilelineno end_linenoparentchildren)selfr r rrrrs ,/opt/imh/python3.13/lib/python3.13/pyclbr.py__init___Object.__init__7s>    $   $(OOD ! )rrrrr r rN)__name__ __module__ __qualname____firstlineno____doc__r__static_attributes__rrrr5s 1 )rrc:^\rSrSrSrSSS.U4SjjjrSrU=r$)rDz7Information about a Python function, including methods.Nrc|>[TU]XX4Xu5 X`l[U[5(aXER U'ggr )superris_async isinstancermethods) rr r rrrr$r __class__s rrFunction.__init__Fs7 tZH fe $ $#)NN4  %rr$)NFrrrrrrr __classcell__r's@rrrDs=',*<@**rrc:^\rSrSrSrSSS.U4SjjjrSrU=r$)rNz!Information about a Python class.Nr!cV>[TU]XXEXv5 U=(d /Ul0Ulgr )r#rr&) rr r super_rrrrr's rrClass.__init__Ps& tZH\r  r)r&r#r r*r,s@rrrNs',0rrc D[URXRUXUS9$)z*Return a Function after nesting within ob.)rr$r)rr r)ob func_namerrr$s r_nest_functionr5Ys$ BIIy''6Z IIrc D[URXURUXS9$)z'Return a Class after nesting within ob.rr)rr r)r3 class_namerrr#s r _nest_classr9^s" Jrww 33rc0n[X=(d /5R5H up4[U[5(dMXBU'M" U$)zxReturn Class objects for the top-level classes in module. This is the original interface, before Functions were added. ) _readmoduleitemsr%r)r pathreskeyvalues rrrdsB C!&*"5;;=  eU # #H> Jrc*[X=(d /5$)zReturn a dictionary with all functions and classes in module. Search for module in PATH + sys.path. If possible, include imported superclasses. Do this by reading source, without importing (and executing) it. )r;)r r=s rrrps vzr **rcUb U<SU<3nOUnU[;a [U$0nU[R;aUc U[U'U$URS5nUS:aSUSUnXS-Sn[ XaU5nUb U<SU<3nSU;a[ SR U55e[ XxSU5$Sn UbUn OU[R-n [RRX:5n U c[SU<3US9eU[U'U RbU RUS'U RRU5n U cU$U RR!U5n [#X1XXB5$![[ 4a Us$f=f) aDo the hard work for readmodule[_ex]. If inpackage is given, it must be the dotted name of the package in which we are searching for a submodule, and then PATH must be the package search path; otherwise, we are searching for a top-level module, and path is combined with sys.path. N.r__path__zNo package named {}zno module named )r )_modulessysbuiltin_module_namesrfindr; ImportErrorformatr= importlibutil_find_spec_from_pathModuleNotFoundErrorsubmodule_search_locationsloader get_sourceAttributeError get_filename _create_tree)r r= inpackage fullmoduletreeipackage submodulerf search_pathspecsourcefnames rr;r;zs )62  X ## D)))i.?   SAAv!*Q34L WI6  !*G4GV#3::7CD D9Z&8'BB A SXXo >> . .z GD |!$4ZN"C*UUHZ &&2::Z'' 3 >K  KK $ $Z 0E  % II K ( s"E++F?Fc@\rSrSrSrSrSS.SjrSrSrS r S r g ) _ModuleBrowsercNX lX@lX0lXlXPl/Ulgr )r=rXrr rVstack)rr r=rrXrVs rr_ModuleBrowser.__init__s"    " rc /nURHn[R"U5nX@R;a UR URU5 MH[ UR S5=n5S:a:UGtpgnU[;a)UR [URX55 MMUR U5 M UR(aURSOSn [URURX RURXRS9nU cXRUR'URR U5 UR!U5 URR#5 g)NrCrDr7)basesastunparserXappendlensplitrFgetrerr r rrr generic_visitpop) rnoderibaser names_r class_rs rvisit_ClassDef_ModuleBrowser.visit_ClassDefs"JJD;;t$Dyy  TYYt_-djjo-U.2&+"FX%LL&!1!5!5f!CD& T"$(::B4t{{DIIuii$B >#)IIdii  &! 4  rFr)c UR(aURSOSn[URURURUR X2UR S9nUcX@RUR'URRU5 URU5 URR5 g)Nrhr!) rerr r rrrrXrlrprq)rrrr$rfunctions rvisit_FunctionDef _ModuleBrowser.visit_FunctionDefs#'::B4DKKDIIt{{"J >#+IIdii  (# 4  rc$URUSS9 g)NTr))r{)rrrs rvisit_AsyncFunctionDef%_ModuleBrowser.visit_AsyncFunctionDefs td3rc"URS:wagURH0n[URURUR 5 M2 g![ a [UR/5 MXf=f![ [4a Mof=f)Nr) col_offsetrtr;r r=rVrJ SyntaxError)rrrr s r visit_Import_ModuleBrowser.visit_Importsx ??a  jjF 1 TYYG!#1 R01-  s)+A A73A:6A77A::B BcLURS:wagSUR-nUR(aX!R- n[X RUR 5nURHnURU;a:X#RURUR=(d UR'MMURS:XdM_UR5H+upEURS5(aMXPRU'M- M g![ [4a gf=f)NrrC*ru)rlevelr r;r=rVrJrrtr rXasnamer< startswith)rrrr r import_name import_values rvisit_ImportFrom_ModuleBrowser.visit_ImportFroms ??a   4::%F{{++% DNNCFJJDyyF"6_main.."s 71h2rT)r?reverseindentz{}class {} {} {} z {}def {} {})osrGargv__file__r=existsdirnamebasenamelowerendswithrsortedvaluesrqr%listhasattrrrrextendrprintrKr r#rr) rmodr=rX lineno_keyobjs indent_levelobjnew_objsr3s r_mainrs hhqk ww~~c$%ggs# 99;   & &cr(C  #D2J $++-Z >DL hhj c4 sH%%CJ c7 # #cll113",drs)V  >  ) )*w*GI 3 +=J@P:S__P:f $PL z Gr