Esempio n. 1
0
    def request(self, name, number=None):
        resource = _lookup(self.available, name, number)
        rt, ri = _resource_type(resource)
        if number is None:
            resource_name = name
        else:
            resource_name = name + str(number)
        if isinstance(rt, int):
            obj = Signal(rt, name_override=resource_name)
        else:
            obj = Record(rt, name=resource_name)
            for name, inverted in ri:
                if inverted:
                    getattr(obj, name).inverted = True

        for element in resource[2:]:
            if isinstance(element, Inverted):
                if isinstance(obj, Signal):
                    obj.inverted = True
            if isinstance(element, PlatformInfo):
                obj.platform_info = element.info
                break

        self.available.remove(resource)
        self.matched.append((resource, obj))
        return obj
Esempio n. 2
0
    def request(self, name, number=None):
        resource = _lookup(self.available, name, number)
        rt, ri = _resource_type(resource)
        if number is None:
            resource_name = name
        else:
            resource_name = name + str(number)
        if isinstance(rt, int):
            obj = Signal(rt, name_override=resource_name)
        else:
            obj = Record(rt, name=resource_name)
            for name, inverted in ri:
                if inverted:
                    getattr(obj, name).inverted = True

        for element in resource[2:]:
            if isinstance(element, Inverted):
                if isinstance(obj, Signal):
                    obj.inverted = True
            if isinstance(element, PlatformInfo):
                obj.platform_info = element.info
                break

        self.available.remove(resource)
        self.matched.append((resource, obj))
        return obj
Esempio n. 3
0
    def request(self, name, number=None):
        resource = _lookup(self.available, name, number)
        rt = _resource_type(resource)
        if isinstance(rt, int):
            obj = Signal(rt, name_override=resource[0])
        else:
            obj = Record(rt, name=resource[0])

        for element in resource[2:]:
            if isinstance(element, PlatformInfo):
                obj.platform_info = element.info
                break

        self.available.remove(resource)
        self.matched.append((resource, obj))
        return obj
Esempio n. 4
0
    def request(self, name, number=None):
        resource = _lookup(self.available, name, number)
        rt = _resource_type(resource)
        if isinstance(rt, int):
            obj = Signal(rt, name_override=resource[0])
        else:
            obj = Record(rt, name=resource[0])

        for element in resource[2:]:
            if isinstance(element, PlatformInfo):
                obj.platform_info = element.info
                break

        self.available.remove(resource)
        self.matched.append((resource, obj))
        return obj