[weboob] [PATCH 3/3] Add a new capabilitie to display information about a gauge

Florent Fourcot weboob at flo.fourcot.fr
Sun Feb 12 00:51:53 CET 2012


From: Florent <weboob at flo.fourcot.fr>


Signed-off-by: Florent <weboob at flo.fourcot.fr>
---
 weboob/capabilities/gauge.py |   63 ++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 63 insertions(+), 0 deletions(-)
 create mode 100644 weboob/capabilities/gauge.py

diff --git a/weboob/capabilities/gauge.py b/weboob/capabilities/gauge.py
new file mode 100644
index 0000000..bb2f078
--- /dev/null
+++ b/weboob/capabilities/gauge.py
@@ -0,0 +1,63 @@
+# -*- coding: utf-8 -*-
+
+# Copyright(C) 2010  Romain Bignon, Florent Fourcot
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, version 3 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+
+from datetime import datetime
+from .base import IBaseCap, CapBaseObject
+
+
+__all__ = ['ICapWaterLevel']
+
+
+class Gauge(CapBaseObject):
+    def __init__(self, id):
+        CapBaseObject.__init__(self, id)
+
+        self.add_field('name', basestring)
+	self.add_field('river', basestring)
+        self.add_field('level', float)
+        self.add_field('flow', float)
+        self.add_field('lastdate', datetime)
+        self.add_field('forecast', basestring)
+
+class GaugeHistory(CapBaseObject):
+    def __init__(self):
+        CapBaseObject.__init__(self, None)
+
+        self.add_field('level', float)
+        self.add_field('flow', float)
+        self.add_field('date', datetime)
+
+
+class ICapWaterLevel(IBaseCap):
+    def get_lastlevel(self):
+        raise NotImplementedError()
+
+    def get_list(self):
+        raise NotImplementedError()
+
+    def get_history(self, id):
+        raise NotImplementedError()
+
+    def last(self, id):
+        raise NotImplementedError()
+
+    def search(self, pattern):
+        raise NotImplementedError()
+
+
+
-- 
1.7.9




More information about the weboob mailing list