rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
assert len(filenames) == 1, "Unexpected files/directories in %s: %s" % (base, ' '.join(filenames)) | if len(filenames) > 1: filenames.sort(key=lambda x: x.count(os.path.sep) + (os.path.altsep and x.count(os.path.altsep) or 0)) | def egg_info_path(self, filename): if self._egg_info_path is None: if self.editable: base = self.source_dir else: base = os.path.join(self.source_dir, 'pip-egg-info') filenames = os.listdir(base) if self.editable: filenames = [] for root, dirs, files in os.walk(base): for dir in vcs.dirnames: if dir in dirs: dirs.remov... |
return line.split(x)[1] | repo = line.split(x)[1] if repo.startswith('/') or repo.startswith('\\'): return path_to_url(repo) return repo | def get_url(self, location): urls = call_subprocess( [self.cmd, 'info'], show_stdout=False, cwd=location) for line in urls.splitlines(): line = line.strip() for x in ('checkout of branch: ', 'parent branch: '): if line.startswith(x): return line.split(x)[1] return None |
return drive + url | if drive: return '/' + drive + url return url | def path_to_url(path): """ Convert a path to URI. The path will be made absolute and have quoted path parts. (adapted from pip.util) """ path = os.path.normcase(os.path.abspath(path)) drive, path = os.path.splitdrive(path) filepath = path.split(os.path.sep) url = '/'.join([urllib.quote(part) for part in filepath]) retu... |
from mimetypes import guess_type | def _sort_locations(locations): """ Sort locations into "files" (archives) and "urls", and return a pair of lists (files,urls) """ from mimetypes import guess_type files = [] urls = [] | |
if guess_type(url, strict=False)[0] == 'text/html': | if mimetypes.guess_type(url, strict=False)[0] == 'text/html': | def sort_path(path): url = path_to_url2(path) if guess_type(url, strict=False)[0] == 'text/html': urls.append(url) else: files.append(url) |
applicable_versions = sorted(applicable_versions, key=operator.itemgetter(1), cmp=lambda x, y : cmp(pkg_resources.parse_version(y), pkg_resources.parse_version(x)) ) | applicable_versions = sorted(applicable_versions, key=lambda v: pkg_resources.parse_version(v[1])) | def mkurl_pypi_url(url): loc = posixpath.join(url, url_name) # For maximum compatibility with easy_install, ensure the path # ends in a trailing slash. Although this isn't in the spec # (and PyPI can handle it without the slash) some other index # implementations might break if they relied on easy_install's behavior.... |
reset_env() | env = reset_env() | def test_requirements_file(): """ Test installing from a requirements file. """ reset_env() write_file('initools-req.txt', textwrap.dedent("""\ INITools==0.2 # and something else to test out: simplejson<=1.7.4 """)) result = run_pip('install', '-r', 'initools-req.txt') assert len(result.wildcard_matches('lib/python*/s... |
result = run_pip('install', '-r', 'initools-req.txt') assert len(result.wildcard_matches('lib/python*/site-packages/INITools-0.2-py*.egg-info')) == 1 assert len(result.wildcard_matches('lib/python*/site-packages/initools')) == 1 dirs = result.wildcard_matches('lib/python*/site-packages/simplejson*') | result = run_pip('install', '-r', env.base_path / 'initools-req.txt') assert len(result.wildcard_matches('env/lib/python*/site-packages/INITools-0.2-py*.egg-info')) == 1 assert len(result.wildcard_matches('env/lib/python*/site-packages/initools')) == 1 dirs = result.wildcard_matches('env/lib/python*/site-packages/simpl... | def test_requirements_file(): """ Test installing from a requirements file. """ reset_env() write_file('initools-req.txt', textwrap.dedent("""\ INITools==0.2 # and something else to test out: simplejson<=1.7.4 """)) result = run_pip('install', '-r', 'initools-req.txt') assert len(result.wildcard_matches('lib/python*/s... |
print result | def test_install_curdir_usersite_editable(): """ Test installing current directory ('.') into usersite """ env = reset_env() (env.lib_path/'no-global-site-packages.txt').rm() # this one reenables user_site run_pip('install', '-U', 'distribute') #XXX: only works with distribute result = run_pip('install', '--user', '-e... | |
self.code, self.msg = fp.next().strip().split() | try: line = fp.next().strip() self.code, self.msg = line.split(None, 1) except ValueError: raise ValueError('Bad field line: %r' % line) | def _set_all_fields(self, folder): filename = os.path.join(folder, urllib.quote(self.url, '')) if not os.path.exists(filename): self._cache_url(filename) fp = open(filename, 'rb') self.code, self.msg = fp.next().strip().split() self.code = int(self.code) for line in fp: if line == '\n': break key, value = line.split(':... |
% (self.dist.project_name, self.location, sys.prefix)) | % (self.dist.project_name, normalize_path(self.dist.location), sys.prefix)) | def _can_uninstall(self): if not dist_is_local(self.dist): logger.notify("Not uninstalling %s at %s, outside environment %s" % (self.dist.project_name, self.location, sys.prefix)) return False return True |
env.run('python', 'setup.py', 'install', cwd=os.path.dirname(here)) | env.run('python', 'setup.py', 'install', cwd=src) | def reset_env(environ=None): global env if not environ: environ = os.environ.copy() environ = clear_environ(environ) environ['PIP_DOWNLOAD_CACHE'] = download_cache environ['PIP_NO_INPUT'] = '1' environ['PIP_LOG_FILE'] = os.path.join(base_path, 'pip-log.txt') env = TestFileEnvironment(base_path, ignore_hidden=False, en... |
new_path = os.path.join(self.save_dir, path.lstrip(os.path.sep)) | new_path = os.path.splitdrive(path)[1].lstrip(os.path.sep) new_path = os.path.join(self.save_dir, new_path) | def remove(self, auto_confirm=False): """Remove paths in ``self.paths`` with confirmation (unless ``auto_confirm`` is True).""" if not self._can_uninstall(): return logger.notify('Uninstalling %s:' % self.dist.project_name) logger.indent += 2 paths = sorted(self.compact(self.paths)) try: if auto_confirm: response = 'y'... |
return path.startswith(prefix) and path[len(prefix)] == os.path.sep | prefix = prefix.rstrip(os.path.sep) + os.path.sep return path.startswith(prefix) | def prefix_match(path, prefix): if path == prefix: return True return path.startswith(prefix) and path[len(prefix)] == os.path.sep |
parser.error('You must give a command (use "pip help" see a list of commands)') | parser.error('You must give a command (use "pip help" to see a list of commands)') | def main(initial_args=None): if initial_args is None: initial_args = sys.argv[1:] autocomplete() version_control() options, args = parser.parse_args(initial_args) if options.help and not args: args = ['help'] if not args: parser.error('You must give a command (use "pip help" see a list of commands)') command = args[0].... |
print "no selection" | def activate_applet (self, treeview, path, col): select = treeview.get_selection() if not select: print "no selection" return model, iterator = select.get_selected () path = model.get_value (iterator, 2) icon, text, name = self.make_row (path) uid = "%d" % int(time.time()) if len (text) < 2: print "cannot load desktop ... | |
_('AWN has been successfully refreshed')) | _('Awn has been successfully refreshed')) | def refresh(self, button): dialog = gtk.MessageDialog(self.window, 0, gtk.MESSAGE_INFO, gtk.BUTTONS_OK, _('AWN has been successfully refreshed')) dialog.run() dialog.hide() |
filter.set_name("AWN Applet Package") | filter.set_name(_("Awn Applet Package")) | def install_applet(self, widget, data=None): dialog = gtk.FileChooserDialog(title=None,action=gtk.FILE_CHOOSER_ACTION_OPEN, buttons=(gtk.STOCK_CANCEL,gtk.RESPONSE_CANCEL,gtk.STOCK_OPEN,gtk.RESPONSE_OK)) dialog.set_default_response(gtk.RESPONSE_OK) |
message = "Applet Installation Failed" | message = _("Applet Installation Failed") | def extract_file(self, filename, do_apply): appletpath = "" applet_exists = False tar = tarfile.open(filename, "r:gz") for member in tar.getmembers(): if member.name.endswith(".desktop"): appletpath = os.path.join(defs.HOME_APPLET_DIR, member.name) |
message = "Applet Successfully Updated" | message = _("Applet Successfully Updated") | def register_applet(self, appletpath, do_apply, applet_exists, msg=True): if do_apply: model = self.model else: model = self.appmodel |
message = "Applet Successfully Added" else: message = "Applet Installation Failed" | message = _("Applet Successfully Added") else: message = _("Applet Installation Failed") | def register_applet(self, appletpath, do_apply, applet_exists, msg=True): if do_apply: model = self.model else: model = self.appmodel |
self.popup_msg("Can not delete active applet") | self.popup_msg(_("Can not delete active applet")) | def delete_applet(self,widget): self.active_found = False select = self.treeview_available.get_selection() if not select: return model, iterator = select.get_selected () path = model.get_value (iterator, 2) item = DesktopEntry (path) |
dialog = gtk.Dialog("Delete Applet", | dialog = gtk.Dialog(_("Delete Applet"), | def delete_applet(self,widget): self.active_found = False select = self.treeview_available.get_selection() if not select: return model, iterator = select.get_selected () path = model.get_value (iterator, 2) item = DesktopEntry (path) |
label = gtk.Label("<b>Delete %s?</b>" % item.getName()) | label = gtk.Label(_("<b>Delete %s?</b>") % item.getName()) | def delete_applet(self,widget): self.active_found = False select = self.treeview_available.get_selection() if not select: return model, iterator = select.get_selected () path = model.get_value (iterator, 2) item = DesktopEntry (path) |
self.popup_msg("Unable to Delete Applet") | self.popup_msg(_("Unable to Delete Applet")) | def delete_applet(self,widget): self.active_found = False select = self.treeview_available.get_selection() if not select: return model, iterator = select.get_selected () path = model.get_value (iterator, 2) item = DesktopEntry (path) |
msg = themedir+" already exists, unable to export theme." | msg = themedir+_(" already exists, unable to export theme.") | def export_theme(self, config, filename, newfilename, save_pattern): tmpdir = tempfile.gettempdir() themedir = os.path.join(tmpdir, filename) themefile = os.path.join(tmpdir, filename+'.awn-theme') if os.path.exists(themefile): os.remove(themefile) if os.path.exists(themedir): shutil.rmtree(themedir) if os.path.exists(... |
msg = "Theme already installed, do you wish to overwrite it?" | msg = _("Theme already installed, do you wish to overwrite it?") | def install_theme(self, file): goodTheme = False customArrow = False customActiveIcon = False pattern = False if tarfile.is_tarfile(file): tar = tarfile.open(file, "r:gz") for member in tar.getmembers(): if member.name.endswith(".awn-theme"): goodTheme = member.name elif member.name.endswith("arrow.png"): customArrow =... |
msg = "This is an incompatible theme file." | msg = _("This is an incompatible theme file.") | def install_theme(self, file): goodTheme = False customArrow = False customActiveIcon = False pattern = False if tarfile.is_tarfile(file): tar = tarfile.open(file, "r:gz") for member in tar.getmembers(): if member.name.endswith(".awn-theme"): goodTheme = member.name elif member.name.endswith("arrow.png"): customArrow =... |
os.remove(self.get_autostart_file_path()) | autostart_file = self.get_autostart_file_path() if os.path.isfile(autostart_file): os.remove(autostart_file) | def delete_autostarter(self): '''Delete the autostart entry for the dock.''' os.remove(self.get_autostart_file_path()) |
def refresh(self, button): dialog = gtk.MessageDialog(self.window, 0, gtk.MESSAGE_INFO, gtk.BUTTONS_OK, _('Awn has been successfully refreshed')) dialog.run() dialog.hide() | def changeTab(self, iconView): self.notebook.set_current_page(iconView.get_cursor()[0][0]) | |
msg = themedir+_(" already exists, unable to export theme.") | msg = _("%s already exists, unable to export theme.") % (themedir) | def export_theme(self, config, filename, newfilename, save_pattern): tmpdir = tempfile.gettempdir() themedir = os.path.join(tmpdir, filename) themefile = os.path.join(tmpdir, filename+'.awn-theme') if os.path.exists(themefile): os.remove(themefile) if os.path.exists(themedir): shutil.rmtree(themedir) if os.path.exists(... |
ret += "0x%08x (%02x) %-20s %s%s\n" % (i.offset, i.size, i.instructionHex, str(i.mnemonic) + " " + str(ops), comment) | if self.case == 'high': ret += "0x%08x (%02x) %-20s %s%s\n" % (i.offset, i.size, i.instructionHex, str(i.mnemonic) + " " + str(ops), comment) else: ret += "0x%08x (%02x) %-20s %s%s\n" % (i.offset, i.size, i.instructionHex, str(i.mnemonic).lower() + " " + str(ops).lower(), comment) | def disassemble(self, buf, processor="intel", type=32, lines=40, bsize=512, baseoffset=0): """ Disassemble a given buffer using Distorm """ if processor == "intel": if type == 32: decode = Decode32Bits elif type == 16: decode = Decode16Bits elif type == 64: decode = Decode64Bits else: raise EUnknownDisassemblyType() p... |
if os.path.exists(initstr): | if not '\000' in initstr and os.path.exists(initstr): | def __init__(self, initstr): """ Constructacon: initstr can be a filename, or a big hunka Elf lovin (If you only give it 52 bytes, it'll just parse the header, if you give it more, it *will* assume it has the whole thing... """ self.sections = [] self.pheaders = [] self.secnames = {} self.symbols = [] self.symbols_by_n... |
VEHICLE_QUATS = [ ["AHRS_DEBUG_QUAT", 2, "JOBY"], ["AHRS_DEBUG_QUAT", 10, "POINE"], ["AHRS_DEBUG_QUAT", 6, "XSENS Estimation"], ["BOOZ2_AHRS_REF_QUAT", 2, "Reference"]] | VEHICLE_QUATS = [ ["AHRS_DEBUG_QUAT", 10, "POINE"], ["BOOZ2_AHRS_REF_QUAT", 2, "Reference"]] | def OnClose(self, event): IvyStop() self.Destroy() |
MESSAGE_NAME = "JOBY_AHRS_DEBUG" | MESSAGE_NAME = "AHRS_DEBUG" | def OnClose(self, event): IvyStop() self.Destroy() |
typed_args.append(args[idx]) msg = struct.pack(struct_string, stx, length, sender, msg_id, *args) | if (msg_type == "float"): typed_args.append(float(args[idx])) else: typed_args.append(int(args[idx])) idx += 1 msg = struct.pack(struct_string, stx, length, sender, msg_id, *typed_args) | def buildPprzMsg(self, msg_id, *args): stx = STX length = 6 sender = 0 msg_fields = messages_xml_map.message_dictionary_types["datalink"][msg_id] struct_string = "=BBBB" typed_args = [] idx = 0 for msg_type in msg_fields: |
[timestamp, ac_id, msg_id] = fields[0:3] data_fields = map(lambda x: chr(int(x, 16)), fields[4:]) | [timestamp, pprz_tstamp, ac_id, msg_id] = fields[0:4] data_fields = map(lambda x: chr(int(x, 16)), fields[5:]) | def ProcessLine(self, line): fields = line.strip().split(' ') [timestamp, ac_id, msg_id] = fields[0:3] data_fields = map(lambda x: chr(int(x, 16)), fields[4:]) ac_id = int(ac_id) timestamp = float(timestamp) msg_id = int(msg_id) |
msg_name = messages_xml_map.message_dictionary_id_name[msg_id] msg_fields = messages_xml_map.message_dictionary_types[msg_id] | msg_name = messages_xml_map.message_dictionary_id_name['telemetry'][msg_id] msg_fields = messages_xml_map.message_dictionary_types['telemetry'][msg_id] | def ProcessLine(self, line): fields = line.strip().split(' ') [timestamp, ac_id, msg_id] = fields[0:3] data_fields = map(lambda x: chr(int(x, 16)), fields[4:]) ac_id = int(ac_id) timestamp = float(timestamp) msg_id = int(msg_id) |
try: print self.ProcessLine(line) except: pass | print self.ProcessLine(line) | def Run(self, logfile): # open log file INPUT = open(logfile, "r") for line in INPUT: |
timestamp = float(timestamp) | timestamp = float(pprz_tstamp) | def ProcessLine(self, line): fields = line.strip().split(' ') [timestamp, pprz_tstamp, ac_id, msg_id] = fields[0:4] data_fields = map(lambda x: chr(int(x, 16)), fields[5:]) ac_id = int(ac_id) timestamp = float(timestamp) msg_id = int(msg_id) |
parser = optparse.OptionParser('usage: %prog [options] <event file...>') parser.add_option("", "--update", dest="update", help="update database instead of dropping all existing values", action="store_true", default=False) | parser = optparse.OptionParser('usage: %prog [options] <event file...>', add_help_option=False) parser.add_option("", "--help", help="show this help message and exit", action="help") parser.add_option("", "--update", dest="update", help="update database instead of dropping all existing val... | def __init__(self): parser = optparse.OptionParser('usage: %prog [options] <event file...>') parser.add_option("", "--update", dest="update", help="update database instead of dropping all existing values", action="store_true", default=False) parser.add_option("-v", "--verbose", dest="verbose", help="verbose mess... |
to them; see ~config global quote. """ with quote_lock: quotegroup = arguments.resolveString(0) quotetext = arguments.resolveString(1) | to them; see ~config global quote. If the specified quote is empty, a ResponseException will be thrown. """ quotegroup = arguments.resolveString(0) quotetext = arguments.resolveString(1) if quotetext.strip() == "": raise ResponseException("You can't add an empty quote") with quote_lock: | def addquote(sink, arguments, context): """ Syntax: {addquote|<group>|<quote>} -- Adds a new quote to the specified group. This function then evaluates to the number that the new quote was assigned. Numbering starts at 1 for blank groups. Groups must already be present in the quote system configuration before quotes ca... |
<%s@%s> from %s on <font color=" | <%s@%s> from %s on <font color=" | def do_GET(self): path = self.path path_components = path[1:].split("/") if len(path_components) == 1 and path_components[0] == "": path_components = [] if len(path_components) > 0 and path_components[-1] == "": path_components = path_components[:-1] if len(path_components) == 0: self.send_response(200) self.send_heade... |
raise ResponseException("You can't add an empty quote") | raise FactoidException("You can't add an empty quote") | def addquote(sink, arguments, context): """ Syntax: {addquote|<group>|<quote>} -- Adds a new quote to the specified group. This function then evaluates to the number that the new quote was assigned. Numbering starts at 1 for blank groups. Groups must already be present in the quote system configuration before quotes ca... |
print "\tCodec :", self.tags.pop("video-codec") | print "\tCodec :", self.tags["video-codec"] | def print_info(self): """prints out the information on the given file""" if not self.finished: return if not self.mimetype: print "Unknown media type" return print "Mime Type :\t", self.mimetype if not self.is_video and not self.is_audio: return print "Length :\t", self._time_to_string(max(self.audiolength, self.videol... |
print "\tCodec :", self.tags.pop("audio-codec") | print "\tCodec :", self.tags["audio-codec"] | def print_info(self): """prints out the information on the given file""" if not self.finished: return if not self.mimetype: print "Unknown media type" return print "Mime Type :\t", self.mimetype if not self.is_video and not self.is_audio: return print "Length :\t", self._time_to_string(max(self.audiolength, self.videol... |
assert self.mixer | def setUp(self): TestCase.setUp(self) amix = find_mixer_element() if amix: self.mixer = amix.create() else: self.mixer = None assert self.mixer | |
self.assertEquals(self.sink.__grefcount__, 2) | self.assertEquals(self.src.__grefcount__, 2) | def testNoProbe(self): self.event = gst.event_new_eos() gst.debug('created new eos %r, id %x' % ( self.event, id(self.event))) self.assertEquals(self.event.__grefcount__, 1) gst.debug('pushing event on linked pad, no probe') self.assertEquals(self.src.push_event(self.event), True) gst.debug('pushed event on linked pad,... |
self.assertEquals(self.sink.__grefcount__, 1) | self.assertEquals(self.src.__grefcount__, 1) | def testNoProbe(self): self.event = gst.event_new_eos() gst.debug('created new eos %r, id %x' % ( self.event, id(self.event))) self.assertEquals(self.event.__grefcount__, 1) gst.debug('pushing event on linked pad, no probe') self.assertEquals(self.src.push_event(self.event), True) gst.debug('pushed event on linked pad,... |
self.assertEquals(self.sink.__grefcount__, 2) | self.assertEquals(self.src.__grefcount__, 2) | def testTrueProbe(self): probe_id = self.src.add_event_probe(self._probe_handler, True) self.event = gst.event_new_eos() gst.debug('created new eos %r, id %x' % ( self.event, id(self.event))) self.assertEquals(self.event.__grefcount__, 1) # a True probe lets it pass self.assertEquals(self.src.push_event(self.event), Tr... |
self.assertEquals(self.sink.__grefcount__, 1) | self.assertEquals(self.src.__grefcount__, 1) | def testTrueProbe(self): probe_id = self.src.add_event_probe(self._probe_handler, True) self.event = gst.event_new_eos() gst.debug('created new eos %r, id %x' % ( self.event, id(self.event))) self.assertEquals(self.event.__grefcount__, 1) # a True probe lets it pass self.assertEquals(self.src.push_event(self.event), Tr... |
for typename in ["GstBuffer*", "GstEvent*", "GstMessage*", "GstQuery*"]: | for typename in ["GstBuffer*", "const-GstBuffer*", "GstEvent*", "const-GstEvent*", "GstMessage*", "const-GstMessage*", "GstQuery*", "const-GstQuery*"]: matcher.register(typename, GstMiniObjectArg()) | def write_return(self, ptype, ownsreturn, info): if ownsreturn: raise NotImplementedError () else: info.varlist.add("gchar", "**ret") info.codeafter.append(" if (ret) {\n" " guint size = g_strv_length(ret);\n" " PyObject *py_ret = PyTuple_New(size);\n" " gint i;\n" " for (i = 0; i < size;... |
if osname == 'Linux' or osname == 'SunOS' or osname == 'FreeBSD' or osname == 'GNU/kFreeBSD': | if osname == 'Linux' or osname == 'SunOS' or osname == 'FreeBSD' or osname == 'GNU/kFreeBSD' or osname == 'GNU': | def __float__(self): return float(self.num) / float(self.denom) |
if osname == 'Linux' or osname == 'SunOS' or osname == 'FreeBSD': | if osname == 'Linux' or osname == 'SunOS' or osname == 'FreeBSD' or osname == 'GNU/kFreeBSD': | def __float__(self): return float(self.num) / float(self.denom) |
def raw_call(command): | def call(command,fake = False): | def raw_call(command): """ raw_call(command) --> (result, output) Runs the command in the local shell returning a tuple containing : - the return result (None for 0, otherwise an int), and - the full, stripped standard output. You wouldn't normally use this, instead consider call(), test() and system() """ process = o... |
raw_call(command) --> (result, output) | call(command) --> (result, output) | def raw_call(command): """ raw_call(command) --> (result, output) Runs the command in the local shell returning a tuple containing : - the return result (None for 0, otherwise an int), and - the full, stripped standard output. You wouldn't normally use this, instead consider call(), test() and system() """ process = o... |
print ' $ mv %s %s' % (f,join(backup_folder,name)) | call('mv %s %s' % (f,join(backup_folder,name)),fake=debug) | def backup_affected_assets(cfg_folder, backup_folder): "Backup files that would be overwritten by config tracking into backup folder" files = local_assets(os.listdir(cfg_folder),lambda x: True) for f in files: if os.path.exists(f): name = os.path.split(f)[1] print ' $ mv %s %s' % (f,join(backup_folder,name)) |
print ' $ ln %s %s' % (f,join(destination_folder,name)) | call('ln %s %s' % (f,join(destination_folder,name)),fake=debug) | def install_tracked_assets(cfg_folder, destination_folder): "Install tracked configuration files into destination folder" files = cfg_assets(os.listdir(cfg_folder),os.path.isfile) for f in files: name = os.path.split(f)[1] print ' $ ln %s %s' % (f,join(destination_folder,name)) dirs = cfg_assets(os.listdir(cfg_folde... |
print ' $ ln -s %s %s' % (d,join(destination_folder,name)) | call('ln -s %s %s' % (d,join(destination_folder,name)),fake=debug) | def install_tracked_assets(cfg_folder, destination_folder): "Install tracked configuration files into destination folder" files = cfg_assets(os.listdir(cfg_folder),os.path.isfile) for f in files: name = os.path.split(f)[1] print ' $ ln %s %s' % (f,join(destination_folder,name)) dirs = cfg_assets(os.listdir(cfg_folde... |
raw_call("git clone %s %s" % (gitrepo,cfg_folder)) | call("git clone %s %s" % (gitrepo,cfg_folder)) | def install_tracked_assets(cfg_folder, destination_folder): "Install tracked configuration files into destination folder" files = cfg_assets(os.listdir(cfg_folder),os.path.isfile) for f in files: name = os.path.split(f)[1] print ' $ ln %s %s' % (f,join(destination_folder,name)) dirs = cfg_assets(os.listdir(cfg_folde... |
print '* installing tracked config files...' | print '|* installing tracked config files...' | def install_tracked_assets(cfg_folder, destination_folder): "Install tracked configuration files into destination folder" files = cfg_assets(os.listdir(cfg_folder),os.path.isfile) for f in files: name = os.path.split(f)[1] print ' $ ln %s %s' % (f,join(destination_folder,name)) dirs = cfg_assets(os.listdir(cfg_folde... |
w = 0 if len(orig_sent) != 0: | w = 0 if len(filter(notpunc, orig_sent)) != 0: | def main(): op = OptionParser() op.add_option('-t', '--train') op.add_option('-T', '--input_type') op.add_option('-s', '--test') op.add_option('-o', '--output') op.add_option('-u', '--upparse_script') opt, args = op.parse_args() input_type = opt.input_type or guess_input_type(opt.train) log('guessing input type = '... |
if C_defines: LineList.append('\t '+ join(map(lambda x: '-D'+x,C_defines),' ') +' \\\n') | def CoreCPPRules(LineList): | |
if C_defines: LineList.append('\t '+ join(map(lambda x: '-D'+x,C_defines),' ') +' \\\n') | def CoreCRules(LineList): | |
!Now you don't need to use NEVMX in double band-path method, !which obtain only eigenvalues in first-path to obtain integration weights !, and accumulate eigenfunctions in second path. | def uniq(list): result = [] for l in list: if not l in result: result.append(l) return result | |
if (nargv ==0): | if (nargv ==0 or '--help' in argset): | def testrun(testname, commanddir,datadir,workdir,commands,start,testc,enforce,deletetemp): if(enforce==1): shutil.rmtree(workdir,'ignore_errors') |
lx = max(il1,il2)+1 | lx = max(il1,il2) | def uniq(list): result = [] for l in list: if not l in result: result.append(l) return result |
r = self.s.recv(1500) if len(r) < 16: raise RPCProtocolError("Received small packet (%d bytes)"%len(r)) rcmd, rtag, retcode = struct.unpack(">IIq", r[:16]) data = r[16:] if rcmd != cmd: raise RPCProtocolError("Received bad command (expected %d, got %d)"%(cmd,rcmd)) if rtag != tag: raise RPCProtocolError("Received bad t... | while True: r = self.s.recv(1500) if len(r) < 16: raise RPCProtocolError("Received small packet (%d bytes)"%len(r)) rcmd, rtag, retcode = struct.unpack(">IIq", r[:16]) data = r[16:] if rcmd != cmd: raise RPCProtocolError("Received bad command (expected %d, got %d)"%(cmd,rcmd)) if rtag != tag: print "RPC: Received bad t... | def rpc(self, cmd, data=""): tag = self.tag self.tag += 1 hdr = struct.pack(">II", cmd, tag) self.s.send(hdr + data) r = self.s.recv(1500) if len(r) < 16: raise RPCProtocolError("Received small packet (%d bytes)"%len(r)) rcmd, rtag, retcode = struct.unpack(">IIq", r[:16]) data = r[16:] if rcmd != cmd: raise RPCProtocol... |
args = struct.pack(">QI", addr, len(data)) ret, data = self.rpc(self.RPC_READMEM, args) | args = struct.pack(">QI", addr, len(data)) + data ret = self.rpc(self.RPC_WRITEMEM, args) | def writememblk(self, addr, data): if len(data) == 0: return args = struct.pack(">QI", addr, len(data)) ret, data = self.rpc(self.RPC_READMEM, args) self.chkret(ret) |
self.readmemblk(addr, blk) addr += blk | self.writememblk(addr, blk) addr += len(blk) | def writemem(self, addr, data): while len(data) != 0: blk = data[:1024] data = data[1024:] self.readmemblk(addr, blk) addr += blk |
return self.lv1_query_logical_partition_address_region_info(addr)[1] | return self.lv1_query_logial_partition_address_region_info(addr)[1] def lv1_gpu_fifo_init(self, ctx, get, put, ref): self.lv1_gpu_context_attribute(ctx, L1GPU_CONTEXT_ATTRIBUTE_FIFO_INIT, get, put, ref, 0) def lv1_gpu_display_sync(self, ctx, head, mode): self.lv1_gpu_context_attribute(ctx, L1GPU_CONTEXT_ATTRIBUTE_DISP... | def get_area_size(self, addr): return self.lv1_query_logical_partition_address_region_info(addr)[1] |
if spath[1] == "sony": | if spath[0] == "sony": | def parse_repo_path(self, path): spath = path.split(".") if len(spath) < 2: raise ValueError("Repo path '%s' is too short", path) if spath[0] == "pme": lpar_id = 1 elif spath[0] == "cur": lpar_id = self.lv1_get_logical_partition_id() else: try: lpar_id = int(spath[0]) except ValueError: raise ValueError("Unknown LPAR I... |
def delmmio(self, start, size): | def del_mmio(self, start): | def delmmio(self, start, size): args = struct.pack(">Q", start) ret = self.rpc(self.RPC_ADDMMIO, args) self.chkret(ret) |
ret = self.rpc(self.RPC_ADDMMIO, args) | ret = self.rpc(self.RPC_DELMMIO, args) self.chkret(ret) def clr_mmio(self): ret = self.rpc(self.RPC_CLRMMIO) | def delmmio(self, start, size): args = struct.pack(">Q", start) ret = self.rpc(self.RPC_ADDMMIO, args) self.chkret(ret) |
cppname(names[-1]), ', '.join(['PyTypeObject *'] * len(clsParams))) line(out_h, indent + 1, 'static PyObject *wrap_jobject(const jobject&);') | cppname(names[-1]), _clsParams) line(out_h, indent + 1, 'static PyObject *wrap_jobject(const jobject&, %s);', _clsParams) | def python(env, out_h, out, cls, superCls, names, superNames, constructors, methods, protectedMethods, fields, instanceFields, mapping, sequence, rename, declares, typeset, moduleName, generics): line(out_h) line(out_h, 0, '#include <Python.h>') line(out_h) indent = 0 for name in names[:-1]: line(out_h, indent, 'name... |
line(out, indent + 1, "if (obj != Py_None)") | line(out, indent + 1, "if (obj != NULL && obj != Py_None)") | def python(env, out_h, out, cls, superCls, names, superNames, constructors, methods, protectedMethods, fields, instanceFields, mapping, sequence, rename, declares, typeset, moduleName, generics): line(out_h) line(out_h, 0, '#include <Python.h>') line(out_h) indent = 0 for name in names[:-1]: line(out_h, indent, 'name... |
query = QueryParser(Version.LUCENE_CURRENT, "contents", analyzer).parse(queryString) | parser = QueryParser(Version.LUCENE_CURRENT, "contents", analyzer) parser.setAutoGeneratePhraseQueries(True) query = parser.parse(queryString) | def testAnalyzer(self): |
cmd = "scalac -d bin -unchecked -deprecation " + " ".join(changedfiles) + " & if errorlevel 1 exit 1" | cmd = "scalac -d bin -unchecked -deprecation " + " ".join(changedfiles) + " 2>&1" | def printtime(): print datetime.datetime.now().strftime("%H:%M:%S") |
(r'(%r([^a-zA-Z0-9]))([^\2\\]*(?:\\.[^\2\\]*)*)(\2[mixounse]*)', | (r'(%r([^a-zA-Z0-9]))((?:\\\2|(?!\2).)*)(\2[mixounse]*)', | def intp_string_callback(self, match, ctx): yield match.start(1), String.Other, match.group(1) nctx = LexerContext(match.group(3), 0, ['interpolated-string']) for i, t, v in self.get_tokens_unprocessed(context=nctx): yield match.start(3)+i, t, v yield match.start(4), String.Other, match.group(4) # end ctx.pos = matc... |
(r'%[qsw]([^a-zA-Z0-9])([^\1\\]*(?:\\.[^\1\\]*)*)\1', String.Other), (r'(%[QWx]([^a-zA-Z0-9]))([^\2\\]*(?:\\.[^\2\\]*)*)(\2)', | (r'%[qsw]([^a-zA-Z0-9])((?:\\\1|(?!\1).)*)\1', String.Other), (r'(%[QWx]([^a-zA-Z0-9]))((?:\\\2|(?!\2).)*)(\2)', | def intp_string_callback(self, match, ctx): yield match.start(1), String.Other, match.group(1) nctx = LexerContext(match.group(3), 0, ['interpolated-string']) for i, t, v in self.get_tokens_unprocessed(context=nctx): yield match.start(3)+i, t, v yield match.start(4), String.Other, match.group(4) # end ctx.pos = matc... |
(r'(?<=[-+/*%=<>&!^|~,(])(\s*)(%([\t ])(?:[^\3\\]*(?:\\.[^\3\\]*)*)\3)', | (r'(?<=[-+/*%=<>&!^|~,(])(\s*)(%([\t ])(?:(?:\\\3|(?!\3).)*)\3)', | def intp_string_callback(self, match, ctx): yield match.start(1), String.Other, match.group(1) nctx = LexerContext(match.group(3), 0, ['interpolated-string']) for i, t, v in self.get_tokens_unprocessed(context=nctx): yield match.start(3)+i, t, v yield match.start(4), String.Other, match.group(4) # end ctx.pos = matc... |
(r'^(\s*)(%([\t ])(?:[^\3\\]*(?:\\.[^\3\\]*)*)\3)', | (r'^(\s*)(%([\t ])(?:(?:\\\3|(?!\3).)*)\3)', | def intp_string_callback(self, match, ctx): yield match.start(1), String.Other, match.group(1) nctx = LexerContext(match.group(3), 0, ['interpolated-string']) for i, t, v in self.get_tokens_unprocessed(context=nctx): yield match.start(3)+i, t, v yield match.start(4), String.Other, match.group(4) # end ctx.pos = matc... |
(r'(%([^a-zA-Z0-9\s]))([^\2\\]*(?:\\.[^\2\\]*)*)(\2)', | (r'(%([^a-zA-Z0-9\s]))((?:\\\2|(?!\2).)*)(\2)', | def intp_string_callback(self, match, ctx): yield match.start(1), String.Other, match.group(1) nctx = LexerContext(match.group(3), 0, ['interpolated-string']) for i, t, v in self.get_tokens_unprocessed(context=nctx): yield match.start(3)+i, t, v yield match.start(4), String.Other, match.group(4) # end ctx.pos = matc... |
val = bytes(vim.eval(expr)) self.write(val.decode(vim.eval('&encoding'), 'ignore')) | self.write(vim.eval(expr)) | def write_expr(self, expr, set_cursor=True, read=True): # {{{ |
'ORDER BY DATE DESC LIMIT 100', (self.id, date)) | 'ORDER BY DATE DESC LIMIT 100', (self.id, to_timestamp(date))) | def prepare_subject_for_compare(subject): if len(subject) > 2 and subject[2] == ':': subject = subject[3:].lstrip() subject = subject.replace(" ","") return subject |
def get_conv(self, msg, in_reply_to, subject, date): | def get_conv(self, msg, in_reply_tos, subject, date): | def get_conv(self, msg, in_reply_to, subject, date): """ Returns the `MailinglistConversation` the msg belongs to. If the message is the first message in a conversation or if the conversation is unknown a newly created conversation is returned. """ match = re.search('<[^>]+>', in_reply_to) if match: msg_id = match.grou... |
match = re.search('<[^>]+>', in_reply_to) if match: msg_id = match.group(0) self.env.log.debug("Searching for message with msg_id %s", msg_id) db = self.env.get_read_db() cursor = db.cursor() cursor.execute('SELECT conversation ' 'FROM mailinglistmessages ' 'WHERE msg_id = %s AND list = %s LIMIT 1', (msg_id, self.id)) ... | for in_reply_to in in_reply_tos.split(): match = re.search('<[^>]+>', in_reply_to) if match: msg_id = match.group(0) self.env.log.debug("Searching for message with msg_id %s", msg_id) db = self.env.get_read_db() cursor = db.cursor() cursor.execute('SELECT conversation ' 'FROM mailinglistmessages ' 'WHERE msg_id = %s AN... | def get_conv(self, msg, in_reply_to, subject, date): """ Returns the `MailinglistConversation` the msg belongs to. If the message is the first message in a conversation or if the conversation is unknown a newly created conversation is returned. """ match = re.search('<[^>]+>', in_reply_to) if match: msg_id = match.grou... |
if len(subject) > 2 and subject[2] == ':': topic = subject[3:].lstrip() else: topic = subject topic = topic.replace(' ', '') self.env.log.debug("Searching for message with topic %s", topic) db = self.env.get_read_db() cursor = db.cursor() cursor.execute('SELECT subject, conversation ' 'FROM mailinglistmessages ' 'WHE... | if subject is not None: def prepare_subject_for_compare(subject): if len(subject) > 2 and subject[2] == ':': subject = subject[3:].lstrip() subject = subject.replace(" ","") return subject topic = prepare_subject_for_compare(subject) self.env.log.debug("Searching for message with topic %s", topic) db = self.env.get_re... | def get_conv_ms(self, msg, subject, date): """ Returns the `MailinglistConversation` the msg belongs to. If the message is the first message in a conversation or if the conversation is unknown a newly created conversation is returned. |
from_utimestamp(date), "%s <%s>" % (from_name, from_email), | datetime.fromtimestamp(date, utc), "%s <%s>" % (from_name, from_email), | def get_search_results(self, req, terms, filters): if not 'mailinglist' in filters: return mailinglist_realm = Resource('mailinglist') |
if Protocol == "USB" and Ejectable == "Yes": | try: DiskSizeB = int(DiskSize.split("(")[1].split(" B")[0]) except: DiskSizeB = 250522561 if Protocol == "USB" and Ejectable == "Yes" and DiskSizeB > 250522560 and DiskSizeB < 70719476736: | def detect_removable_drives(self): """ Detect all removable USB storage devices using DiskUtil""" self.drives = {} [status, rtn] = commands.getstatusoutput('diskutil list | grep ^/dev') drives = rtn.split("\n") for drive in drives: #print drive Protocol = None Ejectable = "No" [status, rtn] = commands.getstatusoutput('... |
import urllib | def get_appletv_dmg_url(self): #import urllib #from xml.dom import minidom # #xml_doc = minidom.parse(urllib.urlopen('http://mesu.apple.com/version.xml')) #self.atv_dmg_url = xml_doc.getElementsByTagName('dict')[1].getElementsByTagName('string')[1].firstChild.data #self.atv_dmg_url = 'http://mesu.apple.com/data/OS/061-... | |
xml_doc = urllib.urlopen('http://atvusb-creator.googlecode.com/files/latest_ATV_dmg.xml').read() | def get_appletv_dmg_url(self): #import urllib #from xml.dom import minidom # #xml_doc = minidom.parse(urllib.urlopen('http://mesu.apple.com/version.xml')) #self.atv_dmg_url = xml_doc.getElementsByTagName('dict')[1].getElementsByTagName('string')[1].firstChild.data #self.atv_dmg_url = 'http://mesu.apple.com/data/OS/061-... | |
self.atv_dmg_url = xml_doc.split("<string>")[1].split("</string>")[0] | def get_appletv_dmg_url(self): #import urllib #from xml.dom import minidom # #xml_doc = minidom.parse(urllib.urlopen('http://mesu.apple.com/version.xml')) #self.atv_dmg_url = xml_doc.getElementsByTagName('dict')[1].getElementsByTagName('string')[1].firstChild.data #self.atv_dmg_url = 'http://mesu.apple.com/data/OS/061-... | |
self.atv_dmg_url = atv_dmg_info[0]['url'] | def get_appletv_dmg_url(self): #import urllib #from xml.dom import minidom # #xml_doc = minidom.parse(urllib.urlopen('http://mesu.apple.com/version.xml')) #self.atv_dmg_url = xml_doc.getElementsByTagName('dict')[1].getElementsByTagName('string')[1].firstChild.data #self.atv_dmg_url = 'http://mesu.apple.com/data/OS/061-... | |
progress = 0.0 | def parse(self, line, timestamp=None): self.lineNumber += 1 tokens = line.split() iso = 0 try: # Do a small stupid sanity check if this is a correct usbmon log line try: if len(tokens) < 4: return if not(int(tokens[0],16) and int(tokens[1]) and (tokens[2] in ('S', 'C', 'E'))): return except: print "Error on line %d:" %... | |
self.progress = progress | def setProgress(self, progress): self.progress = progress if self.progressQueue: self.progressQueue.put(("Loading %s" % os.path.basename(self.filename), self.progress)) | |
self.progress)) | progress)) | def setProgress(self, progress): self.progress = progress if self.progressQueue: self.progressQueue.put(("Loading %s" % os.path.basename(self.filename), self.progress)) |
ep.bmAttributes & 0x03, | (ep.bmAttributes or 0) & 0x03, | def detector(context): # this is required for all 'Decoder' modules dev = context.device ep = context.endpoint ifc = context.interface devi = context.devInstance |
self.trans.frame = 0 | def __init__(self, completed): self.epoch = None self.trans = Types.Transaction() self.trans.frame = 0 self.setupData = None self.completed = completed | |
def parse(self, line, timestamp=None, frame=None): | def parse(self, line, timestamp=None): | def parse(self, line, timestamp=None, frame=None): self.lineNumber += 1 tokens = line.split() try: # Do a small stupid sanity check if this is a correct usbmon log line try: if len(tokens) < 4: return if not(int(tokens[0],16) and int(tokens[1]) and (tokens[2] in ('S', 'C', 'E'))): return except: print "Error on line %d... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.