def __init__(self, *fargs, **args): Backend.__init__(self, *fargs, **args) if "log_path" in args: if "debug" in args: self.debug = args["debug"] else: self.debug = True else: self.debug = False if self.debug: self.setup_logfile("dbpedia", args["log_path"]) if "backend" in args: self.set_backend(args["backend"]) else: self.set_backend(self.default_backend) if len(fargs) > 1: if type(fargs[0]) == str: self.request = fargs else: print('fixme', fargs) sys.exit() else: self.request = fargs if type(self.request) == tuple: self.request = self.request[0]
def __init__(self, *fargs, **args): Backend.__init__(self, *fargs, **args) global program_name self.pymongo["database"] = program_name if "log_path" in args: if "debug" in args: self.debug = args["debug"] else: self.debug = True else: self.debug = False if self.debug: self.setup_logfile(program_name, args["log_path"]) if "backend" in args: self.set_backend(args["backend"]) else: self.set_backend(self.default_backend) if len(fargs) > 1: if type(fargs[0]) == str: self.request = fargs else: print('fixme', fargs) sys.exit() else: self.request = fargs if type(self.request) == tuple: self.request = self.request[0]
def __init__(self, rng_seed=None): global default_dtype Backend.__init__(self, rng_seed=rng_seed, default_dtype=default_dtype.name) self.manual_var_init = False self._session = None
def __init__(self, *fargs, **args): Backend.__init__(self, *fargs, **args) if "log_path" in args: if "debug" in args: self.debug = args["debug"] else: self.debug = True else: self.debug = False if self.debug: self.setup_logfile("isbn", args["log_path"]) if "backend" in args: self._set_backend(args["backend"]) else: self._set_backend(self.default_backend) if len(fargs) > 1: if type(fargs[0]) == str: self.request = fargs else: print('fixme', fargs) sys.exit() else: self.request = fargs if type(self.request) == tuple: self.request = self.request[0]
def __init__(self): jack.attach("stream_grapher") jack.register_port("in_1", jack.IsInput) jack.register_port("in_2", jack.IsInput) jack.register_port("out_1", jack.IsOutput) jack.register_port("out_2", jack.IsOutput) jack.activate() try: jack.connect("system:capture_1", "stream_grapher:in_1") jack.connect("system:capture_2", "stream_grapher:in_2") jack.connect("stream_grapher:out_1", "system:playback_1") jack.connect("stream_grapher:out_2", "system:playback_2") except jack.UsageError: pass buff_size = jack.get_buffer_size() if buff_size < 1024: print >> sys.stderr, "Jack buffer size is %d. If you have sync problems try a buff size >= 1024." % (buff_size, ) self.buff_size = jack.get_buffer_size() sample_rate = jack.get_sample_rate() Backend.__init__(self, ports=2, sample_rate=sample_rate) self.capture = numpy.zeros((2, self.buff_size), 'f') self.output = numpy.zeros((2, self.buff_size), 'f') self.counter = [0] self.last_counter = 0 # Time to sleep between calls to jack.process # R should be at least 1.0 # To never get InputSyncErrors R should be like 2.0 or higher R = 1.2 self.sleep = self.buff_size / float(self.sample_rate) / R
def __init__(self, ports, sample_rate, filename): Backend.__init__(self, ports, sample_rate=sample_rate) sleep = 1. / sample_rate f = open(filename, "r") self.out_queue = Queue.Queue() self.worker = FileReaderWorker(f, self.out_queue, sleep) self.worker.start()
def __init__(self, backend_config): Backend.__init__(self, backend_config) self.logger = None # [NOTE] We have to disable proxies to get some libraries working # (e.g: urllib, scikitlearn) with multiprocessing # due to https://bugs.python.org/issue30385 in OS X if platform.system().startswith("Darwin"): os.environ["no_proxy"] = "*"
def __init__(self, engine_config): Backend.__init__(self, engine_config) try: self.con = MySQLdb.connect(host=dbhost, user=dbuser, passwd=dbpass, db=dbname, charset='utf8') self.logger.info("Connected to MySQL db %s:%s." % (dbhost, dbname)) self.cur = self.con.cursor() except Exception as e: raise BackendError("Error connecting to MySQL db %s:%s: %s" % (dbhost, dbname, e))
def __init__(self, ports, sample_rate, serial_port=PORT, baudrate=BAUDRATE, timeout=0.5): Backend.__init__(self, ports, sample_rate=sample_rate) self.ser = serial.Serial(port=serial_port, baudrate=baudrate, timeout=timeout) self._corr_termocupla = interpolate.interp1d(mv, T)
def __init__(self, host): Backend.__init__(self, host) ThreadMessaging(self) self.LINUXMIN = 5.0 # GB, guessed min. space requirement for Linux # The following flag declarations serve two purposes: # 1) Show which flags are available # 2) Show the defaults ('on' is capitalized) # Flags used to affect partition formatting (fs-type dependent usage): # ext3/4::: i:directory indexing, f: full journal self.FORMATFLAGS = "If" # Flags used to set mount options in /etc/fstab: # a: noatime, m: noauto self.MOUNTFLAGS = "Am" # Default file-system for automatic partitioning self.DEFAULTFS = "ext3" # Available file-systems for formatting self.filesystems = ['ext3', 'ext4', 'reiserfs', 'ext2', 'jfs', 'xfs'] # List of mount-point suggestions self.mountpoints = ['---', '/', '/home', '/boot', '/var', '/opt', '/usr'] # By default use UUID for partitions, and for swap (if # there is one). A problem with using UUID for swaps is that the # partition might get reformatted by another installation, # which would probably change the UUID! self.use_uuid = True self.use_uuid_swap = True # Create a directory for temporary files shutil.rmtree("/tmp/larchin", True) os.mkdir("/tmp/larchin") # For inter-thread communication of errors, etc. self.error = None self.interrupt = None
def __init__(self, port="COM1", timeout=0.1): Backend.__init__(self, ports=16, sample_rate=10) # Unknown sample_rate #self.ser = serial.Serial(port=port, timeout=timeout) #self.ser.flushInput() self._buffer = "" self.f = open("backends/biompedancia_1.log", "r")
def __init__(self): Backend.__init__(self, rhnSQL)
def __init__(self, backend_config): Backend.__init__(self, backend_config) self.logger = None
def __init__(self, ports, freq, sample_rate): Backend.__init__(self, ports, sample_rate=sample_rate) self.generators = [self.generator(freq, sample_rate) for x in range(ports)] self.last_time = time.time()
def __init__(self, engine_config): Backend.__init__(self, engine_config)
def __init__(self, rng_seed=None, default_dtype=theano.config.floatX): Backend.__init__(self, rng_seed=rng_seed, default_dtype=default_dtype)
def __init__(self, backend_config): Backend.__init__(self, backend_config) self.logger = None self.slurm_driver = """
def __init__(self): self._p = pyaudio.PyAudio() Backend.__init__(self, ports=1, sample_rate=SAMPLE_RATE)
def __init__(self, serviceFullName, workDirTop, resultUrlTop, config, debug=False): Backend.__init__(self, serviceFullName, workDirTop, resultUrlTop, config, debug=debug) self.copier = Copier()
def __init__(self, name=None, out_queue=None, root_dir=None): Backend.__init__(self, name, out_queue) self.root_dir = root_dir