
    Dh                         d Z ddlmZ  G d de      ZeZdedddfdedej                  ej                  e      d	ej                  d
ej                  dej                  dedej                  fdZy)a  
This module provides utilities for importing modules and handling exceptions.

Classes:
    DummyError(Exception):
        A custom exception class used as a default for exception handling.

Functions:
    import_global(name, modules=None, exceptions=DummyError, locals_=None,
        globals_=None, level=-1):
        Imports the requested items into the global scope, with support for
        relative imports and custom exception handling.
   )typesc                       e Zd ZdZy)
DummyErrorzBA custom exception class used as a default for exception handling.N)__name__
__module____qualname____doc__     v/var/www/fastuser/data/www/generator.snapmosaic.io/flask_app/venv/lib/python3.12/site-packages/python_utils/import_.pyr   r      s    Lr   r   Nnamemodules
exceptionslocals_globals_levelreturnc           
         d}| j                  d      }t               }	 ||6ddl}	|	j                         d   d   }||j                  }||j
                  }	 |d   s|dd }d}t        |d   xs d|||dd t        |d            }
	 |dd D ]  }t        |
|      }
 	 |s t        t        |
dt        |
                  }n#t        |      j                  t        |
            }t        t        |
            j                  |      D ]  }|s|d   dk7  st        |
|      ||<    	 ~ ~~~~~~~y# t        $ r#}t        ddj                  |      z         |d}~ww xY w# |$ r}|cY d}~~ ~~~~~~~S d}~ww xY w# ~ ~~~~~~~w xY w)	a  Import the requested items into the global scope.

    WARNING! this method _will_ overwrite your global scope
    If you have a variable named `path` and you call `import_global('sys')`
    it will be overwritten with `sys.path`

    Args:
        name (str): the name of the module to import, e.g. sys
        modules (str): the modules to import, use None for everything
        exceptions (Exception): the exception to catch, e.g. ImportError
        locals_: the `locals()` method (in case you need a different scope)
        globals_: the `globals()` method (in case you need a different scope)
        level (int): the level to import from, this can be used for
        relative imports
    N.    r   )r   globalslocalsfromlistr   zNo module named __all___)splitsetinspectstackf_locals	f_globals
__import__maxgetattrAttributeErrorImportErrorjoindirintersection)r   r   r   r   r   r   frame
name_partsmodules_setr   moduleattreks                 r   import_globalr2      s   . E"&**S/J"%%K?
 ?h.MMOA&q)E.. ??%	a='^
  ])c #AB%mF&qrN 3D$VT2F3 !'&)S["IJ!'l77FD V%22;? 51")&!"4HQK5 9 " !&*)==   	H 	
 sf   :E? 0E# D4 !A.E# E# E# 4	E =EE  E# #E<(E7)E<*E? 7E<<E? ?
F	)r	    r   	Exceptionr   DummyExceptionstrOptionalListExceptionsTypeOptionalScopeintAnyr2   r
   r   r   <module>r=      s    M M
 
 04'1#'$(Y

Y
^^EJJsO,Y
 $$Y
   	Y

 !!Y
 Y
 YYY
r   