コード例 #1
0
ファイル: Thing.py プロジェクト: aniknarayan/ioticiser_new
 def set_public(self, public=True):
     with self.lock:
         res = Validation.bool_check_convert('public', public)
         if res != self.__public and PUBLIC not in self._changes:
             logger.debug('adding public %s -> %s', repr(self.__public),
                          repr(res))
             self._changes.append(PUBLIC)
         self.__public = res
コード例 #2
0
ファイル: Thing.py プロジェクト: aniknarayan/ioticiser_new
 def __init__(self,
              lid,
              new=False,
              stash=None,
              public=None,
              labels=None,
              descriptions=None,
              tags=None,
              points=None,
              lat=None,
              long=None):  # pylint: disable=redefined-builtin
     """
     # Note labels & descriptions: dict like {'en': 'blah', 'fr': 'chips'}
     # Note points dict = stash format
     """
     super(Thing, self).__init__(lid,
                                 new=new,
                                 labels=labels,
                                 descriptions=descriptions,
                                 tags=tags)
     self.__stash = stash
     self.__public = Validation.bool_check_convert(
         'public', public)  # Note: bool(None) == False
     self.__lat = None
     self.__long = None
     if lat is not None or long is not None:
         Validation.location_check(lat, long)
         self.__lat = lat
         self.__long = long
     self.__points = {}
     if points is not None:
         for pid, pdata in points.items():
             point_tags = [
             ]  # Migrate stash where point[tags] was not stored in empty case
             if TAGS in pdata:
                 point_tags = pdata[TAGS]
             self.__points[pid] = Point(pdata[FOC],
                                        pid,
                                        labels=pdata[LABELS],
                                        descriptions=pdata[DESCRIPTIONS],
                                        tags=point_tags,
                                        values=pdata[VALUES],
                                        max_samples=pdata[RECENT])