bugged stringlengths 4 228k | fixed stringlengths 0 96.3M | __index_level_0__ int64 0 481k |
|---|---|---|
def __enter__(self): if self.is_traffic_shaping: self.platformsettings.ipfw(['delete', self.pipe_set]) if (self.up_bandwidth == '0' and self.down_bandwidth == '0' and self.delay_ms == '0' and self.packet_loss_rate == '0'): return try: upload_pipe = '1' # The IPFW pipe for upload rules. download_pipe = '2' # The... | def __enter__(self): if self.is_traffic_shaping: self.platformsettings.ipfw(['delete', self.pipe_set]) if (self.up_bandwidth == '0' and self.down_bandwidth == '0' and self.delay_ms == '0' and self.packet_loss_rate == '0'): return try: upload_pipe = '1' # The IPFW pipe for upload rules. download_pipe = '2' # The... | 455,900 |
def __enter__(self): if self.is_traffic_shaping: self.platformsettings.ipfw(['delete', self.pipe_set]) if (self.up_bandwidth == '0' and self.down_bandwidth == '0' and self.delay_ms == '0' and self.packet_loss_rate == '0'): return try: upload_pipe = '1' # The IPFW pipe for upload rules. download_pipe = '2' # The... | def __enter__(self): if self.is_traffic_shaping: self.platformsettings.ipfw(['delete', self.pipe_set]) if (self.up_bandwidth == '0' and self.down_bandwidth == '0' and self.delay_ms == '0' and self.packet_loss_rate == '0'): return try: upload_pipe = '1' # The IPFW pipe for upload rules. download_pipe = '2' # The... | 455,901 |
def __enter__(self): if self.is_traffic_shaping: self.platformsettings.ipfw(['delete', self.pipe_set]) if (self.up_bandwidth == '0' and self.down_bandwidth == '0' and self.delay_ms == '0' and self.packet_loss_rate == '0'): return try: upload_pipe = '1' # The IPFW pipe for upload rules. download_pipe = '2' # The... | def __enter__(self): if self.is_traffic_shaping: self.platformsettings.ipfw(['delete', self.pipe_set]) if (self.up_bandwidth == '0' and self.down_bandwidth == '0' and self.delay_ms == '0' and self.packet_loss_rate == '0'): return try: upload_pipe = '1' # The IPFW pipe for upload rules. download_pipe = '2' # The... | 455,902 |
def format_description(self, description): if description: return description + '\n' else: return '' | def format_description(self, description): if description: return description + '\n' else: return '' | 455,903 |
def format_description(self, description): if description: return description + '\n' else: return '' | def format_description(self, description): if description: return description + '\n' else: return '' | 455,904 |
def format_description(self, description): if description: return description + '\n' else: return '' | def format_description(self, description): if description: return description + '\n' else: return '' | 455,905 |
def __enter__(self): if self.is_traffic_shaping: self.platformsettings.ipfw(['delete', self.pipe_set]) if (self.up_bandwidth == '0' and self.down_bandwidth == '0' and self.delay_ms == '0' and self.packet_loss_rate == '0'): return try: upload_pipe = '1' # The IPFW pipe for upload rules. download_pipe = '2' # The... | def __enter__(self): if self.is_traffic_shaping: self.platformsettings.ipfw(['delete', self.pipe_set]) if (self.up_bandwidth == '0' and self.down_bandwidth == '0' and self.delay_ms == '0' and self.packet_loss_rate == '0'): return try: upload_pipe = '1' # The IPFW pipe for upload rules. download_pipe = '2' # The... | 455,906 |
def __enter__(self): if self.is_traffic_shaping: self.platformsettings.ipfw(['delete', self.pipe_set]) if (self.up_bandwidth == '0' and self.down_bandwidth == '0' and self.delay_ms == '0' and self.packet_loss_rate == '0'): return try: upload_pipe = '1' # The IPFW pipe for upload rules. download_pipe = '2' # The... | def __enter__(self): if self.is_traffic_shaping: self.platformsettings.ipfw(['delete', self.pipe_set]) if (self.up_bandwidth == '0' and self.down_bandwidth == '0' and self.delay_ms == '0' and self.packet_loss_rate == '0'): return try: upload_pipe = '1' # The IPFW pipe for upload rules. download_pipe = '2' # The... | 455,907 |
def ApplyStatisticsData(request, obj): """Applies statistics uploaded via the request to the object.""" obj.using_spdy = bool(request.get('using_spdy')=="CHECKED") obj.start_load_time = int(request.get('start_load_time')) obj.commit_load_time = int(request.get('commit_load_time')) obj.doc_load_time = int(request.get('d... | def ApplyStatisticsData(request, obj): """Applies statistics uploaded via the request to the object.""" obj.using_spdy = bool(request.get('using_spdy')=="CHECKED") obj.start_load_time = int(request.get('start_load_time')) obj.commit_load_time = int(request.get('commit_load_time')) obj.doc_load_time = int(request.get('d... | 455,908 |
def _IOW(type,nr,size): return _IOC(_IOC_WRITE, type, nr, sizeof(size)) | def _IOW(type,nr,size): return _IOC(_IOC_WRITE, type, nr, sizeof(size)) | 455,909 |
def _IOW(type,nr,size): return _IOC(_IOC_WRITE, type, nr, sizeof(size)) | def _IOW(type,nr,size): return _IOC(_IOC_WRITE, type, nr, sizeof(size)) | 455,910 |
def _IOW(type,nr,size): return _IOC(_IOC_WRITE, type, nr, sizeof(size)) | def _IOW(type,nr,size): return _IOC(_IOC_WRITE, type, nr, sizeof(size)) | 455,911 |
def __iter__(self): return self | def__iter__(self):returnself | 455,912 |
def readlines(self, sizehint=None, eol='\n'): """read a list of lines, until timeout. sizehint is ignored.""" if self.timeout is None: raise ValueError("Serial port MUST have enabled timeout for this function!") lines = [] while True: line = self.readline(eol=eol) if line: lines.append(line) if line[-1] != eol: # wa... | def readlines(self, sizehint=None, eol=LF): """read a list of lines, until timeout. sizehint is ignored.""" if self.timeout is None: raise ValueError("Serial port MUST have enabled timeout for this function!") lines = [] while True: line = self.readline(eol=eol) if line: lines.append(line) if line[-1] != eol: # was ... | 455,913 |
def __init__(self, port = None, # number of device, numbering starts at # zero. if everything fails, the user # can specify a device string, note # that this isn't portable anymore # port will be opened if one is specified baudrate=9600, # baud rate bytesize=EIGHTBITS, # number of data bits parity=... | def __init__(self, port = None, # number of device, numbering starts at # zero. if everything fails, the user # can specify a device string, note # that this isn't portable anymore # port will be opened if one is specified baudrate=9600, # baud rate bytesize=EIGHTBITS, # number of data bits parity=... | 455,914 |
def data(string): return bytes(string, 'latin1') | def data(string): return bytes(string, 'latin1') | 455,915 |
def read(self, size=1): """Read size bytes from the serial port. If a timeout is set it may return less characters as requested. With no timeout it will block until the requested number of bytes is read.""" if self.fd is None: raise portNotOpenError read = bytearray() poll = select.poll() poll.register(self.fd, select.... | def read(self, size=1): """Read size bytes from the serial port. If a timeout is set it may return less characters as requested. With no timeout it will block until the requested number of bytes is read.""" if self.fd is None: raise portNotOpenError read = bytearray() poll = select.poll() poll.register(self.fd, select.... | 455,916 |
def readline(self, size=None, eol='\n'): """read a line which is terminated with end-of-line (eol) character ('\n' by default) or until timeout""" line = '' while 1: c = self.read(1) if c: line += c # not very efficient but lines are usually not that long if c == eol: break if size is not None and len(line) >= size: ... | def readline(self, size=None, eol='\n'): """read a line which is terminated with end-of-line (eol) character ('\n' by default) or until timeout""" line = bytearray() while 1: c = self.read(1) if c: line += c # not very efficient but lines are usually not that long if c == eol: break if size is not None and len(line) ... | 455,917 |
def readline(self, size=None, eol='\n'): """read a line which is terminated with end-of-line (eol) character ('\n' by default) or until timeout""" line = '' while 1: c = self.read(1) if c: line += c # not very efficient but lines are usually not that long if c == eol: break if size is not None and len(line) >= size: ... | def readline(self, size=None, eol='\n'): """read a line which is terminated with end-of-line (eol) character ('\n' by default) or until timeout""" line = '' while 1: c = self.read(1) if c: line += c # not very efficient but lines are usually not that long if c == eol: break if size is not None and len(line) >= size: ... | 455,918 |
def read(self, size=1): """Read size bytes from the serial port. If a timeout is set it may return less characters as requested. With no timeout it will block until the requested number of bytes is read.""" if not self.hComPort: raise portNotOpenError if size > 0: win32.ResetEvent(self._overlappedRead.hEvent) flags = w... | def read(self, size=1): """Read size bytes from the serial port. If a timeout is set it may return less characters as requested. With no timeout it will block until the requested number of bytes is read.""" if not self.hComPort: raise portNotOpenError if size > 0: win32.ResetEvent(self._overlappedRead.hEvent) flags = w... | 455,919 |
def nonblocking(self): """internal - not portable!""" if self.fd is None: raise portNotOpenError fcntl.fcntl(self.fd, FCNTL.F_SETFL, FCNTL.O_NONBLOCK) | def nonblocking(self): """internal - not portable!""" if self.fd is None: raise portNotOpenError fcntl.fcntl(self.fd, FCNTL.F_SETFL, FCNTL.O_NONBLOCK) | 455,920 |
def collect(self, vs=None, rs=None): """ Collect data. | def collect(self, vs=None, rs=None): """ Collect data. | 455,921 |
def age(self, ctx, lb=None, vs=None, rs=None, sorry=False): """ Return the age of the given resource. | def age(self, ctx, lb=None, vs=None, rs=None, sorry=False): """ Return the age of the given resource. | 455,922 |
def childFactory(self, ctx, name): """ Dispatch the search to the generic search handler. """ return SearchGenericResource(self.dbpool, name) | def childFactory(self, ctx, name): """ Dispatch the search to the generic search handler. """ return SearchGenericResource(self.dbpool, name) | 455,923 |
def search(self, ctx): """ Run the search query and prefix the results with API URL. """ api = IApiVersion(ctx) d = self.dbpool.runQueryInPast(ctx, self.query(), {'term': self.term}) d.addCallback(lambda results: ["/api/%s/%s" % (api, y[0]) for y in results]) return d | def search(self, ctx): """ Run the search query. """ api = IApiVersion(ctx) d = self.dbpool.runQueryInPast(ctx, self.query(), {'term': self.term}) d.addCallback(lambda results: ["/api/%s/%s" % (api, y[0]) for y in results]) return d | 455,924 |
def search(self, ctx): """ Run the search query and prefix the results with API URL. """ api = IApiVersion(ctx) d = self.dbpool.runQueryInPast(ctx, self.query(), {'term': self.term}) d.addCallback(lambda results: ["/api/%s/%s" % (api, y[0]) for y in results]) return d | def search(self, ctx): """ Run the search query and prefix the results with API URL. """ d = self.dbpool.runQueryInPast(ctx, self.query(), {'term': self.term}) d.addCallback(lambda results: ["/api/%s/%s" % (api, y[0]) for y in results]) return d | 455,925 |
def search(self, ctx): """ Run the search query and prefix the results with API URL. """ api = IApiVersion(ctx) d = self.dbpool.runQueryInPast(ctx, self.query(), {'term': self.term}) d.addCallback(lambda results: ["/api/%s/%s" % (api, y[0]) for y in results]) return d | def search(self, ctx): """ Run the search query and prefix the results with API URL. """ api = IApiVersion(ctx) d = self.dbpool.runQueryInPast(ctx, self.query(), {'term': self.term}) d.addCallback(lambda results: [y[0] for y in results]) return d | 455,926 |
def query(self): return """ | def query(self): return """ | 455,927 |
def query(self): return """ | def query(self): return """ | 455,928 |
def query(self): return """ | def query(self): return """ | 455,929 |
def query(self): return """ | def query(self): return """ | 455,930 |
def query(self): return """ | def query(self): return """ | 455,931 |
def parse(self, vs=None, rs=None): """ Parse vs and rs into v, s, g, r. """ if vs is not None: mo = re.match(r"v(\d+)s(\d+)g(\d+)", vs) if not mo: raise ValueError("%r is not a valid virtual server" % vs) v, s, g = int(mo.group(1)), int(mo.group(2)), int(mo.group(3)) if rs is not None: mo = re.match(r"[rb](\d+)", rs) i... | def parse(self, vs=None, rs=None): """ Parse vs and rs into v, s, g, r. """ if vs is not None: mo = re.match(r"v(\d+)s(\d+)g(\d+)", vs) if not mo: raise ValueError("%r is not a valid virtual server" % vs) v, s, g = int(mo.group(1)), int(mo.group(2)), int(mo.group(3)) if rs is not None: mo = re.match(r"([rb])(\d+)", rs)... | 455,932 |
def parse(self, vs=None, rs=None): """ Parse vs and rs into v, s, g, r. """ if vs is not None: mo = re.match(r"v(\d+)s(\d+)g(\d+)", vs) if not mo: raise ValueError("%r is not a valid virtual server" % vs) v, s, g = int(mo.group(1)), int(mo.group(2)), int(mo.group(3)) if rs is not None: mo = re.match(r"[rb](\d+)", rs) i... | def parse(self, vs=None, rs=None): """ Parse vs and rs into v, s, g, r. """ if vs is not None: mo = re.match(r"v(\d+)s(\d+)g(\d+)", vs) if not mo: raise ValueError("%r is not a valid virtual server" % vs) v, s, g = int(mo.group(1)), int(mo.group(2)), int(mo.group(3)) if rs is not None: mo = re.match(r"[rb](\d+)", rs) i... | 455,933 |
def collect(self, vs=None, rs=None): """ Collect data for an Alteon """ v, s, g, r = self.parse(vs, rs) if v is not None: if r is not None: # Collect data to refresh a specific real server d = self.process_rs(v, s, g, r) else: # Collect data to refresh a virtual server d = self.process_vs(v, s, g) else: # Otherwise, co... | def collect(self, vs=None, rs=None): """ Collect data for an Alteon """ v, s, g, r, backup = self.parse(vs, rs) if v is not None: if r is not None: # Collect data to refresh a specific real server d = self.process_rs(v, s, g, r) else: # Collect data to refresh a virtual server d = self.process_vs(v, s, g) else: # Other... | 455,934 |
def collect(self, vs=None, rs=None): """ Collect data for an Alteon """ v, s, g, r = self.parse(vs, rs) if v is not None: if r is not None: # Collect data to refresh a specific real server d = self.process_rs(v, s, g, r) else: # Collect data to refresh a virtual server d = self.process_vs(v, s, g) else: # Otherwise, co... | def collect(self, vs=None, rs=None): """ Collect data for an Alteon """ v, s, g, r = self.parse(vs, rs) if v is not None: if r is not None: # Collect data to refresh a specific real server d = self.process_rs(v, s, g, r, backup) else: # Collect data to refresh a virtual server d = self.process_vs(v, s, g) else: # Other... | 455,935 |
def actions(self, vs=None, rs=None): """ List possible actions. | def actions(self, vs=None, rs=None): """ List possible actions. | 455,936 |
def execute(self, action, actionargs=None, vs=None, rs=None): """ Execute an action. | def execute(self, action, actionargs=None, vs=None, rs=None): """ Execute an action. | 455,937 |
def process_vs(self, v, s, g): """ Process data for a given virtual server when no real server is provided | def process_vs(self, v, s, g): """ Process data for a given virtual server when no real server is provided | 455,938 |
def process_vs(self, v, s, g): """ Process data for a given virtual server when no real server is provided | def process_vs(self, v, s, g): """ Process data for a given virtual server when no real server is provided | 455,939 |
def parse(self, vs=None, rs=None): """ Parse vs and rs into owner, content, rs """ if vs is not None: mo = re.match(r"(.*)|(.*)", vs) if not mo: raise ValueError("%r is not a valid virtual server" % vs) owner, content = mo.groups() return owner, content, rs return None, None, None | def parse(self, vs=None, rs=None): """ Parse vs and rs into owner, content, rs """ if vs is not None: mo = re.match(r"(.*)\|(.*)", vs) if not mo: raise ValueError("%r is not a valid virtual server" % vs) owner, content = mo.groups() return owner, content, rs return None, None, None | 455,940 |
def collect(self, vs=None, rs=None): """ Collect data. | def collect(self, vs=None, rs=None): """ Collect data. | 455,941 |
def process_vs(self, owner, content): """ Process data for a given virtual server when no real server is provided | def process_vs(self, owner, content): """ Process data for a given virtual server when no real server is provided | 455,942 |
def process_vs(self, owner, content): """ Process data for a given virtual server when no real server is provided | def process_vs(self, owner, content): """ Process data for a given virtual server when no real server is provided | 455,943 |
def process_rs(self, service, backup=False): """ Process data for a given virtual server and real server. | def process_rs(self, owner, content, service, backup=False): """ Process data for a given virtual server and real server. | 455,944 |
def process_vs(self, v): """ Process data for a given virtual server when no real server is provided | def process_vs(self, v): """ Process data for a given virtual server when no real server is provided | 455,945 |
def nogateway(x): request.setResponseCode(504) # Gateway timeout return "No gateway available" | def nogateway(): request.setResponseCode(504) # Gateway timeout return "No gateway available" | 455,946 |
def execute_and_refresh(collector): d = collector.execute(action, actionargs, vs, rs) # We refresh only if the result is not None (action has # been executed) We don't alter the original result. Don't # refresh a whole load balancer. if vs is not None or rs is not None: d.addBoth(lambda x: x is not None and collector.c... | def execute_and_refresh(collector): d = collector.execute(action, actionargs, vs, rs) # We refresh only if the result is not None (action has # been executed) We don't alter the original result. Don't # refresh a whole load balancer. if vs is not None or rs is not None: d.addBoth(lambda x: refresh(x)) return d | 455,947 |
def aggregate_state(states): if not states: return "ok" state = states[0] for rstate in state[1:]: if rstate == "ok": if cur == "disabled": state = "ok" continue if cur == "down": state = "degraded" continue continue if rstate == "disabled": continue if rstate == "down": if cur == "ok": state = "degraded" continue if c... | def aggregate_state(states): if not states: return "ok" state = states[0] for rstate in states[1:]: if rstate == "ok": if cur == "disabled": state = "ok" continue if cur == "down": state = "degraded" continue continue if rstate == "disabled": continue if rstate == "down": if cur == "ok": state = "degraded" continue if ... | 455,948 |
def aggregate_state(states): if not states: return "ok" state = states[0] for rstate in state[1:]: if rstate == "ok": if cur == "disabled": state = "ok" continue if cur == "down": state = "degraded" continue continue if rstate == "disabled": continue if rstate == "down": if cur == "ok": state = "degraded" continue if c... | def aggregate_state(states): if not states: return "ok" state = states[0] for rstate in state[1:]: if rstate == "ok": if state == "disabled": state = "ok" continue if cur == "down": state = "degraded" continue continue if rstate == "disabled": continue if rstate == "down": if cur == "ok": state = "degraded" continue if... | 455,949 |
def aggregate_state(states): if not states: return "ok" state = states[0] for rstate in state[1:]: if rstate == "ok": if cur == "disabled": state = "ok" continue if cur == "down": state = "degraded" continue continue if rstate == "disabled": continue if rstate == "down": if cur == "ok": state = "degraded" continue if c... | def aggregate_state(states): if not states: return "ok" state = states[0] for rstate in state[1:]: if rstate == "ok": if cur == "disabled": state = "ok" continue if state == "down": state = "degraded" continue continue if rstate == "disabled": continue if rstate == "down": if cur == "ok": state = "degraded" continue if... | 455,950 |
def aggregate_state(states): if not states: return "ok" state = states[0] for rstate in state[1:]: if rstate == "ok": if cur == "disabled": state = "ok" continue if cur == "down": state = "degraded" continue continue if rstate == "disabled": continue if rstate == "down": if cur == "ok": state = "degraded" continue if c... | def aggregate_state(states): if not states: return "ok" state = states[0] for rstate in state[1:]: if rstate == "ok": if cur == "disabled": state = "ok" continue if cur == "down": state = "degraded" continue continue if rstate == "disabled": continue if rstate == "down": if state == "ok": state = "degraded" continue if... | 455,951 |
def aggregate_state(states): if not states: return "ok" state = states[0] for rstate in state[1:]: if rstate == "ok": if cur == "disabled": state = "ok" continue if cur == "down": state = "degraded" continue continue if rstate == "disabled": continue if rstate == "down": if cur == "ok": state = "degraded" continue if c... | def aggregate_state(states): if not states: return "ok" state = states[0] for rstate in state[1:]: if rstate == "ok": if state == "disabled": state = "ok" continue if cur == "down": state = "degraded" continue continue if rstate == "disabled": continue if rstate == "down": if cur == "ok": state = "degraded" continue if... | 455,952 |
def main(config_file, fc_dir, run_info_yaml=None): work_dir = os.getcwd() with open(config_file) as in_handle: config = yaml.load(in_handle) if run_info_yaml: with open(run_info_yaml) as in_handle: run_details = yaml.load(in_handle) run_info = dict(details=run_details, run_id="") else: galaxy_api = GalaxyApiAccess(conf... | def main(config_file, fc_dir, run_info_yaml=None): work_dir = os.getcwd() with open(config_file) as in_handle: config = yaml.load(in_handle) if run_info_yaml: with open(run_info_yaml) as in_handle: run_details = yaml.load(in_handle) run_info = dict(details=run_details, run_id="") else: galaxy_api = GalaxyApiAccess(conf... | 455,953 |
def do_alignment(fastq1, fastq2, align_ref, sam_ref, lane_name, sample_name, align_dir, config, config_file): """Align to the provided reference genome, returning an aligned SAM file. """ aligner_to_use = config["algorithm"]["aligner"] if not os.path.exists(align_dir): os.makedirs(align_dir) print lane_name, "Aligning ... | def do_alignment(fastq1, fastq2, align_ref, sam_ref, lane_name, sample_name, align_dir, config, config_file): """Align to the provided reference genome, returning an aligned SAM file. """ aligner_to_use = config["algorithm"]["aligner"] if not os.path.exists(align_dir): try: os.makedirs(align_dir) except OSError: pass... | 455,954 |
def _read_amqp_config(galaxy_config): """Read connection information on the RabbitMQ server from Galaxy config. """ config = ConfigParser.ConfigParser() config.read(galaxy_config) amqp_config = {} for option in config.options("galaxy_amqp"): amqp_config[option] = config.get("galaxy_amqp", option) return amqp_config | def _read_amqp_config(galaxy_config): """Read connection information on the RabbitMQ server from Galaxy config. """ config = ConfigParser.ConfigParser() config.read(galaxy_config) amqp_config = {} for option in config.options("galaxy_amqp"): amqp_config[option] = config.get("galaxy_amqp", option) return amqp_config | 455,955 |
def search_connections (c): i=0 #seraching for a specific box in memory for connections in memory_connections: if c==connections: return i i+=1 #return -1 if not if i==len(memory_connections): return -1 else: return i | def search_connections (c): i=0 #seraching for a specific box in memory for connections in memory_connections: if c==connections: return i i+=1 #return -1 if not if i==len(memory_connections): return -1 | 455,956 |
def create(self): b1 = search_box(self.box_orig) b2 = search_box(self.box_dest) | def create(self): b1 = search_box(self.box_orig) b2 = search_box(self.box_dest) | 455,957 |
def create(self): b1 = search_box(self.box_orig) b2 = search_box(self.box_dest) | def create(self): b1 = search_box(self.box_orig) b2 = search_box(self.box_dest) | 455,958 |
def create(self): b1 = search_box(self.box_orig) b2 = search_box(self.box_dest) | def create(self): b1 = search_box(self.box_orig) b2 = search_box(self.box_dest) | 455,959 |
def delete(self): b1 = search_box(self.box_orig) b2 = search_box(self.box_dest) if (b1 > -1) & (b2 > -1): #get the state before removing the connection self.snd.send_pd("pd-new menusave ; ") sleep(0.1) t1 = self.snd.get_file() #try to remove the connection command = Connection.canvas + "disconnect " + str(b1) + " " + ... | def delete(self): b1 = search_box(self.box_orig) b2 = search_box(self.box_dest) if (b1 > -1) & (b2 > -1): #get the state before removing the connection self.snd.send_pd("pd-new menusave ; ") sleep(0.01) t1 = self.snd.get_file() #try to remove the connection command = Connection.canvas + "disconnect " + str(b1) + " " +... | 455,960 |
def delete(self): b1 = search_box(self.box_orig) b2 = search_box(self.box_dest) if (b1 > -1) & (b2 > -1): #get the state before removing the connection self.snd.send_pd("pd-new menusave ; ") sleep(0.1) t1 = self.snd.get_file() #try to remove the connection command = Connection.canvas + "disconnect " + str(b1) + " " + ... | def delete(self): b1 = search_box(self.box_orig) b2 = search_box(self.box_dest) if (b1 > -1) & (b2 > -1): #get the state before removing the connection self.snd.send_pd("pd-new menusave ; ") sleep(0.01) t1 = self.snd.get_file() #try to remove the connection command = Connection.canvas + "disconnect " + str(b1) + " " +... | 455,961 |
def delete(self): b1 = search_box(self.box_orig) b2 = search_box(self.box_dest) if (b1 > -1) & (b2 > -1): #get the state before removing the connection self.snd.send_pd("pd-new menusave ; ") sleep(0.1) t1 = self.snd.get_file() #try to remove the connection command = Connection.canvas + "disconnect " + str(b1) + " " + ... | def delete(self): b1 = search_box(self.box_orig) b2 = search_box(self.box_dest) if (b1 > -1) & (b2 > -1): #get the state before removing the connection self.snd.send_pd("pd-new menusave ; ") sleep(0.1) t1 = self.snd.get_file() #try to remove the connection command = Connection.canvas + "disconnect " + str(b1) + " " + ... | 455,962 |
def delete(self): b1 = search_box(self.box_orig) b2 = search_box(self.box_dest) if (b1 > -1) & (b2 > -1): #get the state before removing the connection self.snd.send_pd("pd-new menusave ; ") sleep(0.1) t1 = self.snd.get_file() #try to remove the connection command = Connection.canvas + "disconnect " + str(b1) + " " + ... | def delete(self): b1 = search_box(self.box_orig) b2 = search_box(self.box_dest) if (b1 > -1) & (b2 > -1): #get the state before removing the connection self.snd.send_pd("pd-new menusave ; ") sleep(0.1) t1 = self.snd.get_file() #try to remove the connection command = Connection.canvas + "disconnect " + str(b1) + " " + ... | 455,963 |
def debug_symbol(): pd = Communication(False) pd.init_pd() s = Symbol(10, 10, 0) command = "symbolatom " + str(s.x) + " " + str(s.y) + " 10 0 0 0 - - pyata ;" print command pd.send_pd(command) sleep(2) command = s.set("mesa") print command pd.send_pd(command) sleep(2) pd.finish_pd() | def debug_symbol(): pd = Communication(False) pd.init_pd() s = Symbol(10, 10, 0) command = "obj " + str(s.x) + " " + str(s.y) + " sym ;" print command pd.send_pd(command) sleep(2) command = s.set("mesa") print command pd.send_pd(command) sleep(2) pd.finish_pd() | 455,964 |
def debug_message(): pd = Communication(False) pd.init_pd() m = Message(10, 10, "alo", 0) command = "msg " + str(m.x) + " " + str(m.y) + " " + m.text + " ; " print command pd.send_pd(command) sleep(2) command = m.click() print command pd.send_pd(command) sleep(2) command = "editmode 1 ;" print command pd.send_pd(co... | def debug_message(): pd = Communication(False) pd.init_pd() m = Message(10, 10, "alo", 0) command = "msg " + str(m.x) + " " + str(m.y) + " " + m.text + " ; " print command pd.send_pd(command) sleep(2) command = m.click() print command pd.send_pd(command) sleep(2) command = "editmode 1 ;" print command pd.send_pd(co... | 455,965 |
def check_root(self, ids): "Check Root" account_obj = self.pool.get('analytic_account.account') | def check_root(self, ids): "Check Root" account_obj = self.pool.get('analytic_account.account') | 455,966 |
def test0005views(self): ''' Test views. ''' self.assertRaises(Exception, test_view('analytic_account')) | def test0005views(self): ''' Test views. ''' self.assertRaises(Exception, test_view('analytic_account')) | 455,967 |
def notify_dbus(args): args = args.split(':') return [NOTIFIER_DBUS, '-i', 'gtk-dialog-info', '-t', '5000', ':'.join(args[1:]), args[0]] | def notify_dbus(args): args = args.split(':') return [NOTIFIER_DBUS, '-i', 'gtk-dialog-info', '-t', '5000', ':'.join(args[1:]), args[0]] | 455,968 |
def notify_dbus(args): args = args.split(':') return [NOTIFIER_DBUS, '-i', 'gtk-dialog-info', '-t', '5000', ':'.join(args[1:]), args[0]] | def notify_dbus(args): args = args.split(':') return [NOTIFIER_DBUS, '-i', 'gtk-dialog-info', '-t', '5000', ':'.join(args[1:]), args[0]] | 455,969 |
def __repr__(self): content = repr(self.items()) if self else '' return '%s(%s)' % (self.__class__.__name__, content) | def __repr__(self): content = repr(self.items()) if self else '' return '%s(%s)' % (self.__class__.__name__, content) | 455,970 |
def remove(self, object): """ Looks for the given `object` in the list and removes the first occurrence. | def remove(self, object): """ Looks for the given `object` in the list and removes the first occurrence. | 455,971 |
def set(self, obj, success=True): """ Sets the given `obj` as result, set `sucess` to ``False`` if `obj` is an exception. """ self.value = obj self.success = success if self.callback and success: self.callback(obj) if self.errback and not success: self.errback(obj) with self.condition: self.ready = True self.condition.... | def set(self, obj, success=True): """ Sets the given `obj` as result, set `success` to ``False`` if `obj` is an exception. """ self.value = obj self.success = success if self.callback and success: self.callback(obj) if self.errback and not success: self.errback(obj) with self.condition: self.ready = True self.condition... | 455,972 |
def clear(self): d = self.dict_class() with Assert.raises(TypeError): d.clear() | def clear(self): d = self.dict_class() with Assert.raises(TypeError): d.clear() | 455,973 |
def popitemlist(self): d = self.dict_class({'foo': 'bar'}) Assert(d.popitemlist()) == ('foo', ['bar']) with Assert.raises(KeyError): d.popitemlist() d = self.dict_class({'foo': ['bar', 'baz']}) Assert(d.popitemlist()) == ('foo', ['bar', 'baz']) with Assert.raises(KeyError): d.popitemlist() | def popitemlist(self): d = self.dict_class({'foo': 'bar'}) Assert(d.popitemlist()) == ('foo', ['bar']) with Assert.raises(KeyError): d.popitemlist() d = self.dict_class({'foo': ['bar', 'baz']}) Assert(d.popitemlist()) == ('foo', ['bar', 'baz']) with Assert.raises(KeyError): d.popitemlist() | 455,974 |
def itervalues(self): """ Returns an iterator over the values of all items in insertion order. """ return (self[k] for k in self) | def itervalues(self): """ Returns an iterator over the values of all items in insertion order. """ return (self[k] for k in self) | 455,975 |
def get_cpu_count(default=None): sysconf_name = 'SC_NPROCESSORS_ONLN' if sysconf_name in os.sysconf_names: return os.sysconf('SC_NPROCESSORS_ONLN') if default is not None: return default raise NotImplementedError() | def get_cpu_count(default=None): try: cpu_count = os.sysconf('SC_NPROCESSORS_ONLN') if cpu_count >= 1: return cpu_count except AttributeError, ValueError: if default is not None: return default raise NotImplementedError() | 455,976 |
def combinations_with_replacement(iterable, r): """ Return `r` length subsequences of elements from the `iterable` allowing individual elements to be replaced more than once. Combinations are emitted in lexicographic sort order. So, if the input `iterable` is sorted, the combinations tuples will be produced in sorted ... | def combinations_with_replacement(iterable, r): """ Return `r` length sub-sequences of elements from the `iterable` allowing individual elements to be replaced more than once. Combinations are emitted in lexicographic sort order. So, if the input `iterable` is sorted, the combinations tuples will be produced in sorted... | 455,977 |
def __and__(self, other): if not isinstance(other, self.__class__): return NotImplemented result = Counter() if len(self) < len(other): self, other = other, self for element in ifilter(self.__contains__, other): newcount = min(self[element], other[element]) if newcount > 0: result[element] = newcount return result | def __and__(self, other): if not isinstance(other, self.__class__): return NotImplemented result = Counter() if len(self) < len(other): self, other = other, self for element in ifilter(self.__contains__, other): newcount = min(self[element], other[element]) if newcount > 0: result[element] = newcount return result | 455,978 |
def get_cpu_count(default=None): if sys.platform == 'win32': try: return int(os.environ['NUMBER_OF_PROCESSORS']) except ValueError, KeyError: # value could be anything or not existing pass if sys.platform in ('bsd', 'darwin'): try: return int(os.popen('sysctl -n hw.ncpu').read()) except ValueError: # don't trust the ou... | def get_cpu_count(default=None): if sys.platform == 'win32': try: return int(os.environ['NUMBER_OF_PROCESSORS']) except (ValueError, KeyError): # value could be anything or not existing pass if sys.platform in ('bsd', 'darwin'): try: return int(os.popen('sysctl -n hw.ncpu').read()) except ValueError: # don't trust the ... | 455,979 |
def get_cpu_count(default=None): if sys.platform == 'win32': try: return int(os.environ['NUMBER_OF_PROCESSORS']) except ValueError, KeyError: # value could be anything or not existing pass if sys.platform in ('bsd', 'darwin'): try: return int(os.popen('sysctl -n hw.ncpu').read()) except ValueError: # don't trust the ou... | def get_cpu_count(default=None): if sys.platform == 'win32': try: return int(os.environ['NUMBER_OF_PROCESSORS']) except ValueError, KeyError: # value could be anything or not existing pass if sys.platform in ('bsd', 'darwin'): try: return int(os.popen('sysctl -n hw.ncpu').read()) except ValueError: # don't trust the ou... | 455,980 |
def find_crosses(satellite1, start, end, satellite2='calipso', t_window=2, lon_range=None, lat_range=None): """Use snotimes to find satellite passes where the given *satellite* crosses CALIPSO's path within a time window *t_window*. Sort out any cross points which are outside *lon_range* and/or *lat_range*.""" import s... | def find_crosses(satellite1, start, end, satellite2='calipso', time_window=20, lon_range=None, lat_range=None): """Use snotimes to find satellite passes where the given *satellite* crosses CALIPSO's path within a time window *t_window*. Sort out any cross points which are outside *lon_range* and/or *lat_range*.""" impo... | 455,981 |
def find_crosses(satellite1, start, end, satellite2='calipso', t_window=2, lon_range=None, lat_range=None): """Use snotimes to find satellite passes where the given *satellite* crosses CALIPSO's path within a time window *t_window*. Sort out any cross points which are outside *lon_range* and/or *lat_range*.""" import s... | def find_crosses(satellite1, start, end, satellite2='calipso', t_window=2, lon_range=None, lat_range=None): """Use snotimes to find satellite passes where the given *satellite* crosses CALIPSO's path within a time window *t_window*. Sort out any cross points which are outside *lon_range* and/or *lat_range*.""" from sub... | 455,982 |
def find_crosses(satellite1, start, end, satellite2='calipso', t_window=2, lon_range=None, lat_range=None): """Use snotimes to find satellite passes where the given *satellite* crosses CALIPSO's path within a time window *t_window*. Sort out any cross points which are outside *lon_range* and/or *lat_range*.""" import s... | def find_crosses(satellite1, start, end, satellite2='calipso', t_window=2, lon_range=None, lat_range=None): """Use snotimes to find satellite passes where the given *satellite* crosses CALIPSO's path within a time window *t_window*. Sort out any cross points which are outside *lon_range* and/or *lat_range*.""" import s... | 455,983 |
def find_crosses(satellite1, start, end, satellite2='calipso', t_window=2, lon_range=None, lat_range=None): """Use snotimes to find satellite passes where the given *satellite* crosses CALIPSO's path within a time window *t_window*. Sort out any cross points which are outside *lon_range* and/or *lat_range*.""" import s... | def find_crosses(satellite1, start, end, satellite2='calipso', t_window=2, lon_range=None, lat_range=None): """Use snotimes to find satellite passes where the given *satellite* crosses CALIPSO's path within a time window *t_window*. Sort out any cross points which are outside *lon_range* and/or *lat_range*.""" import s... | 455,984 |
def parse_range(range): """Parse *range*, which should look like -35.7354:25.1. Return (lower, upper).""" l = range.split(':') return (float(l[0]), float(l[1])) | def parse_range(range): """Parse *range*, which should look like -35.7354:25.1. Return (lower, upper).""" l = range.split(':') return (float(l[0]), float(l[1])) | 455,985 |
def parse_range(range): """Parse *range*, which should look like -35.7354:25.1. Return (lower, upper).""" l = range.split(':') return (float(l[0]), float(l[1])) | def parse_range(range): """Parse *range*, which should look like -35.7354:25.1. Return (lower, upper).""" l = range.split(':') return (float(l[0]), float(l[1])) | 455,986 |
def FindFiles(avhrrfile, avhrr_dir_date): #avhrr_sat = 'NOAA-18' #RESOLUTION = 5 #avhrr_dir_date = ['06','2007','06','2007'] #CL_DIR = "%s/CloudSat/5km/2007/06" %(SAT_DIR) #CAL_DIR = "%s/Calipso/5km/2007/06" %(SAT_DIR) #AVHRR_DIR = "%s/%s/5km/2007/06" %(SAT_DIR,avhrr_sat) #cloudtypefile = 'noaa18_20070622_1208_10760_s... | def FindFiles(avhrrfile, avhrr_dir_date): #avhrr_sat = 'NOAA-18' #RESOLUTION = 5 #avhrr_dir_date = ['06','2007','06','2007'] #CL_DIR = "%s/CloudSat/5km/2007/06" %(SAT_DIR) #CAL_DIR = "%s/Calipso/5km/2007/06" %(SAT_DIR) #AVHRR_DIR = "%s/%s/5km/2007/06" %(SAT_DIR,avhrr_sat) #cloudtypefile = 'noaa18_20070622_1208_10760_s... | 455,987 |
def CalculateStatistics(mode, clsatObj, statfile, caObj, cal_MODIS_cflag, cal_vert_feature, avhrr_ctth_csat_ok, data_ok, cal_data_ok, avhrr_ctth_cal_ok, caliop_max_height, process_calipso_ok, Resolution): import Scientific.Statistics import numpy | def CalculateStatistics(mode, clsatObj, statfile, caObj, cal_MODIS_cflag, cal_vert_feature, avhrr_ctth_csat_ok, data_ok, cal_data_ok, avhrr_ctth_cal_ok, caliop_max_height, process_calipso_ok, Resolution): import Scientific.Statistics import numpy | 455,988 |
def plotSatelliteTrajectory(cllon,cllat,calon,calat,avhrlon,avhrlat,trajectoryname): from mpl_toolkits.basemap import Basemap import pylab #import pdb #pdb.set_trace() #from setup import AREA upplosning = len(cllon)/500 print('Resolution = %i' %(upplosning)) m = Basemap(projection='cyl',llcrnrlat=-90,urcrnrlat=90,\ ll... | def plotSatelliteTrajectory(cllon,cllat,calon,calat,avhrlon,avhrlat,trajectoryname): from mpl_toolkits.basemap import Basemap import pylab #import pdb #pdb.set_trace() #from setup import AREA N = len(cllon)/500 + 2 upplosning = len(cllon)/N print('Resolution = %i' %(upplosning)) m = Basemap(projection='cyl',llcrnrlat... | 455,989 |
def getCaliopAvhrrMatch(avhrrfile,calipsofile,ctypefile,ctthfile,surftfile,sunanglefile): import string,os import pps_io import epshdf import Numeric basename = os.path.basename(ctypefile).split(".h5")[0] base_sat = basename.split("_")[-8] base_year = basename.split("_")[-7][0:4] base_month = basename.split("_")[-7][4... | def getCaliopAvhrrMatch(avhrrfile,calipsofile,ctypefile,ctthfile,surftfile,sunanglefile): import string,os import pps_io import epshdf import Numeric basename = os.path.basename(ctypefile).split(".h5")[0] base_sat = basename.split("_")[-8] base_year = basename.split("_")[-7][0:4] base_month = basename.split("_")[-7][4... | 455,990 |
def getCaliopAvhrrMatch(avhrrfile,calipsofile,ctypefile,ctthfile,surftfile,sunanglefile): import string,os import pps_io import epshdf import Numeric basename = os.path.basename(ctypefile).split(".h5")[0] base_sat = basename.split("_")[-8] base_year = basename.split("_")[-7][0:4] base_month = basename.split("_")[-7][4... | def getCaliopAvhrrMatch(avhrrfile,calipsofile,ctypefile,ctthfile,surftfile,sunanglefile): import string,os import pps_io import epshdf import Numeric basename = os.path.basename(ctypefile).split(".h5")[0] base_sat = basename.split("_")[-8] base_year = basename.split("_")[-7][0:4] base_month = basename.split("_")[-7][4... | 455,991 |
def current_day_price(self): return self.price_set.all()[0] | def current_day_price(self): return self.price_set.all()[0] | 455,992 |
def previous_day_price(self): return self.price_set.all()[1] | def previous_day_price(self): return self.price_set.all()[1] | 455,993 |
def latest_15_day_price_set(self): return self.price_set.all()[:15] | def latest_15_day_price_set(self): return self.price_set.all()[:15] | 455,994 |
def last_52_week_price_set(self): try: self._last_52_week_price_set except AttributeError: until_date = self.price_set.all()[0].date from_date = until_date - timedelta(52*7) self._last_52_week_price_set = self.price_set.filter(date__gt=from_date, date__lte=until_date) return self._last_52_week_price_set | def last_52_week_price_set(self): try: self._last_52_week_price_set except AttributeError: current_day_price = self.current_day_price if current_day_price: until_date = current_day_price.date from_date = until_date - timedelta(52*7) self._last_52_week_price_set = self.price_set.filter(date__gt=from_date, date__lte=unti... | 455,995 |
def softthreshold(img,T): ''' softthreshold(img,T) Implement a soft threshold: img[i] = max(img[i]-T,0) Processes the image inplace, return a reference to img. Use B = softthreshold(A.copy(),T) to get a copy. @see hardthreshold ''' img -= minimum(img,T) return img | def softthreshold(img,T): ''' softthreshold(img,T) Implement a soft threshold: img[i] = max(img[i]-T,0) Processes the image inplace, return a reference to img. Use B = softthreshold(A.copy(),T) to get a copy. @see hardthreshold ''' img -= np.minimum(img,T) return img | 455,996 |
def rc(img,ignore_zeros=False): """ T = rc(img, ignore_zeros=False) Calculate a threshold according to the RC method. @param ignore_zeros: Whether to ignore zero valued pixels (default: False) """ hist=fullhistogram(img) if ignore_zeros: if hist[0] == img.size: return 0 hist[0]=0 N=hist.size # Precompute most of wha... | def rc(img,ignore_zeros=False): """ T = rc(img, ignore_zeros=False) Calculate a threshold according to the RC method. @param ignore_zeros: Whether to ignore zero valued pixels (default: False) """ hist=fullhistogram(img) if ignore_zeros: if hist[0] == img.size: return 0 hist[0]=0 N=hist.size # Precompute most of wha... | 455,997 |
def murphy_rc(img,ignore_zeros=False): """ T = murphy_rc(img) Calculate a threshold according to Murphy's adaptation of the RC method. @param ignore_zeros: Whether to ignore zero valued pixels (default: False) Murphy's Matlab implementation always ignores zero valued pixels. """ pmax=img.max() return pmax-rc(pmax-img... | def murphy_rc(img,ignore_zeros=False): """ T = murphy_rc(img) Calculate a threshold according to Murphy's adaptation of the RC method. @param ignore_zeros: Whether to ignore zero valued pixels (default: False) Murphy's Matlab implementation always ignores zero valued pixels. """ pmax = img.max() return pmax-rc(pmax-i... | 455,998 |
def test_pyversion(): import sys maj,min,_,_,_ = sys.version_info if (maj,min) < (2,5): print "Your Python interpreter is too old for Pyslic.\nUpgrade to 2.5 or newer.\n" sys.exit(1) | def test_pyversion(): import sys maj,min,_,_,_ = sys.version_info if (maj,min) < (2,5): print "Your Python interpreter is too old for Pyslic.\nUpgrade to 2.5 or newer.\n" sys.exit(1) | 455,999 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.