Package tdi :: Package c
[frames] | no frames]

Package c

source code

The modules in this package implement (or reimplement) various functionality in C for reasons of performance or availability. The performance implementations are always re-implementations of accompanying python functions.

The standard way to import these modules is to use the load function. It catches ImportError and disabled C overrides via environment.


Author: André Malo

Functions
module
load(modname, env_override=None, tpl=None)
Module loading facade
source code
Variables
  DEFAULT_ENV_OVERRIDE = 'TDI_NO_C_OVERRIDE'
  DEFAULT_TPL = 'tdi.c._tdi_%s'
  __package__ = 'tdi.c'
Function Details

load(modname, env_override=None, tpl=None)

source code 
Module loading facade
Parameters:
  • modname (str) - Module name part (like util for tdi.c._tdi_util), see tpl
  • env_override (str) - Name of the environment variable, which can disable the c extension import if set to 1. If omitted or None, DEFAULT_ENV_OVERRIDE is applied.
  • tpl (str) - Template for the fully qualified module name. It has to contain one %s format specifier which takes the modname part. If omitted or None, DEFAULT_TPL is applied.
Returns: module
The requested module or None (either by env request or ImportError)

Variables Details

DEFAULT_ENV_OVERRIDE

Value:
'TDI_NO_C_OVERRIDE'

DEFAULT_TPL

Value:
'tdi.c._tdi_%s'

__package__

Value:
'tdi.c'