JL i dZdZGddZy)a Helper to enable simple lazy module import. 'Lazy' means the actual import is deferred until an attribute is requested from the module's namespace. This has the advantage of allowing all imports to be done at the top of a script (in a prominent and visible place) without having a great impact on startup time. Copyright (c) 1999-2005, Marc-Andre Lemburg; mailto:mal@lemburg.com See the documentation for further information on copyrights, or contact the author. All Rights Reserved. cDeZdZdZdZdZdZdZdZd dZ dZ dZ dZ d Z y) LazyModuleaLazy module class. Lazy modules are imported into the given namespaces whenever a non-special attribute (there are some attributes like __doc__ that class instances handle without calling __getattr__) is requested. The module is then registered under the given name in locals usually replacing the import wrapper instance. The import itself is done using globals as global namespace. Example of creating a lazy load module: ISO = LazyModule('ISO',locals(),globals()) Later, requesting an attribute from ISO will load the module automatically into the locals() namespace, overriding the LazyModule instance: t = ISO.Week(1998,1,1) rNc||_||}||_|jdd}|r|dz|z|_||_d|_y|x|_|_d|_y)zCreate a LazyModule instance wrapping module name. The module will later on be registered in locals under the given module name. globals is optional and defaults to locals. N__name__r.)_LazyModule__lazymodule_locals_LazyModule__lazymodule_globalsgetr_LazyModule__lazymodule_name_LazyModule__lazymodule_init)selfnamelocalsglobalsmainnames U/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/nltk/lazyimport.py__init__zLazyModule.__init__>sl$* ?G$+!;;z2. $sNT1DM%)D ""#6: 9DMD2!"c|j}|j}|jr|j|Strt d|zt ||j|jdx|j|<}|jj|jd|jd<trt d|z|S)zImport the module now.zLazyModule: Loading module %r*r __lazymodule_loadedzLazyModule: Module %r loaded) r r_LazyModule__lazymodule_loadedr _debugprint __import__r __dict__update)r local_name full_namemodules r__lazymodule_importzLazyModule.__lazymodule_importSs++ MM  # #++J7 7  1I= >8B t//1J1JC9    ,v V__-01 +,  09< = rc|jr t|trtd|z|j }t ||S)z2Import the module on demand and get the attribute.z=LazyModule: Module load triggered by attribute %r read access)rAttributeErrorrr_LazyModule__lazymodule_importgetattr)rrr"s r __getattr__zLazyModule.__getattr__ksM  # # & &  DFJK ))+vt$$rc|js||j|<y|jr)||j|j<||j|<yt rt d|z|j}t|||y)z2Import the module on demand and set the attribute.Nz>LazyModule: Module load triggered by attribute %r write access) rrrr r rrr&setattr)rrvaluer"s r __setattr__zLazyModule.__setattr__ws%%"'DMM$    # #?DD $ $T%;%; <"'DMM$    EGKL ))+e$rc d|jzS)Nz)r)rs r__repr__zLazyModule.__repr__s"T]]22r)N)r __module__ __qualname____doc__rr rr r rr&r(r,r.rrrrsH, #*0 %%"3rrN)r1rrr2rrr3s   p3p3r