예제 #1
0
파일: low.py 프로젝트: lcrees/crossroads
 def _set(self, key, value):
     opt_key, opt_type = self._opt_type(key)
     if not value and isstring(value):
         new_value = c_char()
     else:
         new_value = opt_type(value)
     self.last_rc = self._setsockopt(
         opt_key,
         byref(new_value),
         len(value) if opt_key == XS.SUBSCRIBE else sizeof(new_value),
     )
     return self.last_rc
예제 #2
0
파일: conf.py 프로젝트: lcrees/stage
 def _load(self, destination, conf):
     # load configuration
     if isstring(conf):
         # load import
         conf = lazyimport(conf)
     if isinstance(conf, _BaseFactory):
         # load configuration from factory
         destination.update(i for i in conf)
     elif isclass(conf):
         # load configuration from class
         newconf = {}
         xpartmap(
             lambda x, y: x({y.pop('classname', 'options'): y}),
             iter(lazyknife(conf).traverse().attrs('maps').merge()),
             newconf.update,
         )
         destination.update(newconf)