Exemple #1
0
 def find_single_property(self, name):
     result = self.find_property(name)
     if len(result) < 1:
         raise exceptions.NoPropertyFound(name)
     elif len(result) > 1:
         raise exceptions.AmbiguousPropertyNameError(name)
     return result[0]
Exemple #2
0
    def find_static_property(self, name):
        def prop_func(cls):
            prop = cls.properties.get(name)
            if prop is not None and prop.usage == 'Static':
                return prop

        result = self._choose_symbol(prop_func)
        if len(result) < 1:
            raise exceptions.NoPropertyFound(name)
        elif len(result) > 1:
            raise exceptions.AmbiguousPropertyNameError(name)
        return result[0]