rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
"{2} skipped. {3} failed to use.".\ | "{2} skipped. {3} failed to use.").\ | def print_stats(self): if self.disabled: return print("{0} Shownotes scaned. {4} ignored. " + \ "{1} Trackback links discovered. " + \ "{2} skipped. {3} failed to use.".\ format(self.count.links, self.count.tb, self.count.skip,\ self.count.error, self.count.ign)) |
print(";"*20,id) | def new_ds_file_comment(web, id): print(";"*20,id) is_ok, result = get_episode_if_input_is_ok(web, Episode.link == id, exists = ['author','comment','reply'], notempty = ['comment'] ) if is_ok: build_and_save_comment(web, "datenspuren/" + id, result) result = None return result or redirect("/datenspuren/" + id) # FIXM... | |
print(":"*20,id) | def new_ds_file_rating(web, id): print(":"*20,id) is_ok, result = get_episode_if_input_is_ok(web, Episode.link == id, exists = ['score'], notempty = ['score'] ) if is_ok: episode, result = result, None try: score = int(web.input('score')) except: score = None if score is not None: if score in range(1,6): Rating(epis... | |
print("\033[32m* add to db: ",filename,"\033[m") | def main(): log = "" links_count, tb_count, skip_count, error_count = 0, 0, 0, 0 git_test = getoutput("git log --format=%n") if "fatal" in git_test or "--format" in git_test: print("ERROR: your git version is to old.") os.system("git --version") exit(1) if not os.path.exists("cweb.git"): print("* no c3d2-web git repo... | |
try: old = Episode.find().filter_by(filename = filename).one() File.find().filter_by(episode = old.id).delete() Link.find().filter_by(episode = old.id).delete() except: old = 0 | olds = Episode.find().filter_by(filename = filename).all() for old in olds: try: File.find().filter_by(episode = old.id).delete() Link.find().filter_by(episode = old.id).delete() except Exception as e: print("\033[31merrör 1:\033[m",e) | def main(): log = "" links_count, tb_count, skip_count, error_count = 0, 0, 0, 0 git_test = getoutput("git log --format=%n") if "fatal" in git_test or "--format" in git_test: print("ERROR: your git version is to old.") os.system("git --version") exit(1) if not os.path.exists("cweb.git"): print("* no c3d2-web git repo... |
if old: Comment.find().filter_by(episode=old.id).update({'episode':episode.id}) Episode.find().filter_by(id = old.id).delete() | if olds: for old in olds: try: Comment.find().filter_by(episode=old.id).update({'episode':episode.id}) Episode.find().filter_by(id = old.id).delete() except Exception as e: print("\033[31merrör 2:\033[m",e) print("\033[32m* update db: ",filename,"\033[m") else: print("\033[32m* add to db: ",filename,"\033[m") | def main(): log = "" links_count, tb_count, skip_count, error_count = 0, 0, 0, 0 git_test = getoutput("git log --format=%n") if "fatal" in git_test or "--format" in git_test: print("ERROR: your git version is to old.") os.system("git --version") exit(1) if not os.path.exists("cweb.git"): print("* no c3d2-web git repo... |
order_by(Episode.date).limit(20).all() | order_by(Episode.date).all() | def main(web, site): episodes = Episode.find().filter_by(category=site).\ order_by(Episode.date).limit(20).all() episodes.reverse() # FIXME wrap db queries into one comments_count = [ Comment.find().filter_by(episode = e.id).count() for e in episodes ] return template("episodes.tpl", #header_color= head_colors[site], c... |
text = f.read() | try: text = f.read() except: return "" | def fetch_site(url): try: f = urlopen(url,timeout = 3) except: f = None if f and "html" in f.info().get_content_type().lower(): text = f.read() try: return str(text,'utf-8') except: return str(text) else: return "" |
text = f.read() | try: text = f.read() except: return "" | def send_post(link, **data): try: f = urlopen(link,urlencode(data),timeout = 3) except: f = None if f: text = f.read() try: return str(text,'utf-8') except: return text else: return False |
ratings = [ do_the_ratings(0, 0, Rating.find().\ filter_by(episode = e.id).all())['rating'] for e in episodes ] | ratings = [] | def datenspuren(web): # FIXME wrap db queries into one episodes = Episode.find().filter(Episode.category.startswith("ds")).\ order_by(Episode.date).all() episodes.reverse() comments_count = [ Comment.find().filter_by(episode = e.id).count() for e in episodes ] ratings = [ do_the_ratings(0, 0, Rating.find().\ filter_by(... |
ratings += [ do_the_ratings(0, 0, Rating.find().\ filter_by(episode = Episode.find(Episode.id).\ filter_by(filename = f.link, category = "file/{0}/{1}".\ format(episode.category,episode.link)).one().id).all())['rating'] for f in File.find().filter_by(episode = episode.id).all() ] | ids = list(map(lambda e:e.id, Episode.find(Episode.id).\ filter_by(category = "file/{0}/{1}".\ format(episode.category, episode.link)).all())) f_rts = list(Rating.find().filter( Rating.episode.in_(ids)) ) e_rts = list(Rating.find().filter_by(episode = episode.id).all()) ratings += [ do_the_ratings(0, 0, e_rts + f_rts)[... | def datenspuren(web): # FIXME wrap db queries into one episodes = Episode.find().filter(Episode.category.startswith("ds")).\ order_by(Episode.date).all() episodes.reverse() comments_count = [ Comment.find().filter_by(episode = e.id).count() for e in episodes ] ratings = [ do_the_ratings(0, 0, Rating.find().\ filter_by(... |
for episode in episodes: episode.has_screen = True episode.files = File.find().filter_by(episode = episode.id).all() episode.preview = get_preview(Preview.find().\ filter_by(episode = episode.id).all(), episode.files) | def datenspur(web, id, mode): try: # FIXME wrap db queries into one episodes = Episode.find().filter(Episode.category.endswith(id)).\ order_by(Episode.date).all() episodes.reverse() comments_count = [ Comment.find().filter_by(episode = e.id).count() for e in episodes ] ratings = [ do_the_ratings(0, 0, Rating.find().\ f... | |
tb_count += 1 | def main(): log = "" links_count, tb_count, skip_count, error_count, ign_count = 0, 0, 0, 0, 0 git_test = getoutput("git log --format=%n") if "fatal" in git_test or "--format" in git_test: print("ERROR: your git version is to old.") os.system("git --version") exit(1) if not os.path.exists("cweb.git"): print("* no c3d... | |
else: skip_count += 1 | else: tb_count += 1 skip_count += 1 | def main(): log = "" links_count, tb_count, skip_count, error_count, ign_count = 0, 0, 0, 0, 0 git_test = getoutput("git log --format=%n") if "fatal" in git_test or "--format" in git_test: print("ERROR: your git version is to old.") os.system("git --version") exit(1) if not os.path.exists("cweb.git"): print("* no c3d... |
print("{0} Shownotes scaned. {1} Trackback links discovered. {2} skipped. {3} failed to use. {4} ignored".\ | print("{0} Shownotes scaned. {4} ignored. {1} Trackback links discovered. {2} skipped. {3} failed to use.".\ | def main(): log = "" links_count, tb_count, skip_count, error_count, ign_count = 0, 0, 0, 0, 0 git_test = getoutput("git log --format=%n") if "fatal" in git_test or "--format" in git_test: print("ERROR: your git version is to old.") os.system("git --version") exit(1) if not os.path.exists("cweb.git"): print("* no c3d... |
print(style.yellow+"* skip", filename, | print(style.green + style.bold + "* skip", filename, | def fill_database(files, debug=False, trackback=False): tracker = Trackbacker(trackback) for filename in files: category = get_category(filename) if not category or ("penta" not in category and "ds" not in category): print(style.red+"* errör can't categorize ", filename, " found:", category, style.default) continue # ... |
"[id:{0}, slug:{2}, name:{3}]".\ | "[id:{0}, slug:{1}, name:{2}]".\ | def fill_database(files, debug=False, trackback=False): tracker = Trackbacker(trackback) for filename in files: category = get_category(filename) if not category or ("penta" not in category and "ds" not in category): print(style.red+"* errör can't categorize ", filename, " found:", category, style.default) continue # ... |
old = open("res/raw/key.html").read(); | old = None try: old = open("res/raw/key.html").read(); except: pass | def parse_R(file, values): for line in open(file): match = re.search(".*public static final int (.*)=0x(.*);", line) if match: values[match.group(1)] = match.group(2) |
if x.startswith('lib') and (x.endswith('.so') or x.endswith('.dylib')): | if x.startswith(prefix) and x.endswith(extension): | def find_broken_version_symlinks(libdir, mappings): """libdir may be a legacy -devel package containing lib* symlinks whose targets would be provided by the corresponding runtime package. If so, create fixed symlinks under $TMPDIR with the real location.""" for x in os.listdir(libdir): if x.startswith('lib') and (x.end... |
mappings[x[3:-3]] = target | mappings[x[len(prefix):-len(extension)]] = target | def find_broken_version_symlinks(libdir, mappings): """libdir may be a legacy -devel package containing lib* symlinks whose targets would be provided by the corresponding runtime package. If so, create fixed symlinks under $TMPDIR with the real location.""" for x in os.listdir(libdir): if x.startswith('lib') and (x.end... |
self.note("\nDetails of all components and versions considered:") | self.note("\nFailed. Details of all components and versions considered:") | def print_details(self, solver): """Dump debugging details.""" self.note("\nDetails of all components and versions considered:") for iface in solver.details: self.note('\n%s\n' % iface.get_name()) for impl, note in solver.details[iface]: self.note('%s (%s) : %s' % (impl.get_version(), impl.arch or '*-*', note or 'OK'))... |
self.note("\nEnd details") | self.note("\nEnd details\n") | def print_details(self, solver): """Dump debugging details.""" self.note("\nDetails of all components and versions considered:") for iface in solver.details: self.note('\n%s\n' % iface.get_name()) for impl, note in solver.details[iface]: self.note('%s (%s) : %s' % (impl.get_version(), impl.arch or '*-*', note or 'OK'))... |
for (root, dirs, files) in os.walk(os.path.abspath(os.path.join(os.environ['top_builddir'], 'src'))): | for (root, dirs, files) in os.walk(os.path.abspath(os.path.join(os.environ['top_builddir'], 'modules'))): | def start_syslogng(conf, keep_persist=False, verbose=False): global syslogng_pid os.system('rm -f test-*.log test-*.lgs test-*.db wildcard/* log-file') if not keep_persist: os.system('rm -f syslog-ng.persist') if not logstore_store_supported: conf = re.sub('logstore\(.*\);', '', conf) f = open('test.conf', 'w') f.wr... |
version = os.popen('../../src/syslog-ng -V', 'r').read() | version = os.popen('../../syslog-ng/syslog-ng -V', 'r').read() | def is_premium(): version = os.popen('../../src/syslog-ng -V', 'r').read() if version.find('premium-edition') != -1: return True return False |
rc = os.execl('../../src/syslog-ng', '../../src/syslog-ng', '-f', 'test.conf', '--fd-limit', '1024', '-F', verbose_opt, '-p', 'syslog-ng.pid', '-R', 'syslog-ng.persist', '--no-caps', '--enable-core', '--seed') | module_path = '' for (root, dirs, files) in os.walk(os.path.abspath(os.path.join(os.environ['top_builddir'], 'src'))): module_path = ':'.join(map(lambda x: root + '/' + x, dirs)) break rc = os.execl('../../src/syslog-ng', '../../src/syslog-ng', '-f', 'test.conf', '--fd-limit', '1024', '-F', verbose_opt, '-p', 'syslog-n... | def start_syslogng(conf, keep_persist=False, verbose=False): global syslogng_pid os.system('rm -f test-*.log test-*.lgs test-*.db wildcard/* log-file') if not keep_persist: os.system('rm -f syslog-ng.persist') if not logstore_store_supported: conf = re.sub('logstore\(.*\);', '', conf) f = open('test.conf', 'w') f.wr... |
value = self._doc.createTextNode(value) | value = self._doc.createTextNode(str(value)) | def _exportNode(self): """Export the object as a DOM node. """ node = self._getObjectNode('object') for prop in ('title', 'ct_type', 'ct_interface', 'ct_default_location'): child = self._doc.createElement('property') child.setAttribute('name', prop) field = self.context.getField(prop) value = field.getAccessor(self.con... |
self._sglist = {} | self._sglist = [] | def buildgroups(self, *kargs, **kwargs): self._sglist = {} memblist = self._memblist |
if sgname in self._sglist: continue sgctrl = ServerGroupController() sglist = sgctrl.filter(kwargs = { 'group': sgname }) self._sglist[sgname] = [ x.server for x in sglist[0].servers ] | sg = sgctrl.filter(kwargs = { 'group': sgname }).all()[0] if sg not in self._sglist: self._sglist.append(sg) | def buildgroups(self, *kargs, **kwargs): self._sglist = {} memblist = self._memblist |
if perm not in gperms and perm.server.server in self._sglist[memb.server_group.server_group]: | if perm not in gperms and perm.server.server in self._groupmap[memb.server_group.server_group]: | def buildperms(self, *kargs, **kwargs): memblist = self._memblist pctrl = PermissionController() user = self._user gperms = [] |
sglist = kargs[0]['groups'] | sglist = kargs[0]['groupnames'] | def showgroups(self, *kargs, **kwargs): print '\nGroups:' sglist = kargs[0]['groups'] |
try: status = os.fstat(fp.fileno()) if stat.S_ISREG(status.st_mode): fp_size = status.st_size else: | if isinstance(fp, gzip.GzipFile): fp_size = None else: try: status = os.fstat(fp.fileno()) if stat.S_ISREG(status.st_mode): fp_size = status.st_size else: fp_size = None except AttributeError: | def do_grep(self, fp): """ Do a full grep. |
except AttributeError: fp_size = None | def do_grep(self, fp): """ Do a full grep. | |
version='grin %s' % __version__, | def get_grin_arg_parser(parser=None): """ Create the command-line parser. """ if parser is None: parser = argparse.ArgumentParser( description="Search text files for a given regex pattern.", epilog="Bug reports to <enthought-dev@mail.enthought.com>.", version='grin %s' % __version__, formatter_class=argparse.RawDescrip... | |
version='grind %s' % __version__, | def get_grind_arg_parser(parser=None): """ Create the command-line parser for the find-like companion program. """ if parser is None: parser = argparse.ArgumentParser( description="Find text and binary files using similar rules as grin.", epilog="Bug reports to <enthought-dev@mail.enthought.com>.", version='grind %s' %... | |
parser.add_argument('--no-color', action='store_true', default=False, | parser.add_argument('--no-color', action='store_true', default=sys.platform == 'win32', | def get_grin_arg_parser(parser=None): """ Create the command-line parser. """ if parser is None: parser = argparse.ArgumentParser( description="Search text files for a given regex pattern.", epilog="Bug reports to <enthought-dev@mail.enthought.com>.", formatter_class=argparse.RawDescriptionHelpFormatter, ) parser.add_... |
filename = os.path.realpath(filename) | def recognize_directory(self, filename): """ Determine what to do with a directory. """ basename = os.path.split(filename)[-1] if (self.skip_hidden_dirs and basename.startswith('.') and basename not in ('.', '..')): return 'skip' if self.skip_symlink_dirs and os.path.islink(filename): return 'link' if basename in self.... | |
if os.path.isdir(filename): return self.recognize_directory(filename) else: return self.recognize_file(filename) | try: st_mode = os.stat(filename).st_mode if stat.S_ISREG(st_mode): return self.recognize_file(filename) elif stat.S_ISDIR(st_mode): return self.recognize_directory(filename) else: return 'skip' except OSError: return 'unreadable' | def recognize(self, filename): """ Determine what kind of thing a filename represents. |
except IOError as e: | except IOError, e: | def grin_main(argv=None): try: if argv is None: # Look at the GRIN_ARGS environment variable for more arguments. env_args = shlex.split(os.getenv('GRIN_ARGS', '')) argv = [sys.argv[0]] + env_args + sys.argv[1:] parser = get_grin_arg_parser() args = parser.parse_args(argv[1:]) if args.context is not None: args.before_co... |
except IOError as e: | except IOError, e: | def grind_main(argv=None): try: if argv is None: # Look at the GRIND_ARGS environment variable for more arguments. env_args = shlex.split(os.getenv('GRIND_ARGS', '')) argv = [sys.argv[0]] + env_args + sys.argv[1:] parser = get_grind_arg_parser() args = parser.parse_args(argv[1:]) # Define the output function. if args.... |
filename = os.path.realpath(filename) | def recognize_file(self, filename): """ Determine what to do with a file. """ basename = os.path.split(filename)[-1] if self.skip_hidden_files and basename.startswith('.'): return 'skip' if self.skip_backup_files and basename.endswith('~'): return 'skip' if self.skip_symlink_files and os.path.islink(filename): return '... | |
self.serial_port.write('SETPER %d\n' % archive_interval_minutes) | serial_port.write('SETPER %d\n' % archive_interval_minutes) | def setArchiveInterval(self, archive_interval): """Set the archive interval of the VantagePro. archive_interval_sec: The new interval to use. Must be one of 1, 5, 10, 15, 30, 60, or 120. """ # Convert to minutes: archive_interval_minutes = int(archive_interval / 60) if archive_interval_minutes not in (1, 5, 10, 15, ... |
nc=self.serial_port.inWaiting() _buffer = self.serial_port.read(nc) | nc = serial_port.inWaiting() _buffer = serial_port.read(nc) | def setArchiveInterval(self, archive_interval): """Set the archive interval of the VantagePro. archive_interval_sec: The new interval to use. Must be one of 1, 5, 10, 15, 30, 60, or 120. """ # Convert to minutes: archive_interval_minutes = int(archive_interval / 60) if archive_interval_minutes not in (1, 5, 10, 15, ... |
self.serial_port.write('RXCHECK\n') | serial_port.write('RXCHECK\n') | def getRX(self) : """Returns reception statistics from the console. Returns a tuple with 5 values: (# of packets, # of missed packets, # of resynchronizations, the max # of packets received w/o an error, the # of CRC errors detected.)""" with SerialWrapper(self.port, self.baudrate, self.timeout) as serial_port: for _... |
nc=self.serial_port.inWaiting() _buffer = self.serial_port.read(nc) | nc=serial_port.inWaiting() _buffer = serial_port.read(nc) | def getRX(self) : """Returns reception statistics from the console. Returns a tuple with 5 values: (# of packets, # of missed packets, # of resynchronizations, the max # of packets received w/o an error, the # of CRC errors detected.)""" with SerialWrapper(self.port, self.baudrate, self.timeout) as serial_port: for _... |
_archive_interval = int(config_dict.get('archive_interval', '300')) | _archive_interval = int(config_dict.get('archive_interval', 300)) | def config(self, config_dict): _archive_interval = int(config_dict.get('archive_interval', '300')) _old_interval = self.getArchiveInterval() if _old_interval != _archive_interval: self.setArchiveInterval(_archive_interval) self.clearLog() |
syslog.syslog(syslog.LOG_ERR, " **** Reason: s" % (e,)) | syslog.syslog(syslog.LOG_ERR, " **** Reason: %s" % (e,)) | def postData(self, record): """Post using a RESTful protocol""" |
except IOError, e : | except (IOError, socket.error), e: | def run(self): while True : # This will block until something appears in the queue: time_ts = self.queue.get() # A 'None' value appearing in the queue is our signal to exit if time_ts is None: return # Go get the data from the archive for the requested time: record = RESTful.extractRecordFrom(self.archive, time_ts) ... |
texts["name"] = FormatName(subentry_infos["name"]) | texts["name"] = UnDigitName(FormatName(subentry_infos["name"])) | def GenerateFileContent(Node, headerfilepath, pointers_dict = {}): """ pointers_dict = {(Idx,Sidx):"VariableName",...} """ global type global internal_types global default_string_size texts = {} texts["maxPDOtransmit"] = 0 texts["NodeName"] = Node.GetNodeName() texts["NodeID"] = Node.GetNodeID() texts["NodeType"] = No... |
texts["name"] = FormatName(entry_infos["name"]) | texts["name"] = UnDigitName(FormatName(entry_infos["name"])) | def GenerateFileContent(Node, headerfilepath, pointers_dict = {}): """ pointers_dict = {(Idx,Sidx):"VariableName",...} """ global type global internal_types global default_string_size texts = {} texts["maxPDOtransmit"] = 0 texts["NodeName"] = Node.GetNodeName() texts["NodeID"] = Node.GetNodeID() texts["NodeType"] = No... |
texts["parent"] = FormatName(entry_infos["name"]) | texts["parent"] = UnDigitName(FormatName(entry_infos["name"])) | def GenerateFileContent(Node, headerfilepath, pointers_dict = {}): """ pointers_dict = {(Idx,Sidx):"VariableName",...} """ global type global internal_types global default_string_size texts = {} texts["maxPDOtransmit"] = 0 texts["NodeName"] = Node.GetNodeName() texts["NodeID"] = Node.GetNodeID() texts["NodeType"] = No... |
strIndex += " { %s%s, %s, %s, (void*)&%s }%s\n"%(subentry_infos["access"].upper(),save,typeinfos[2],sizeof,name,sep) | strIndex += " { %s%s, %s, %s, (void*)&%s }%s\n"%(subentry_infos["access"].upper(),save,typeinfos[2],sizeof,UnDigitName(name),sep) | def GenerateFileContent(Node, headerfilepath, pointers_dict = {}): """ pointers_dict = {(Idx,Sidx):"VariableName",...} """ global type global internal_types global default_string_size texts = {} texts["maxPDOtransmit"] = 0 texts["NodeName"] = Node.GetNodeName() texts["NodeID"] = Node.GetNodeID() texts["NodeType"] = No... |
if self.Table.GetColLabelValue(event.GetCol()) == "value": | if self.Table.GetColLabelValue(event.GetCol(), False) == "value": | def OnSubindexGridRightClick(self, event): self.SubindexGrid.SetGridCursor(event.GetRow(), event.GetCol()) if self.Editable: selected = self.IndexList.GetSelection() if selected != wx.NOT_FOUND: index = self.ListIndex[selected] if self.Manager.IsCurrentEntry(index): showpopup = False infos = self.Manager.GetEntryInfos(... |
elif self.Table.GetColLabelValue(event.GetCol()) == "value": | elif self.Table.GetColLabelValue(event.GetCol(), False) == "value": | def OnSubindexGridRightClick(self, event): self.SubindexGrid.SetGridCursor(event.GetRow(), event.GetCol()) if self.Editable: selected = self.IndexList.GetSelection() if selected != wx.NOT_FOUND: index = self.ListIndex[selected] if self.Manager.IsCurrentEntry(index): showpopup = False infos = self.Manager.GetEntryInfos(... |
time.sleep(0.1) | self.client.blocking_request(katcp.Message.request("watchdog")) | def test_bad_requests(self): """Test request failure paths in device server.""" self.client.raw_send("bad msg\n") |
if self._request_end.is_set() or not keepalive: | if self._request_end.isSet() or not keepalive: | def blocking_request(self, msg, timeout=None, keepalive=False): """Send a request messsage. |
def value_only_formatted(): | def value_only_formatted(func): | def value_only_formatted(): """ A decorator that changes a value-only read into read_formatted format (using time.time and 'ok') """ def decorator(func): def new_func(self): return time.time(), "ok", func(self) new_func.func_name = func.func_name return new_func return decorator |
def decorator(func): def new_func(self): return time.time(), "ok", func(self) new_func.func_name = func.func_name return new_func return decorator | def new_func(self): return time.time(), "ok", func(self) new_func.func_name = func.func_name return new_func | def decorator(func): def new_func(self): return time.time(), "ok", func(self) new_func.func_name = func.func_name return new_func |
formatted_params = () units = 'unsynced syncing synced' | formatted_params = ('unsynced', 'syncing', 'synced') units = '' | def read_formatted(self): return self.device.send_request('sensor-value', self.basename) |
@value_only_formatted() | @value_only_formatted | def __init__(self, name, device): self.device = device self.name = name |
lst = attr.split('_') | lst = attr.split('_', 2) | def callback(msg): if device.state is device.UNSYNCED: return Message.reply(dev_name + "-" + req_name, "fail", "Device not synced") d = device.send_request(req_name, *msg.arguments) d.addCallbacks(request_returned, request_failed) raise AsyncReply() |
dev_name = lst[1] | dev_name, req_name = lst[1], lst[2] | def callback(msg): if device.state is device.UNSYNCED: return Message.reply(dev_name + "-" + req_name, "fail", "Device not synced") d = device.send_request(req_name, *msg.arguments) d.addCallbacks(request_returned, request_failed) raise AsyncReply() |
req_name = "_".join(lst[2:]) | def callback(msg): if device.state is device.UNSYNCED: return Message.reply(dev_name + "-" + req_name, "fail", "Device not synced") d = device.send_request(req_name, *msg.arguments) d.addCallbacks(request_returned, request_failed) raise AsyncReply() | |
start = time.time() | def test_sampling(self): """Test sensor sampling.""" self.client.request(katcp.Message.request("sensor-sampling", "an.int", "period", 100)) start = time.time() time.sleep(1.0) self.client.request(katcp.Message.request("sensor-sampling", "an.int", "none")) end = time.time() time.sleep(0.5) | |
end = time.time() | def test_sampling(self): """Test sensor sampling.""" self.client.request(katcp.Message.request("sensor-sampling", "an.int", "period", 100)) start = time.time() time.sleep(1.0) self.client.request(katcp.Message.request("sensor-sampling", "an.int", "none")) end = time.time() time.sleep(0.5) | |
if self._rule == None: raise Exception("Aggregate sensor %s has no rule" % self.name) rule_used = self._rule | if self._rule is None: raise NoRule("Aggregate sensor %s has no rule" % self.name) | def rule_function(self, _parent, sensors): """For an aggregate type sensor, this function applies a logical rule to the values of the list of sensors that are provided as a parameter. Sets own value if rule was applied successfully. |
rule_used = rule_used.replace('\'' + sensor.name + '\'', str(sensor.value)) | rule_used = self._rule.replace('\'' + sensor.name + '\'', str(sensor.value)) | def rule_function(self, _parent, sensors): """For an aggregate type sensor, this function applies a logical rule to the values of the list of sensors that are provided as a parameter. Sets own value if rule was applied successfully. |
return [name for name,func in inspect.getmembers(self._cls) | return [name for name,func in getmembers(self._cls) | def methods(self): return [name for name,func in inspect.getmembers(self._cls) if not name.startswith('_') and callable(func)] |
if msg in whitelist: | if msg.name in whitelist: | def append_msg(msg): """Append a message if it matches the criteria.""" if msg.mtype not in msg_types: return if whitelist: if msg in whitelist: msgs.append(msg) else: if msg.name not in blacklist: msgs.append(msg) |
self._mosquitto_destroy(pointer(self._mosq)) | self._mosquitto_destroy(self._mosq) | def __del__(self): if self._mosq: self._mosquitto_destroy(pointer(self._mosq)) |
self._mosquitto_message_cleanup(self._mosq, pointer(message)) | self._mosquitto_message_cleanup(self._mosq, byref(message)) | def message_cleanup(self, message): self._mosquitto_message_cleanup(self._mosq, pointer(message)) |
self._mosquitto_loop.argtypes = [c_void_p, c_void_p] | self._mosquitto_loop.argtypes = [c_void_p, c_int] | def __init__(self, id, obj=None): #================================================== # Library loading #================================================== self._libmosq = cdll.LoadLibrary(find_library("mosquitto")) self._mosquitto_new = self._libmosq.mosquitto_new self._mosquitto_new.argtypes = [c_char_p, c_void_p] se... |
def loop(self, timeout=None): return self._mosquitto_loop(self._mosq, 0) | def loop(self, timeout=0): return self._mosquitto_loop(self._mosq, timeout) | def loop(self, timeout=None): return self._mosquitto_loop(self._mosq, 0) |
self._mosquitto_subscribe.argtypes = [c_void_p, c_uint16_p, c_char_p, c_int] | self._mosquitto_subscribe.argtypes = [c_void_p, POINTER(c_uint16), c_char_p, c_int] | def __init__(self, id, obj=None): #================================================== # Library loading #================================================== self._libmosq = cdll.LoadLibrary(find_library("mosquitto")) self._mosquitto_new = self._libmosq.mosquitto_new self._mosquitto_new.argtypes = [c_char_p, c_void_p] se... |
self._mosquitto_unsubscribe.argtypes = [c_void_p, c_uint16_p, c_char_p] | self._mosquitto_unsubscribe.argtypes = [c_void_p, POINTER(c_uint16), c_char_p] | def __init__(self, id, obj=None): #================================================== # Library loading #================================================== self._libmosq = cdll.LoadLibrary(find_library("mosquitto")) self._mosquitto_new = self._libmosq.mosquitto_new self._mosquitto_new.argtypes = [c_char_p, c_void_p] se... |
("timestamp", c_int), | ("timestamp", c_long), | def message_cleanup(self, message): self._mosquitto_message_cleanup(self._mosq, pointer(message)) |
("empty", c_char_p), | def message_cleanup(self, message): self._mosquitto_message_cleanup(self._mosq, pointer(message)) | |
try: argcount = self.on_connect.fun_code.co_argcount except RuntimeError: argcount = 2 except AttributeError: argcount = 2 | argcount = self.on_connect.func_code.co_argcount | def _internal_on_connect(self, obj, rc): if self.on_connect: try: argcount = self.on_connect.fun_code.co_argcount except RuntimeError: argcount = 2 except AttributeError: argcount = 2 |
try: argcount = self.on_disconnect.fun_code.co_argcount except RuntimeError: argcount = 1 except AttributeError: argcount = 1 | argcount = self.on_disconnect.func_code.co_argcount | def _internal_on_disconnect(self, obj): if self.on_disconnect: try: argcount = self.on_disconnect.fun_code.co_argcount except RuntimeError: argcount = 1 except AttributeError: argcount = 1 |
try: argcount = self.on_message.fun_code.co_argcount except RuntimeError: argcount = 2 except AttributeError: argcount = 2 | argcount = self.on_message.func_code.co_argcount | def _internal_on_message(self, obj, message): if self.on_message: topic = message.contents.topic payload = message.contents.payload qos = message.contents.qos retain = message.contents.retain msg = MosquittoMessage(topic, payload, qos, retain) try: argcount = self.on_message.fun_code.co_argcount except RuntimeError: ar... |
try: argcount = self.on_publish.fun_code.co_argcount except RuntimeError: argcount = 2 except AttributeError: argcount = 2 | argcount = self.on_publish.func_code.co_argcount | def _internal_on_publish(self, obj, mid): if self.on_publish: try: argcount = self.on_publish.fun_code.co_argcount except RuntimeError: argcount = 2 except AttributeError: argcount = 2 |
try: argcount = self.on_subscribe.fun_code.co_argcount except RuntimeError: argcount = 3 except AttributeError: argcount = 3 | argcount = self.on_subscribe.func_code.co_argcount | def _internal_on_subscribe(self, obj, mid, qos_count, granted_qos): if self.on_subscribe: qos_list = [] for i in range(qos_count): qos_list.append(granted_qos[i]) try: argcount = self.on_subscribe.fun_code.co_argcount except RuntimeError: argcount = 3 except AttributeError: argcount = 3 |
try: argcount = self.on_unsubscribe.fun_code.co_argcount except RuntimeError: argcount = 2 except AttributeError: argcount = 2 | argcount = self.on_unsubscribe.func_code.co_argcount | def _internal_on_unsubscribe(self, obj, mid): if self.on_unsubscribe: try: argcount = self.on_unsubscribe.fun_code.co_argcount except RuntimeError: argcount = 2 except AttributeError: argcount = 2 |
for field, operator, operand in domain: if field.startswith('parent.'): project_work_domain.append( (field.replace('parent.', ''), operator, operand)) elif field == 'parent': timesheet_work_domain.append( (field, operator, operand)) | if domain[0].startswith('parent.'): project_work_domain.append( (domain[0].replace('parent.', ''),) + domain[1:]) elif domain[0] == 'parent': timesheet_work_domain.append(domain) | def search_parent(self, cursor, user, name, domain=None, context=None): timesheet_work_obj = self.pool.get('timesheet.work') |
if context.get('type') == 'project': | if Transaction().context.get('type') == 'project': | def default_type(self): if context.get('type') == 'project': return 'project' return 'task' |
self.assertRaises(Exception, test_view('project')) | test_view('project') | def test0005views(self): ''' Test views. ''' self.assertRaises(Exception, test_view('project')) |
if not self.http_1_1 or resp.will_close: | if not self.producer.http_1_1 or resp.will_close: | def run(self): logger.debug("%s starting", self) # Queue should always exist! q = self.producer.queues[(self.host, self.scheme)] connection = None try: while not self.stopping: item = q.get() if self.stopping or item is None: # Shut down thread signal logger.debug('Stopping worker thread for ' '(%s, %s).' % (self.host,... |
writer = csv.writer(open(os.path.join(csv_dir, res + '.csv'), "wb")) | if csv_dir: writer = csv.writer(open(os.path.join(csv_dir, res + '.csv'), "wb")) else: writer = csv.writer(sys.stdout) | def send_to_csv(csv_dir, results): import csv for res in results: browser_dump, counter_dump, print_format = results[res] writer = csv.writer(open(os.path.join(csv_dir, res + '.csv'), "wb")) if print_format == 'tsformat': i = 0 writer.writerow(['i', 'val']) for val in browser_dump: val_list = val.split('|') for v in va... |
writer = csv.writer(open(os.path.join(csv_dir, res + '_' + count_type + '.csv'), "wb")) | if csv_dir: writer = csv.writer(open(os.path.join(csv_dir, res + '_' + count_type + '.csv'), "wb")) else: writer = csv.writer(sys.stdout) | def send_to_csv(csv_dir, results): import csv for res in results: browser_dump, counter_dump, print_format = results[res] writer = csv.writer(open(os.path.join(csv_dir, res + '.csv'), "wb")) if print_format == 'tsformat': i = 0 writer.writerow(['i', 'val']) for val in browser_dump: val_list = val.split('|') for v in va... |
def test_file(filename): | def test_file(filename, to_screen): | def test_file(filename): """Runs the talos tests on the given config file and generates a report. Args: filename: the name of the file to run the tests on """ browser_config = [] tests = [] title = '' testdate = '' csv_dir = '' results_server = '' results_link = '' results = {} # Read in the profile info from the YA... |
optlist, args = getopt.getopt(sys.argv[1:], 'dn', ['debug', 'noisy']) | screen = False optlist, args = getopt.getopt(sys.argv[1:], 'dns', ['debug', 'noisy', 'screen']) | def test_file(filename): """Runs the talos tests on the given config file and generates a report. Args: filename: the name of the file to run the tests on """ browser_config = [] tests = [] title = '' testdate = '' csv_dir = '' results_server = '' results_link = '' results = {} # Read in the profile info from the YA... |
test_file(arg) | test_file(arg, screen) | def test_file(filename): """Runs the talos tests on the given config file and generates a report. Args: filename: the name of the file to run the tests on """ browser_config = [] tests = [] title = '' testdate = '' csv_dir = '' results_server = '' results_link = '' results = {} # Read in the profile info from the YA... |
while total_time < 600: | while total_time < 1200: | def InitializeNewProfile(self, browser_path, process, child_process, browser_wait, extra_args, profile_dir, init_url, log): """Runs browser with the new profile directory, to negate any performance hit that could occur as a result of starting up with a new profile. Also kills the "extra" browser that gets spawned the f... |
raise talosError("no output from browser") | raise talosError("initalization has no output from browser") | def InitializeNewProfile(self, browser_path, process, child_process, browser_wait, extra_args, profile_dir, init_url, log): """Runs browser with the new profile directory, to negate any performance hit that could occur as a result of starting up with a new profile. Also kills the "extra" browser that gets spawned the f... |
if hasattr(platform, 'mac_ver') and platform.mac_ver()[0][:4] < '10.6': | if hasattr(platform, 'mac_ver') and platform.mac_ver()[0][:4] == '10.5': | def GenerateBrowserCommandLine(self, browser_path, extra_args, profile_dir, url): """Generates the command line for a process to run Browser |
os.makedirs(os.path.join(rootdir, name)) | if not os.path.exists(os.path.join(rootdir, name)): os.makedirs(os.path.join(rootdir, name)) | def zip_extractall(zipfile, rootdir): """Python 2.4 compatibility instead of ZipFile.extractall.""" for name in zipfile.namelist(): if name.endswith('/'): os.makedirs(os.path.join(rootdir, name)) else: destfile = os.path.join(rootdir, name) destdir = os.path.dirname(destfile) if not os.path.isdir(destdir): os.makedirs(... |
results_file.write("\n__FAILbrowser crash (code %d)__FAIL\n" % self.bwaiter.getReturn()) | results_file.write("\n__FAILbrowser non-zero return code (%d)__FAIL\n" % self.bwaiter.getReturn()) | def run(self): self.bwaiter = BrowserWaiter(self.command, self.log, self.mod) noise = 0 prev_size = 0 while not self.bwaiter.hasTime(): if noise > self.timeout: # check for frozen browser try: ffprocess.cleanupProcesses(self.process_name, self.child_process, self.browser_wait) except talosError, te: os.abort() #kill my... |
base_prompt = '\$\>' | base_prompt = '$>' base_prompt_re = '\$\>' | def __str__(self): return self.msg |
prompt_regex = '.*' + base_prompt + prompt_sep | prompt_regex = '.*(' + base_prompt_re + prompt_sep + ')' | def __str__(self): return self.msg |
re.compile('^uninst .*$')] | re.compile('^uninst .*$'), re.compile('^pull .*$')] | def cmdNeedsResponse(self, cmd): """ Not all commands need a response from the agent: * if the cmd matches the pushRE then it is the first half of push and therefore we want to wait until the second half before looking for a response * rebt obviously doesn't get a response * uninstall performs a reboot to ensure starti... |
return filter(lambda x: x, retVal.split('\n')) | files = filter(lambda x: x, retVal.split('\n')) if len(files) == 1 and files[0] == '<empty>': return [] return files | def listFiles(self, rootdir): rootdir = rootdir.rstrip('/') if (self.dirExists(rootdir) == False): return [] data = self.sendCMD(['cd ' + rootdir, 'ls']) if (data == None): return None retVal = self.stripPrompt(data) return filter(lambda x: x, retVal.split('\n')) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.