Пример #1
0
    def unpack(self, json_data):
        result = json.loads(json_data)

        if result and result['params']:
            self.term = DictHelper.find('params.term', result)
            self.target = DictHelper.find('params.target', result)
        else:
            return None

        if self.target == Target.tostring(0):
            self.__class__ = ObjectParams
        else:
            self.__class__ = CatalogParams

        return self.unpack(json_data)
Пример #2
0
    def unpack(self, json_data):
        result = json.loads(json_data)

        if result and result['params']:
            self.obsolete_catalogs = DictHelper.find('params.obsolete_catalogs', result)
        else:
            return None

        return self
Пример #3
0
    def unpack(self, json_data):
        result = json.loads(json_data)

        if result and result['params']:
            self.exact = DictHelper.find('params.exact', result)
            self.cone = DictHelper.find('params.cone', result)

            if self.cone:
                self.radius = DictHelper.find('params.radius', result)
                coordinates_str = DictHelper.find('params.coordinates', result)

                if coordinates_str:
                    self.coordinates = CoordinatesConverter.convert(coordinates_str)

                self.epoch = DictHelper.find('params.epoch', result)
                self.equinox = DictHelper.find('params.equinox', result)
        else:
            return None

        return self
Пример #4
0
 def get_section(self, section):
     return DictHelper.find(section, self)
Пример #5
0
 def find_by_path(self, path):
     return DictHelper.find(path, self)
Пример #6
0
 def find(self, key):
     return DictHelper.find(key, self)