Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(22)  |  Call(18)  |  Derive(0)  |  Import(4)
Uses a dot-separated string to look up values from the configuration file.
Falls back on the default values if not found.

        def get_config(key, conf=DEFAULT):
    """
    Uses a dot-separated string to look up values from the configuration file.
    Falls back on the default values if not found.
    """
    temp = conf
    try:
        for query in key.split('.'):
            temp = temp.__getitem__(query)
        return temp
    except Exception, e:
        if conf != DEFAULT:
            return get_config(key)
        else:
            raise KeyError(key)
        


src/t/u/Turk-0.1.1/turk/runtime/bridge.py   Turk(Download)
import os
import turk
from turk import get_config
import urllib, urllib2
import logging
            exit(1)
 
    if not get_config('bridge.debug', conf):
        log.setLevel(logging.WARNING)
 
    jid = JID(get_config('bridge.username', conf))
 
    bus = getattr(dbus, get_config('global.bus', conf))()
 
    server, port = get_config('bridge.server', conf), get_config('bridge.port', conf)

src/t/u/Turk-0.1.1/turk/runtime/spawner.py   Turk(Download)
import yaml
import turk
from turk import get_config
 
log = turk.init_logging('spawner')
    dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
 
    bus_label = get_config('global.bus', conf)
    try:
        bus = getattr(dbus, bus_label)()
    except:
        default_bus = get_config('global.bus')
        bus = getattr(dbus, default_bus)()
 
    if not get_config('spawner.debug', conf):
        log.setLevel(logging.WARNING)
 
    drivers = get_config('spawner.drivers', conf)

src/t/u/Turk-0.1.1/turk/turkctl.py   Turk(Download)
from turk.runtime.bridge import run as run_bridge
from turk.xbeed.xbeed import run as run_xbeed
from turk import get_config, init_logging
 
log = init_logging('turkctl')
def start(conf):
    """
    Starts the Turk Core as a background process. 
    """
    pidfile_path = get_config('turkctl.pidfile', conf)
    print 'stopping Turk...'
 
    pidfile_path = get_config('turkctl.pidfile', conf)
 
    if not os.path.exists(pidfile_path):
def clean(conf):
    """Deletes any data associated with improperly stopped Turk Core"""
 
    pidfile_path = get_config('turkctl.pidfile', conf)
 
    os.environ['TURK_CONF'] = options.config
 
    if not get_config('turkctl.debug', conf):
        log.setLevel(logging.WARNING)
 

src/t/u/Turk-0.1.1/turk/drivers/twitter_fetcher.py   Turk(Download)
        exit(1)
 
    bus = os.getenv('BUS', turk.get_config('global.bus'))
 
    print "TwitterFeed driver started... app id: %u" % (app_id)

src/t/u/Turk-0.1.1/turk/drivers/interactable.py   Turk(Download)
        exit(-1)
 
    bus = os.getenv('BUS', turk.get_config('global.bus'))
 
    print "interacTable driver started... driver id: %u" % device_id

src/t/u/Turk-0.1.1/turk/drivers/rgb_lamp.py   Turk(Download)
    device_id = int(os.getenv('DEVICE_ID'))
    device_addr = int(os.getenv('DEVICE_ADDRESS'), 16)
    bus = os.getenv('BUS', turk.get_config('global.bus'))
    print "RGB Lamp driver started... driver id: %u, target xbee: 0x%X" % (device_id, device_addr)
    dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)

src/t/u/Turk-0.1.1/turk/drivers/pixel_clock.py   Turk(Download)
        exit(-1)
 
    bus = os.getenv('BUS', turk.get_config('global.bus'))
 
    print "Pixel Clock driver started... driver id: %u, target xbee: 0x%X" % (device_id, device_addr)

src/t/u/Turk-0.1.1/turk/xbeed/xbeed.py   Turk(Download)
import dbus.mainloop.glib
 
from turk import get_config, get_configs
import turk