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

Package c

source code

Modules implemented in C

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.


Copyright: Copyright 2006 - 2015 André Malo or his licensors, as applicable

License:

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

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'