schrodinger.utils.funcgroups module

This module provides a mechanism for marking the methods on a class with a decorator. These methods can then be retrieved as an ordered list from an instance of that class. Each decorator instance creates a separate group.

To use, mix in the FuncGroupMixin to any class, and decorate the desired methods with an instance of FuncGroupMarker.

A generic decorator, funcgroup, is provided for convenience, but it is recommended that a separate decorator be created for each group.


my_startup_funcs = FuncGroupMarker()

class Foo(FuncGroupMixin):
    def __init__(self):
        for func in self.getFuncGroup(my_startup_funcs):

    def initVariables(self):

    def setupWorkspace(self):
class schrodinger.utils.funcgroups.FuncGroupMarker(label=None)

Bases: object

This decorator marks a method on a class as belonging to a group.

  • order – a numerical value that determines in what order the methods are returned when retrieved.

  • order – float


label (str) – An optional human-readable identifier to use in the repr


Gets the order as set by the FuncGroupMarker decorator. Returns None if the function was not decorated.


func – the function to get the order from.

Return float

the order

class schrodinger.utils.funcgroups.FuncData(name, order, func=None)

Bases: object

__init__(name, order, func=None)
class schrodinger.utils.funcgroups.FuncGroupMixin(*args, **kwargs)

Bases: object

Use this mixin on an object so that methods decorated with a FuncGroupMarker can be retrieved on an instance of this object.

__init__(*args, **kwargs)

Retrieve the functions belonging to the specified group.


group (FuncGroupMarker) – the group marker


the functions in the specified group, in order

Return type


addFuncToGroup(func, group=None, order=None)

Adds a function to the specified chain. Typically used for adding functions that are not methods of this object.

The function may optionally be decorated with a FuncGroupMarker. If so, the default group and order will be determined by the decorator. Any group or order explicitly passed in to addFuncToGroup will take precedence over the decorator settings.

  • func – the function to add

  • group (FuncGroupMarker or None) – the group marker. If the function is decorated with a FuncGoupMarker, that group marker will be the default.

  • order (float or None) – the sorting order. If the function is decorated with a FuncGoupMarker, the order specified in the decorator will be the default.