General KERNEL Documentation     End User KERNEL Services  


import_hook Namespace Reference


Functions

def register_name
def register_pattern
def is_shared
def get_shared_imported
def get_real_module
def set_shared_imported
def ensure_fromlist
def import_hook
def reload_hook
def init_shared_modules

Variables

dictionary shared_imported = {}
list patterns = []
 original_import = __builtin__.__import__


Function Documentation

def import_hook::register_name   name  ) 
 

def import_hook::register_pattern   pattern  ) 
 

def import_hook::is_shared   name  ) 
 

Indicate if module name is a shared module
    among multiple interpreters (return value=1)

def import_hook::get_shared_imported   name,
  fromlist
 

If the module is registered in shared_imported
    update the sys.modules dict
    Let the real import be done by original_import

def import_hook::get_real_module   mod,
  name
 

Return effective module on import
   Standard import returns module A on import A.B
   To get module A.B use get_real_module with name "A.B"

def import_hook::set_shared_imported   name,
  module
 

Register a shared module
    Name can be a dotted name : package

def import_hook::ensure_fromlist   m,
  fromlist,
  recursive = 0
 

Return the real modules list to be imported

def import_hook::import_hook   name,
  globals = None,
  locals = None,
  fromlist = None
 

Import replacement for sharing modules among multiple interpreters
    Mostly update sys.modules before doing real import

def import_hook::reload_hook   module  ) 
 

def import_hook::init_shared_modules   shared_module  ) 
 


Variable Documentation

dictionary import_hook::shared_imported = {} [static]
 

list import_hook::patterns = [] [static]
 

import_hook::original_import = __builtin__.__import__ [static]