Previous topic

qarbon.signal

Next topic

qarbon.value

This Page

qarbon.util

Helper functions.

Functions

is_string Determines if the given object is a string.
is_sequence Determines if the given object is a sequence.
module_directory Returns the location of a given module.
import_module Import a module.
callable_weakref This function returns a callable weak reference to a callable object.
qarbon.util.is_string(obj)[source]

Determines if the given object is a string.

Parameters:obj (object) – the object to be analysed
Returns:True if the given object is a string or False otherwise
Return type:bool
qarbon.util.is_sequence(obj, inc_string=False)[source]

Determines if the given object is a sequence.

Parameters:
  • obj (object) – the object to be analysed
  • inc_string (bool) – if False, exclude str/unicode objects from the list of possible sequence objects
Returns:

True if the given object is a sequence or False otherwise

Return type:

bool

qarbon.util.module_directory(module)[source]

Returns the location of a given module.

Parameters:module (module) – the module object
Returns:the directory where the module is located
Return type:str
qarbon.util.import_module(name, package=None)[source]

Import a module.

The ‘package’ argument is required when performing a relative import. It specifies the package to use as the anchor point from which to resolve the relative import to an absolute import.

qarbon.util.callable_weakref(obj, del_cb=None)[source]

This function returns a callable weak reference to a callable object. Object can be a callable object, a function or a method.

Parameters:
  • object (callable object) – a callable object
  • del_cb (callable object or None) – calback function. Default is None meaning to callback.
Returns:

a weak reference for the given callable

Return type:

BoundMethodWeakref or weakref.ref