def __init__(self, item):
        """Instance constructor.

        :param dreq.content.SectionItem item: Associated section item.

        """
        for attr in [i for i in item._TABLE if i.is_internal_link]:
            short_name, long_name = utils.get_link_labels(attr.label)
            if short_name is not None:
                setattr(self, short_name, None)
            if short_name != long_name and long_name is not None:
                setattr(self, long_name, None)
Exemplo n.º 2
0
    def __init__(self, item):
        """Instance constructor.

        :param dreq.content.SectionItem item: Associated section item.

        """
        for attr in [i for i in item._TABLE if i.is_internal_link]:
            short_name, long_name = utils.get_link_labels(attr.label)
            if short_name is not None:
                setattr(self, short_name, None)
            if short_name != long_name and long_name is not None:
                setattr(self, long_name, None)
Exemplo n.º 3
0
def _set_internal_links(wrapper):
    for section in wrapper:
        for item in section:
            for attr, value in item:
                if attr.is_internal_link and value in cache.DATA:
                    short_name, long_name = utils.get_link_labels(attr.label)
                    if short_name is not None:
                        setattr(item.links, short_name, cache.DATA[value])
                    if short_name != long_name and long_name is not None:
                        setattr(item.links, long_name, cache.DATA[value])

    # Set relation: mip --> objective
    for mip in wrapper.mip:
        mip.objectives = [o for o in wrapper['objective'] if o.mip == mip.label]
def _set_internal_links(wrapper):
    for section in wrapper:
        for item in section:
            for attr, value in item:
                if attr.is_internal_link and value in cache.DATA:
                    short_name, long_name = utils.get_link_labels(attr.label)
                    if short_name is not None:
                        setattr(item.links, short_name, cache.DATA[value])
                    if short_name != long_name and long_name is not None:
                        setattr(item.links, long_name, cache.DATA[value])

    # Set relation: mip --> objective
    for mip in wrapper.mip:
        mip.objectives = [
            o for o in wrapper['objective'] if o.mip == mip.label
        ]