def add_property(self, name, default_value, getter_pair, setter_triplet, specs): """Add property to device :param name: property name :param default_value: default value as string :param getter_pair: (query, response) :param setter_triplet: (query, response, error) :param specs: specification of the Property """ self._properties[name] = Property(name, default_value, specs) if getter_pair: query, response = getter_pair self._getters[to_bytes(query)] = name, response if setter_triplet: query, response, error = setter_triplet self._setters.append((name, stringparser.Parser(query), to_bytes(response), to_bytes(error)))
) if not opts.dryrun: qs.generate(d, silent=True, overwrite=opts.force) elif not opts.notoc: create_modules_toc_file(modules, opts) import pkgutil from lantz import Driver import lantz.drivers as drivers from io import StringIO import stringparser as parser company_parser = parser.Parser('{_}:company:{:s}', parser.M) def list_drivers(key, module): buf = StringIO() for element in dir(module): if element.startswith('_'): continue el = getattr(module, element) if isinstance(el, type) and issubclass(el, Driver): print('Driver found: {}.{}'.format(key, element)) doc1 = (el.__doc__ or element).split('\n')[0].strip() buf.write('- :class:`{} <{}.{}>`\n'.format(doc1, key, element)) return buf.getvalue()