link.feature
latest
  • Tutorial
  • API documentation
    • link.feature package
      • Module contents
link.feature
  • Docs »
  • API documentation »
  • link.feature package
  • Edit on GitHub

link.feature package¶

Module contents¶

class link.feature.Feature(obj, *args, **kwargs)¶

Bases: object

Base class for feature.

Parameters:obj (any) – Object providing this feature
name = None¶
class link.feature.featuredprop¶

Bases: property

Special property to allow traversal by the getfeatures() function.

link.feature.addfeatures(features)¶

Add features to a class.

Parameters:features (list) – Features to add
Returns:decorator
Return type:callable
link.feature.getfeatures(obj)¶

Get list of features provided by an object’s class.

Parameters:obj (any) – Object
Returns:List of provided features
Return type:list
link.feature.hasfeature(obj, name)¶

Check if object’s class provides a feature.

Parameters:
  • obj (any) – Object
  • name (str) – Feature’s name
Returns:

True if feature is provided

Return type:

bool

link.feature.getfeature(obj, name, *args, **kwargs)¶

Instantiate a feature.

Parameters:
  • obj (any) – Object
  • name (str) – Feature’s name
  • args (Iterable) – Positional arguments for feature’s constructor
  • kwargs (dict) – Keyword arguments for feature’s constructor
Returns:

Instance of feature

Return type:

Feature

Raises:

AttributeError – if feature is not provided by object’s class

Previous

© Copyright 2016, David Delassus. Revision 72199e72.

Built with Sphinx using a theme provided by Read the Docs.