Page 1 of 1

Trying to make sense of following code

Posted: Mon Mar 10, 2014 7:33 pm
by lilzz
https://code.google.com/p/webiopi/sourc ... _init__.py

Code: Select all

class Pressure():
    def __init__(self, altitude=0, external=None):
        self.altitude = toint(altitude)
        if isinstance(external, str):
            self.external = deviceInstance(external)
        else:
            self.external = external
        
        if self.external != None and not isinstance(self.external, Temperature):
            raise Exception("external must be a Temperature sensor")

    def __family__(self):
        return "Pressure"

    def __getPascal__(self):
        raise NotImplementedError
    
    def __getPascalAtSea__(self):
        raise NotImplementedError
    
    @request("GET", "sensor/pressure/pa")
    @response("%d")
    def getPascal(self):
        return self.__getPascal__()

Last line, self._getPascal__() which is defined as

def __getPascal__(self):
raise NotImplementedError

There's nothing inside the _getPascal__ function. There's real stuff inside. Is this right?

Re: Trying to make sense of following code

Posted: Mon Mar 10, 2014 7:52 pm
by joan
It looks like a place holder for code which will be implemented but hasn't been so far.