link.feature package¶
Module contents¶
-
class
link.feature.Feature(obj, *args, **kwargs)¶ Bases:
objectBase class for feature.
Parameters: obj (any) – Object providing this feature -
name= None¶
-
-
class
link.feature.featuredprop¶ Bases:
propertySpecial 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: Raises: AttributeError – if feature is not provided by object’s class