rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
r += if_platform_tagged(platform, "enable", lambda: x) | r += if_platform_tagged(platform, "enable", x) | def each_platform(closure): r = "[+ IF - enable undefined +]" for platform in GRUB_PLATFORMS: r += "\nif COND_" + platform + "\n" + closure(platform) + "endif\n" r += "[+ ELSE +]" for platform in GRUB_PLATFORMS: x = "\nif COND_" + platform + "\n" + closure(platform) + "endif\n" r += if_platform_tagged(platform, "enable... |
return r; | return r def under_platform_specific_conditionals(platform, snippet): r = foreach_platform_value(platform, "condition", "_condition", lambda cond: "if " + cond + "\n") r += snippet r += foreach_platform_value(platform, "condition", "_condition", lambda cond: "endif " + cond + "\n") return r def platform_specific_val... | def each_platform(closure): r = "[+ IF - enable undefined +]" for platform in GRUB_PLATFORMS: r += "\nif COND_" + platform + "\n" + closure(platform) + "endif\n" r += "[+ ELSE +]" for platform in GRUB_PLATFORMS: x = "\nif COND_" + platform + "\n" + closure(platform) + "endif\n" r += if_platform_tagged(platform, "enable... |
def platform_sources(p): return platform_values(p, "", "source") def platform_nodist_sources(p): return platform_values(p, "_nodist", "nodist") def platform_extra_dist(p): return platform_values(p, "_extra_dist", "extra_dist") def platform_ldadd(p): return platform_values(p, "_ldadd", "ldadd") def platform_cflags(p): ... | def platform_sources(p): return platform_specific_values(p, "source", "") def platform_nodist_sources(p): return platform_specific_values(p, "nodist", "_nodist") def platform_extra_dist(p): return platform_specific_values(p, "extra_dist", "_extra_dist") def platform_ldadd(p): return platform_specific_values(p, "ldadd"... | def platform_sources(p): return platform_values(p, "", "source") |
if_platform_tagged(platform, "nostrip", lambda: "cp $< $@", lambda: "$(STRIP) $(" + cname() + "_STRIPFLAGS) -o $@ $<")) | if_platform_tagged(platform, "nostrip", "cp $< $@", "$(STRIP) $(" + cname() + "_STRIPFLAGS) -o $@ $<")) | def kernel(platform): r = set_canonical_name_suffix(".exec") r += gvar_add("noinst_PROGRAMS", "[+ name +].exec") r += var_set(cname() + "_SOURCES", platform_sources(platform)) r += var_add(cname() + "_SOURCES", shared_sources()) r += var_set("nodist_" + cname() + "_SOURCES", platform_nodist_sources(platform) + " ## pla... |
$(OBJCOPY) """ + platform_objcopyflags(platform) + """ --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .reginfo -R .rel.dyn $< $@; \ | $(OBJCOPY) $(""" + cname() + """_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .reginfo -R .rel.dyn $< $@; \ | def image(platform): r = set_canonical_name_suffix(".image") r += gvar_add("noinst_PROGRAMS", "[+ name +].image") r += var_set(cname() + "_SOURCES", platform_sources(platform)) r += var_add(cname() + "_SOURCES", shared_sources()) r += var_set("nodist_" + cname() + "_SOURCES", platform_nodist_sources(platform) + "## pla... |
return "[+ FOR module +]" + under_conditional(each_platform(lambda p: module(p))) + "[+ ENDFOR +]" | return "[+ FOR module +]" + each_platform( lambda p: under_platform_specific_conditionals(p, module(p))) + "[+ ENDFOR +]" | def module_rules(): return "[+ FOR module +]" + under_conditional(each_platform(lambda p: module(p))) + "[+ ENDFOR +]" |
return "[+ FOR kernel +]" + under_conditional(each_platform(lambda p: kernel(p))) + "[+ ENDFOR +]" | return "[+ FOR kernel +]" + each_platform( lambda p: under_platform_specific_conditionals(p, kernel(p))) + "[+ ENDFOR +]" | def kernel_rules(): return "[+ FOR kernel +]" + under_conditional(each_platform(lambda p: kernel(p))) + "[+ ENDFOR +]" |
return "[+ FOR image +]" + under_conditional(each_platform(lambda p: image(p))) + "[+ ENDFOR +]" | return "[+ FOR image +]" + each_platform( lambda p: under_platform_specific_conditionals(p, image(p))) + "[+ ENDFOR +]" | def image_rules(): return "[+ FOR image +]" + under_conditional(each_platform(lambda p: image(p))) + "[+ ENDFOR +]" |
return "[+ FOR library +]" + under_conditional(each_platform(lambda p: library(p))) + "[+ ENDFOR +]" | return "[+ FOR library +]" + each_platform( lambda p: under_platform_specific_conditionals(p, library(p))) + "[+ ENDFOR +]" | def library_rules(): return "[+ FOR library +]" + under_conditional(each_platform(lambda p: library(p))) + "[+ ENDFOR +]" |
return "[+ FOR program +]" + under_conditional(each_platform(lambda p: program(p))) + "[+ ENDFOR +]" | return "[+ FOR program +]" + each_platform( lambda p: under_platform_specific_conditionals(p, program(p))) + "[+ ENDFOR +]" | def program_rules(): return "[+ FOR program +]" + under_conditional(each_platform(lambda p: program(p))) + "[+ ENDFOR +]" |
return "[+ FOR script +]" + under_conditional(each_platform(lambda p: script(p))) + "[+ ENDFOR +]" | return "[+ FOR script +]" + each_platform( lambda p: under_platform_specific_conditionals(p, script(p))) + "[+ ENDFOR +]" | def script_rules(): return "[+ FOR script +]" + under_conditional(each_platform(lambda p: script(p))) + "[+ ENDFOR +]" |
return "[+ FOR data +]" + under_conditional(each_platform(lambda p: data(p))) + "[+ ENDFOR +]" | return "[+ FOR data +]" + each_platform( lambda p: under_platform_specific_conditionals(p, data(p))) + "[+ ENDFOR +]" | def data_rules(): return "[+ FOR data +]" + under_conditional(each_platform(lambda p: data(p))) + "[+ ENDFOR +]" |
r += "man_MANS += [+ name +].[+ mansection +]\n" | r += gvar_add("man_MANS", "[+ name +].[+ mansection +]\n") | def manpage(): r = "if COND_MAN_PAGES\n" r += "man_MANS += [+ name +].[+ mansection +]\n" r += rule("[+ name +].[+ mansection +]", "", """ |
r += gvar_add("MODULE_FILES", "[+ name +].module") | r += gvar_add("MODULE_FILES", "[+ name +].module$(EXEEXT)") | def module(platform): r = gvar_add("noinst_PROGRAMS", "[+ name +].module") r += gvar_add("MODULE_FILES", "[+ name +].module") r += var_set(canonical_module() + "_SOURCES", platform_sources(platform) + "## platform sources") r += var_add(canonical_module() + "_SOURCES", shared_sources() + "## shared sources") r += var... |
def-[+ name +].lst: [+ name +].module | def-[+ name +].lst: [+ name +].module$(EXEEXT) | def module(platform): r = gvar_add("noinst_PROGRAMS", "[+ name +].module") r += gvar_add("MODULE_FILES", "[+ name +].module") r += var_set(canonical_module() + "_SOURCES", platform_sources(platform) + "## platform sources") r += var_add(canonical_module() + "_SOURCES", shared_sources() + "## shared sources") r += var... |
und-[+ name +].lst: [+ name +].module | und-[+ name +].lst: [+ name +].module$(EXEEXT) | def module(platform): r = gvar_add("noinst_PROGRAMS", "[+ name +].module") r += gvar_add("MODULE_FILES", "[+ name +].module") r += var_set(canonical_module() + "_SOURCES", platform_sources(platform) + "## platform sources") r += var_add(canonical_module() + "_SOURCES", shared_sources() + "## shared sources") r += var... |
mod-[+ name +].c: [+ name +].module $(top_builddir)/moddep.lst $(top_srcdir)/genmodsrc.sh | mod-[+ name +].c: [+ name +].module$(EXEEXT) $(top_builddir)/moddep.lst $(top_srcdir)/genmodsrc.sh | def module(platform): r = gvar_add("noinst_PROGRAMS", "[+ name +].module") r += gvar_add("MODULE_FILES", "[+ name +].module") r += var_set(canonical_module() + "_SOURCES", platform_sources(platform) + "## platform sources") r += var_add(canonical_module() + "_SOURCES", shared_sources() + "## shared sources") r += var... |
[+ name +].mod: [+ name +].module mod-[+ name +].o | [+ name +].mod: [+ name +].module$(EXEEXT) mod-[+ name +].o | def module(platform): r = gvar_add("noinst_PROGRAMS", "[+ name +].module") r += gvar_add("MODULE_FILES", "[+ name +].module") r += var_set(canonical_module() + "_SOURCES", platform_sources(platform) + "## platform sources") r += var_add(canonical_module() + "_SOURCES", shared_sources() + "## shared sources") r += var... |
r += rule("[+ name +].img", "[+ name +].image", """ | r += rule("[+ name +].img", "[+ name +].image$(EXEEXT)", """ | def image(platform): r = gvar_add("noinst_PROGRAMS", "[+ name +].image") r += var_set(canonical_image() + "_SOURCES", platform_sources(platform)) r += var_add(canonical_image() + "_SOURCES", shared_sources()) r += var_set("nodist_" + canonical_image() + "_SOURCES", platform_nodist_sources(platform) + "## platform nodi... |
if snippet_else != None: r += "[+ * +]" + snippet_if | if snippet_else != None: r += "[+ * +]" + snippet_else | def if_platform_tagged(platform, tag, snippet_if, snippet_else=None): r = "" r += "[+ IF " + tag + " defined +]" r += "[+ FOR " + tag + " +][+ CASE " + tag + " +]" for group in RMAP[platform]: r += "[+ = \"" + group + "\" +]" + snippet_if if snippet_else != None: r += "[+ * +]" + snippet_if r += "[+ ESAC +][+ ENDFOR +... |
r += rule("[+ name +].[+ mansection +]", "", """ $(MAKE) $(AM_MAKEFLAGS) [+ name +] | r += rule("[+ name +].[+ mansection +]", "[+ name +]", """ | def manpage(): r = "if COND_MAN_PAGES\n" r += gvar_add("man_MANS", "[+ name +].[+ mansection +]\n") r += rule("[+ name +].[+ mansection +]", "", """ |
if_platform_tagged(platform, "nostrip", lambda: "cp $@ $<", | if_platform_tagged(platform, "nostrip", lambda: "cp $< $@", | def kernel(platform): r = set_canonical_name_suffix(".exec") r += gvar_add("noinst_PROGRAMS", "[+ name +].exec") r += var_set(cname() + "_SOURCES", platform_sources(platform)) r += var_add(cname() + "_SOURCES", shared_sources()) r += var_set("nodist_" + cname() + "_SOURCES", platform_nodist_sources(platform) + " ## pla... |
>>> from nmevent import EventSlot | >>> from nmevent import Event | ... def _do_something(self): |
self.position = (float(values[0]), float(values[1])), self.center = (float(values[2]), float(values[3])), self.zoom = int(values[4]), | self.position = (float(values[0]), float(values[1])) self.center = (float(values[2]), float(values[3])) self.zoom = int(values[4]) | def __init__(self, value): self.value = value self.position = None self.center = None self.zoom = None if value: values = value.split(',') self.position = (float(values[0]), float(values[1])), self.center = (float(values[2]), float(values[3])), self.zoom = int(values[4]), |
self.x10_devices = {} self.insteon_devices = {} | self.cached_x10_device_names = {} self.cached_insteon_device_names = {} | def __init__ ( self): """ Initialization routines, clears the X10 device list, Insteon Device List, and clears the Server Address. Inputs - None Outputs - None """ self.x10_devices = {} self.insteon_devices = {} self.server_address = "" |
self.password_mgr = None self.username = None self.password = None | def __init__ ( self): """ Initialization routines, clears the X10 device list, Insteon Device List, and clears the Server Address. Inputs - None Outputs - None """ self.x10_devices = {} self.insteon_devices = {} self.server_address = "" | |
web_page = urllib.urlopen ( web_url ).readlines() | web_page = urllib2.urlopen ( web_url ) web_page = web_page.readlines() | def __init__ ( self): """ Initialization routines, clears the X10 device list, Insteon Device List, and clears the Server Address. Inputs - None Outputs - None """ self.x10_devices = {} self.insteon_devices = {} self.server_address = "" |
def map_device_to_dict ( self, web_data ): """This is used in the conversion of the text based devicelist call, to create the dictionary of values. Input - text version of a device Output - a Dictionary built with the field name / values for the device. This is depreciated, and will be eliminated after rewriting th... | def __init__ ( self): """ Initialization routines, clears the X10 device list, Insteon Device List, and clears the Server Address. Inputs - None Outputs - None """ self.x10_devices = {} self.insteon_devices = {} self.server_address = "" | |
for x in self.insteon_devices: if addrstr.strip().upper() == x["addrStr"]: return x for x in self.x10_devices: if addrstr.strip().upper() == x["addrStr"]: return x | device_list = self.get_device_list() for x in device_list: device_info = self.get_device_by_name ( x ) if device_info [ "addressStr"].strip().upper() == addrstr.strip().upper(): return device_info | def __init__ ( self): """ Initialization routines, clears the X10 device list, Insteon Device List, and clears the Server Address. Inputs - None Outputs - None """ self.x10_devices = {} self.insteon_devices = {} self.server_address = "" |
devices_xml = self.fetch_xml_page (self.server_address + r"/devices/%s.xml" % device_name.replace(" ", "%20") ) | devices_xml = self.fetch_xml_page (self.server_address + r"/devices/%s.xml" % self.URL_encode (device_name) ) | def __init__ ( self): """ Initialization routines, clears the X10 device list, Insteon Device List, and clears the Server Address. Inputs - None Outputs - None """ self.x10_devices = {} self.insteon_devices = {} self.server_address = "" |
data [ node.tag] = node.text.strip() return data def fetch_devices_from_indigo (self, ignore_filter=["",]): """ Depreciated, do not use. Inputs: ignore_filter - the Insteon or X10 addresses to filter out Outputs: None, populates the insteon_devices & x10_devices of the Indigo_Restful_Server object. The insteon_d... | if node.text <> None: data [ node.tag] = node.text.strip() else: data [ node.tag ] = node.text return data | def __init__ ( self): """ Initialization routines, clears the X10 device list, Insteon Device List, and clears the Server Address. Inputs - None Outputs - None """ self.x10_devices = {} self.insteon_devices = {} self.server_address = "" |
self.fetch_web_page ( self.server_address + r"/devices/%s?isOn=%i&_method=put" % (device_name.replace(" ", "%20"), status) ) | self.fetch_web_page ( self.server_address + r"/devices/%s?isOn=%i&_method=put" % (self.URL_encode ( device_name ), status) ) | def __init__ ( self): """ Initialization routines, clears the X10 device list, Insteon Device List, and clears the Server Address. Inputs - None Outputs - None """ self.x10_devices = {} self.insteon_devices = {} self.server_address = "" |
self.fetch_web_page ( self.server_address + r"/devices/%s?toggle=1&_method=put" % device_name.replace(" ", "%20") ) | self.fetch_web_page ( self.server_address + r"/devices/%s?toggle=1&_method=put" % self.URL_encode ( device_name ) ) | def __init__ ( self): """ Initialization routines, clears the X10 device list, Insteon Device List, and clears the Server Address. Inputs - None Outputs - None """ self.x10_devices = {} self.insteon_devices = {} self.server_address = "" |
self.fetch_web_page ( self.server_address + r"/devices/%s?brightness=%i&_method=put" % (device_name.replace(" ", "%20"), brightness) ) | self.fetch_web_page ( self.server_address + r"/devices/%s?brightness=%i&_method=put" % (self.URL_encode ( device_name ), brightness) ) | def __init__ ( self): """ Initialization routines, clears the X10 device list, Insteon Device List, and clears the Server Address. Inputs - None Outputs - None """ self.x10_devices = {} self.insteon_devices = {} self.server_address = "" |
self.fetch_web_page ( self.server_address + r"/devices/%s?_method=put&hvacCurrentMode=%s" % (device_name.replace(" ", "%20"), new_value.replace(" ", "%20")) ) | self.fetch_web_page ( self.server_address + r"/devices/%s?_method=put&hvacCurrentMode=%s" % (self.URL_encode ( device_name ), new_value.replace(" ", "%20")) ) | def __init__ ( self): """ Initialization routines, clears the X10 device list, Insteon Device List, and clears the Server Address. Inputs - None Outputs - None """ self.x10_devices = {} self.insteon_devices = {} self.server_address = "" |
self.fetch_web_page ( self.server_address + r"/devices/%s?_method=put&hvacCurrentMode=%s" % (device_name.replace(" ", "%20"), new_value.replace(" ", "%20") ) ) | self.fetch_web_page ( self.server_address + r"/devices/%s?_method=put&hvacCurrentMode=%s" % (self.URL_encode ( device_name ), new_value.replace(" ", "%20") ) ) def set_thermostat_setpoints ( device_name=None, Heat = 0, Cool = 0): """Set an thermostat Heating & Cooling Break Points Input - device_name - The thermost... | def __init__ ( self): """ Initialization routines, clears the X10 device list, Insteon Device List, and clears the Server Address. Inputs - None Outputs - None """ self.x10_devices = {} self.insteon_devices = {} self.server_address = "" |
data [ node.tag] = node.text.strip() | if node.text <> None: data [ node.tag] = node.text.strip() else: data [ node.tag] = node.text | def __init__ ( self): """ Initialization routines, clears the X10 device list, Insteon Device List, and clears the Server Address. Inputs - None Outputs - None """ self.x10_devices = {} self.insteon_devices = {} self.server_address = "" |
data [subnode.text] = self.server_address + '%s' % subnode.get ('href') return data | device_info = self.get_device_by_name ( subnode.text) device_addresses = [] device_xml_page_url = self.server_address + r'/insteonlinks/%s' % subnode.get ('href').split("/")[-1] device_root = self.fetch_xml_page ( device_xml_page_url ) for device_subnode in device_root.getiterator(): if device_subnode.tag.strip() == "... | def __init__ ( self): """ Initialization routines, clears the X10 device list, Insteon Device List, and clears the Server Address. Inputs - None Outputs - None """ self.x10_devices = {} self.insteon_devices = {} self.server_address = "" |
Indigo_server.set_server (r"http://127.0.0.1:8176" ) Indigo_server.fetch_devices_from_indigo () Indigo_server.change_device_state_by_name ( device_name = "office lamp", status = 1) Indigo_server.change_brightness_state_by_name ( device_name = "office lamp", brightness= 75) Indigo_server.set_variable_by_name ("testing",... | print "Links - ",Indigo_server.get_insteon_links () | def TranslateFromXml(xmlDev): """Used to translate from BeautifulSoup to dictionary format. """ data = {} for x in xmlDev.findAll(): temp = str(x).split(">") tag_name = temp[0][1:255].strip() if tag_name.find (".xml") <> -1: # # The Action List, Variable List, and Device List, all have the URI encoded in the name of th... |
message.format_secondary_text("Jokosher requires this package to be able to use effects, please install the relevant package for your distribution.") | message.format_secondary_text("Jokosher requires one or more packages of LADSPA effects to be able to use this feature, please install the relevant package(s) for your distribution.") | def OnEffectsButtonClicked(self, widget): """ Creates and shows the instrument effects dialog if LADSPA is installed. Parameters: widget -- reserved for GTK callbacks, don't use it explicitly. mouse -- reserved for GTK callbacks, don't use it explicitly. """ Globals.debug("props button pressed") |
message = gtk.MessageDialog(parent=None, flags=0, type=gtk.MESSAGE_INFO,buttons=gtk.BUTTONS_OK, message_format="You do not have the LADSPA effects plugins installed") | message = gtk.MessageDialog(parent=None, flags=0, type=gtk.MESSAGE_INFO,buttons=gtk.BUTTONS_OK, message_format="You do not have any LADSPA effects plugins installed") | def OnEffectsButtonClicked(self, widget): """ Creates and shows the instrument effects dialog if LADSPA is installed. Parameters: widget -- reserved for GTK callbacks, don't use it explicitly. mouse -- reserved for GTK callbacks, don't use it explicitly. """ Globals.debug("props button pressed") |
message.format_secondary_text("Jokosher does not currently support LADSPA plugins on Windows") | message.format_secondary_text("Jokosher does not currently support any LADSPA plugins on Windows") | def OnEffectsButtonClicked(self, widget): """ Creates and shows the instrument effects dialog if LADSPA is installed. Parameters: widget -- reserved for GTK callbacks, don't use it explicitly. mouse -- reserved for GTK callbacks, don't use it explicitly. """ Globals.debug("props button pressed") |
contriblnkbtn = gtk.LinkButton("http://www.jokosher.org/contribute") | contriblnkbtn = gtk.LinkButton("http://www.jokosher.org/contribute",label="http://www.jokosher.org/contribute") | def OnContributingDialog(self, widget): """ Creates and shows the "Contributing to Jokosher" dialog. Parameters: widget -- reserved for GTK callbacks, don't use it explicitly. """ self.contribTree = gtk.glade.XML(Globals.GLADE_PATH, "ContributingDialog") # grab references to the ContributingDialog window and vbox sel... |
def OnOpenProject(self, widget, destroyCallback=None): | def OnOpenProject(self, widget): self.OnCloseProject() def OnImportProject(self, widget, destroyCallback=None): | def OnShowHoursMins(self, widget): """ Sets and updates the current timeline view to Hours, Minutes and Seconds. Parameters: widget -- reserved for GTK callbacks, don't use it explicitly. """ if self.settingButtons: return if widget.get_active() and self.project and self.project.transport: self.project.SetTransportMod... |
def OnCloseProject(self, widget): | def OnCloseProject(self, widget=None): | def OnCloseProject(self, widget): """ Closes the current project by calling CloseProject(). Parameters: widget -- reserved for GTK callbacks, don't use it explicitly. """ if self.CloseProject() == 0: self.SetGUIProjectLoaded() |
if not Globals.LADSPA_NAME_MAP == []: | if Globals.LADSPA_NAME_MAP: | def OnEffectsButtonClicked(self, widget): """ Creates and shows the instrument effects dialog if LADSPA is installed. Parameters: widget -- reserved for GTK callbacks, don't use it explicitly. mouse -- reserved for GTK callbacks, don't use it explicitly. """ Globals.debug("props button pressed") |
message = gtk.MessageDialog(parent=None, flags=0, type=gtk.MESSAGE_INFO,buttons=gtk.BUTTONS_OK, message_format="You do not have the LADSPA effects plugins installed") message.format_secondary_text("Jokosher requires this package to be able to use effects, please install the relevant package for your distribution.\n\nN... | message = gtk.MessageDialog(parent=None, flags=0, type=gtk.MESSAGE_INFO,buttons=gtk.BUTTONS_OK, message_format="You do not have the LADSPA effects plugins installed") if platform.system() =="Windows": message.format_secondary_text("Jokosher does not currently support LADSPA plugins on Windows") else: message.format_... | def OnEffectsButtonClicked(self, widget): """ Creates and shows the instrument effects dialog if LADSPA is installed. Parameters: widget -- reserved for GTK callbacks, don't use it explicitly. mouse -- reserved for GTK callbacks, don't use it explicitly. """ Globals.debug("props button pressed") |
Creates and shows the instrument effects dialog | Creates and shows the instrument effects dialog if LADSPA is installed. | def OnEffectsButtonClicked(self, widget): """ Creates and shows the instrument effects dialog Parameters: widget -- reserved for GTK callbacks, don't use it explicitly. mouse -- reserved for GTK callbacks, don't use it explicitly. """ Globals.debug("props button pressed") if not self.effectsDialog: self.effectsDialog ... |
if not self.effectsDialog: self.effectsDialog = InstrumentEffectsDialog.InstrumentEffectsDialog( self.instrument, self.OnEffectsDialogDestroyed, self.mainview.icon) else: self.effectsDialog.BringWindowToFront() | if not Globals.LADSPA_NAME_MAP == []: if not self.effectsDialog: self.effectsDialog = InstrumentEffectsDialog.InstrumentEffectsDialog( self.instrument, self.OnEffectsDialogDestroyed, self.mainview.icon) else: self.effectsDialog.BringWindowToFront() else: message = gtk.MessageDialog(parent=None, flags=0, type=gtk.MES... | def OnEffectsButtonClicked(self, widget): """ Creates and shows the instrument effects dialog Parameters: widget -- reserved for GTK callbacks, don't use it explicitly. mouse -- reserved for GTK callbacks, don't use it explicitly. """ Globals.debug("props button pressed") if not self.effectsDialog: self.effectsDialog ... |
message = gtk.MessageDialog(parent=None, flags=0, type=gtk.MESSAGE_INFO,buttons=gtk.BUTTONS_OK, message_format="You do not have any LADSPA effects plugins installed") | message = gtk.MessageDialog(parent=None, flags=0, type=gtk.MESSAGE_INFO,buttons=gtk.BUTTONS_OK, message_format=_("You do not have any LADSPA effects plugins installed")) | def OnEffectsButtonClicked(self, widget): """ Creates and shows the instrument effects dialog if LADSPA is installed. Parameters: widget -- reserved for GTK callbacks, don't use it explicitly. mouse -- reserved for GTK callbacks, don't use it explicitly. """ Globals.debug("props button pressed") |
message.format_secondary_text("Jokosher does not currently support any LADSPA plugins on Windows") | message.format_secondary_text(_("Jokosher does not currently support any LADSPA plugins on Windows")) | def OnEffectsButtonClicked(self, widget): """ Creates and shows the instrument effects dialog if LADSPA is installed. Parameters: widget -- reserved for GTK callbacks, don't use it explicitly. mouse -- reserved for GTK callbacks, don't use it explicitly. """ Globals.debug("props button pressed") |
message.format_secondary_text("Jokosher requires one or more packages of LADSPA effects to be able to use this feature, please install the relevant package(s) for your distribution.") | message.format_secondary_text(_("Jokosher requires one or more packages of LADSPA effects to be able to use this feature, please install the relevant package(s) for your distribution.")) | def OnEffectsButtonClicked(self, widget): """ Creates and shows the instrument effects dialog if LADSPA is installed. Parameters: widget -- reserved for GTK callbacks, don't use it explicitly. mouse -- reserved for GTK callbacks, don't use it explicitly. """ Globals.debug("props button pressed") |
recordingbin = gst.Bin("recording bin") | recordingbin = gst.Bin("recordingbin_%d" % recbin) | def Record(self): """ Start recording all selected instruments. """ |
Globals.debug("adding recordingbin") | Globals.debug("adding recordingbin_%d" % recbin) | def Record(self): """ Start recording all selected instruments. """ |
self.label = self.get_children()[0].get_children()[0] self.label.set_use_markup(True) | self.label = self.get_label_in_hierarchy() if self.label: self.label.set_use_markup(True) def get_label_in_hierarchy(self): """ In Gtk+ 2.19 Statusbar was changed to keep a the Label inside an HBox inside a frame. In previous versions the Label was directly inside the frame. Here we search the entire container hier... | def __init__(self): """ Creates a new instance of StatusBar with no messages shown. """ gtk.Statusbar.__init__(self) # gtk.Statusbar contains a label inside a frame inside itself self.label = self.get_children()[0].get_children()[0] self.label.set_use_markup(True) |
self.label.set_use_markup(True) | if self.label: self.label.set_use_markup(True) | def Push(self, message): """ Insert a new message into the messages stack. Parameters: message -- string containing the new message to be added to the StatusBar. Return: the value of the next valid message ID. """ message_id = self.push(0, message) self.label.set_use_markup(True) return message_id |
self.label.set_use_markup(True) | if self.label: self.label.set_use_markup(True) | def Remove(self, message_id): """ Removes a new message from the messages stack. Parameters: message_id -- numerical id of the message to be removed from the StatusBar. """ self.remove_message(0, message_id) self.label.set_use_markup(True) |
if create_parent: container = create_parent or 'div' html = '<%s>%s</%s>' % (container, html, container) | def fragment_fromstring(html, create_parent=False, guess_charset=False, parser=None): """Parses a single HTML element; it is an error if there is more than one element, or if anything but whitespace precedes or follows the element. If create_parent is true (or is a tag name) then a parent node will be created to encap... | |
if len(children) > 1: | if create_parent: if not isinstance(create_parent, _strings): create_parent = 'div' new_root = Element(create_parent) if isinstance(children[0], _strings): new_root.text = children[0] del children[0] new_root.extend(children) children = new_root elif len(children) > 1: | def fragment_fromstring(html, create_parent=False, guess_charset=False, parser=None): """Parses a single HTML element; it is an error if there is more than one element, or if anything but whitespace precedes or follows the element. If create_parent is true (or is a tag name) then a parent node will be created to encap... |
parser = self.etree.XMLParser() self.assertEquals(None, parser.target) | def test_parser_target_property(self): class Target(object): pass | |
will be created to encapsulate the HTML in a single element. | will be created to encapsulate the HTML in a single element. In this case, leading or trailing text is allowed. | def fragment_fromstring(html, create_parent=False, guess_charset=False, parser=None): """Parses a single HTML element; it is an error if there is more than one element, or if anything but whitespace precedes or follows the element. If create_parent is true (or is a tag name) then a parent node will be created to encap... |
children = fragments_fromstring(html, True, guess_charset, parser) if not children: raise etree.ParserError('No elements found') | accept_leading_text = bool(create_parent) elements = fragments_fromstring( html, guess_charset=guess_charset, parser=parser, no_leading_text=not accept_leading_text, **kw) | def fragment_fromstring(html, create_parent=False, guess_charset=False, parser=None): """Parses a single HTML element; it is an error if there is more than one element, or if anything but whitespace precedes or follows the element. If create_parent is true (or is a tag name) then a parent node will be created to encap... |
if not isinstance(create_parent, _strings): | if not isinstance(create_parent, basestring): | def fragment_fromstring(html, create_parent=False, guess_charset=False, parser=None): """Parses a single HTML element; it is an error if there is more than one element, or if anything but whitespace precedes or follows the element. If create_parent is true (or is a tag name) then a parent node will be created to encap... |
if isinstance(children[0], _strings): new_root.text = children[0] del children[0] new_root.extend(children) children = new_root elif len(children) > 1: | if elements: if isinstance(elements[0], basestring): new_root.text = elements[0] del elements[0] new_root.extend(elements) return new_root if not elements: raise etree.ParserError('No elements found') if len(elements) > 1: | def fragment_fromstring(html, create_parent=False, guess_charset=False, parser=None): """Parses a single HTML element; it is an error if there is more than one element, or if anything but whitespace precedes or follows the element. If create_parent is true (or is a tag name) then a parent node will be created to encap... |
result = children[0] | result = elements[0] | def fragment_fromstring(html, create_parent=False, guess_charset=False, parser=None): """Parses a single HTML element; it is an error if there is more than one element, or if anything but whitespace precedes or follows the element. If create_parent is true (or is a tag name) then a parent node will be created to encap... |
retval >>= 8 return retval == 0 | if retval: write('exit status: %d, signal: %d', retval >> 8, retval % 0xFF) return (retval % 0xFF) == 0 | def run_tests(test_cases): if not test_cases: return True write('Running subset of %d tests [%s .. %s]', len(test_cases), test_cases[0].id(), test_cases[-1].id()) pid = os.fork() if not pid: # child executes tests runner = test.CustomTestRunner(cfg, None) suite = unittest.TestSuite() suite.addTests(test_cases) os._exit... |
"The psuedo-class %r is not supported" % self.name) | "The pseudo-class %r is not supported" % self.name) | def xpath(self): sel_path = self.selector.xpath() if self.name in self.unsupported: raise ExpressionError( "The psuedo-class %r is not supported" % self.name) method = '_xpath_' + self.name.replace('-', '_') if not hasattr(self, method): raise ExpressionError( "The psuedo-class %r is unknown" % self.name) method = geta... |
"The psuedo-class %r is unknown" % self.name) | "The pseudo-class %r is unknown" % self.name) | def xpath(self): sel_path = self.selector.xpath() if self.name in self.unsupported: raise ExpressionError( "The psuedo-class %r is not supported" % self.name) method = '_xpath_' + self.name.replace('-', '_') if not hasattr(self, method): raise ExpressionError( "The psuedo-class %r is unknown" % self.name) method = geta... |
"The psuedo-class %r is unsupported" % self.ident) | "The pseudo-class %r is unsupported" % self.ident) | def xpath(self): el_xpath = self.element.xpath() if self.ident in self.unsupported: raise ExpressionError( "The psuedo-class %r is unsupported" % self.ident) method = '_xpath_' + self.ident.replace('-', '_') if not hasattr(self, method): raise ExpressionError( "The psuedo-class %r is unknown" % self.ident) method = get... |
"The psuedo-class %r is unknown" % self.ident) | "The pseudo-class %r is unknown" % self.ident) | def xpath(self): el_xpath = self.element.xpath() if self.ident in self.unsupported: raise ExpressionError( "The psuedo-class %r is unsupported" % self.ident) method = '_xpath_' + self.ident.replace('-', '_') if not hasattr(self, method): raise ExpressionError( "The psuedo-class %r is unknown" % self.ident) method = get... |
content = open(filename).read() | content = read_file(filename) | def test_xinclude_text(self): filename = fileInTestDir('test_broken.xml') root = etree.XML(_bytes('''\ <doc xmlns:xi="http://www.w3.org/2001/XInclude"> <xi:include href="%s" parse="text"/> </doc> ''' % filename)) old_text = root.text content = open(filename).read() old_tail = root[0].tail |
include_text = open(fileInTestDir('test.xml')).read() | include_text = read_file(fileInTestDir('test.xml')) | def test_xinclude_resolver(self): class res(etree.Resolver): include_text = open(fileInTestDir('test.xml')).read() called = {} def resolve(self, url, id, context): if url.endswith(".dtd"): self.called["dtd"] = True return self.resolve_filename( fileInTestDir('test.dtd'), context) elif url.endswith("test_xinclude.xml"):... |
s = gzip.GzipFile(fileobj=BytesIO(f.getvalue())).read() | gzfile = gzip.GzipFile(fileobj=BytesIO(f.getvalue())) try: s = gzfile.read() finally: gzfile.close() | def test_c14n_gzip(self): tree = self.parse(_bytes('<a>'+'<b/>'*200+'</a>')) f = BytesIO() tree.write_c14n(f, compression=9) s = gzip.GzipFile(fileobj=BytesIO(f.getvalue())).read() self.assertEquals(_bytes('<a>'+'<b></b>'*200+'</a>'), s) |
f = open(filename, 'rb') try: data = f.read() finally: f.close() | data = read_file(filename, 'rb') | def test_c14n_file(self): tree = self.parse(_bytes('<a><b/></a>')) handle, filename = tempfile.mkstemp() try: tree.write_c14n(filename) f = open(filename, 'rb') try: data = f.read() finally: f.close() finally: os.close(handle) os.remove(filename) self.assertEquals(_bytes('<a><b></b></a>'), data) |
s = gzip.GzipFile(fileobj=BytesIO(f.getvalue())).read() | gzfile = gzip.GzipFile(fileobj=BytesIO(f.getvalue())) try: s = gzfile.read() finally: gzfile.close() | def test_write_gzip(self): tree = self.parse(_bytes('<a>'+'<b/>'*200+'</a>')) f = BytesIO() tree.write(f, compression=9) s = gzip.GzipFile(fileobj=BytesIO(f.getvalue())).read() self.assertEquals(_bytes('<a>'+'<b/>'*200+'</a>'), s) |
s1 = gzip.GzipFile(fileobj=BytesIO(s)).read() | gzfile = gzip.GzipFile(fileobj=BytesIO(s)) try: s1 = gzfile.read() finally: gzfile.close() | def test_write_gzip_level(self): tree = self.parse(_bytes('<a>'+'<b/>'*200+'</a>')) f = BytesIO() tree.write(f, compression=0) s0 = f.getvalue() |
s9 = gzip.GzipFile(fileobj=BytesIO(s)).read() | gzfile = gzip.GzipFile(fileobj=BytesIO(s)) try: s9 = gzfile.read() finally: gzfile.close() | def test_write_gzip_level(self): tree = self.parse(_bytes('<a>'+'<b/>'*200+'</a>')) f = BytesIO() tree.write(f, compression=0) s0 = f.getvalue() |
f = open(filename, 'rb') data = f.read() f.close() | data = read_file(filename, 'rb') | def test_write_file(self): tree = self.parse(_bytes('<a><b/></a>')) handle, filename = tempfile.mkstemp() try: tree.write(filename) f = open(filename, 'rb') data = f.read() f.close() finally: os.close(handle) os.remove(filename) self.assertEquals(_bytes('<a><b/></a>'), data) |
data = f.read() f.close() | try: data = f.read() finally: f.close() | def test_write_file_gzip(self): tree = self.parse(_bytes('<a>'+'<b/>'*200+'</a>')) handle, filename = tempfile.mkstemp() try: tree.write(filename, compression=9) f = gzip.open(filename, 'rb') data = f.read() f.close() finally: os.close(handle) os.remove(filename) self.assertEquals(_bytes('<a>'+'<b/>'*200+'</a>'), data) |
[ child.attrib.keys() for child in a ]) | [ list(child.attrib.keys()) for child in a ]) | def test_setslice_all_replace_reversed_ns1(self): Element = self.etree.Element SubElement = self.etree.SubElement |
[ child.attrib.keys() for child in a ]) | [ list(child.attrib.keys()) for child in a ]) | def test_setslice_all_replace_reversed_ns2(self): Element = self.etree.Element SubElement = self.etree.SubElement |
if line.startswith('%% generator') or line.startswith('% generated by '): | if line.startswith('%% generator') \ or line.startswith('% generated by ') \ or '\\begin{document}' in line \ or '\\makeindex' in line: | def copy_epydoc_macros(src, dest, existing_header_lines): doc = file(src, 'r') out = file(dest, "w") for line in doc: if line.startswith('%% generator') or line.startswith('% generated by '): break if line.startswith('%') or \ r'\documentclass' in line or \ r'\makeindex' in line or \ r'{inputenc}' in line: continue if ... |
def tex_postprocess(src, dest, want_header = False, process_line=noop): | def tex_postprocess(src_path, dest_path, want_header=False, process_line=noop): | def tex_postprocess(src, dest, want_header = False, process_line=noop): """ Postprocessing of the LaTeX file generated from ReST. Reads file src and saves to dest only the true content (without the document header and final) - so it is suitable to be used as part of the longer document. Returns the title of document ... |
Reads file src and saves to dest only the true content | Reads file src_path and saves to dest_path only the true content | def tex_postprocess(src, dest, want_header = False, process_line=noop): """ Postprocessing of the LaTeX file generated from ReST. Reads file src and saves to dest only the true content (without the document header and final) - so it is suitable to be used as part of the longer document. Returns the title of document ... |
search_title = re.compile(r'\\title{([^}]*)}').search skipping = re.compile(r'(\\end{document}|\\tableofcontents)').search src = file(src) dest = file(dest, "w") iter_lines = iter(src.readlines()) | search_title = re.compile(r'\\title{([^{}]*(?:{[^}]*})*)}').search skipping = re.compile(r'(\\end{document}|\\tableofcontents|^%)').search src = file(src_path) dest = file(dest_path, "w") src_text = src.read() src.close() title = search_title(src_text) if title: title = re.sub(r'\\\w+({[^}]*})?', '', title.group(1)... | def tex_postprocess(src, dest, want_header = False, process_line=noop): """ Postprocessing of the LaTeX file generated from ReST. Reads file src and saves to dest only the true content (without the document header and final) - so it is suitable to be used as part of the longer document. Returns the title of document ... |
m = search_title(l) if m: title = m.group(0) | def tex_postprocess(src, dest, want_header = False, process_line=noop): """ Postprocessing of the LaTeX file generated from ReST. Reads file src and saves to dest only the true content (without the document header and final) - so it is suitable to be used as part of the longer document. Returns the title of document ... | |
dest.write(l) | dest.write(l + '\n') | def tex_postprocess(src, dest, want_header = False, process_line=noop): """ Postprocessing of the LaTeX file generated from ReST. Reads file src and saves to dest only the true content (without the document header and final) - so it is suitable to be used as part of the longer document. Returns the title of document ... |
raise Exception("Bueee, no title") | raise Exception("Bueee, no title in %s" % src_path) | def tex_postprocess(src, dest, want_header = False, process_line=noop): """ Postprocessing of the LaTeX file generated from ReST. Reads file src and saves to dest only the true content (without the document header and final) - so it is suitable to be used as part of the longer document. Returns the title of document ... |
have_epydoc_macros = False | def fix_relative_hyperrefs(line): line = replace_image_paths(r'\1../html/', line) if r'\href' not in line: return line line = replace_interdoc_hyperrefs(build_hyperref, line) return replace_docinternal_hyperrefs(r'\hyperref[\1]', line) | |
hln = DOCUMENT_CLASS elif hln.startswith("%% generator ") or hln.startswith("% generated "): master.write(EPYDOC_IMPORT) | hln = DOCUMENT_CLASS + EPYDOC_IMPORT | def fix_changelog(line): m = find_version_title(line) if m: line = "%sChanges in version %s, released %s%s" % m.groups() else: line = line.replace(r'\subsection{', r'\subsection*{') return line |
master.write(hln) | master.write(hln + '\n') | def fix_changelog(line): m = find_version_title(line) if m: line = "%sChanges in version %s, released %s%s" % m.groups() else: line = line.replace(r'\subsection{', r'\subsection*{') return line |
break if not run_tests(right): | elif not run_tests(right): | def bisect_tests(): tests = find_tests() write('Found %d tests', len(tests)) shift = len(tests) // 4 last_failed = False while len(tests) > 1 and shift > 0: mid = len(tests) // 2 + 1 left, right = tests[:mid], tests[mid:] if not run_tests(left): last_failed = True tests = left shift = len(tests) // 4 + 1 break if not ... |
break last_failed = False shift //= 2 tests = tests[shift:] + tests[:shift] | else: last_failed = False shift //= 2 tests = tests[shift:] + tests[:shift] | def bisect_tests(): tests = find_tests() write('Found %d tests', len(tests)) shift = len(tests) // 4 last_failed = False while len(tests) > 1 and shift > 0: mid = len(tests) // 2 + 1 left, right = tests[:mid], tests[mid:] if not run_tests(left): last_failed = True tests = left shift = len(tests) // 4 + 1 break if not ... |
doctests = open(filename).read() | f = open(filename) try: doctests = f.read() finally: f.close() | def make_doctest(filename): filename = _get_caller_relative_path(filename) doctests = open(filename).read() doctests = _fix_unicode(r'\1\2', doctests) doctests = _fix_exceptions(r'\1 as \2', doctests) return doctest.DocTestCase( doctest_parser.get_doctest( doctests, {}, os.path.basename(filename), filename, 0)) |
doctests = open(filename).read() | f = open(filename) try: doctests = f.read() finally: f.close() | def make_doctest(filename): filename = _get_caller_relative_path(filename) doctests = open(filename).read() doctests = _fix_traceback(r'\1\2', doctests) doctests = _fix_exceptions(r'\1, \2', doctests) doctests = _fix_bytes(r'\1\2', doctests) return doctest.DocTestCase( doctest_parser.get_doctest( doctests, {}, os.path.... |
test_cases = [ item[-1] for item in test_cases ] | def _test(self, test_cases): if not test_cases: return self.PASS test_cases = [ item[-1] for item in test_cases ] write('Running subset of %d tests %s', len(test_cases), self.coerce(test_cases)) pid = os.fork() if not pid: # child executes tests runner = test.CustomTestRunner(cfg, None) suite = unittest.TestSuite() sui... | |
data = f.read() f.close() | try: data = f.read() finally: f.close() | def test_c14n_file(self): tree = self.parse(_bytes('<a><b/></a>')) handle, filename = tempfile.mkstemp() try: tree.write_c14n(filename) f = open(filename, 'rb') data = f.read() f.close() finally: os.close(handle) os.remove(filename) self.assertEquals(_bytes('<a><b></b></a>'), data) |
data = f.read() f.close() | try: data = f.read() finally: f.close() | def test_c14n_file_gzip(self): tree = self.parse(_bytes('<a>'+'<b/>'*200+'</a>')) handle, filename = tempfile.mkstemp() try: tree.write_c14n(filename, compression=9) f = gzip.open(filename, 'rb') data = f.read() f.close() finally: os.close(handle) os.remove(filename) self.assertEquals(_bytes('<a>'+'<b></b>'*200+'</a>')... |
def open_in_browser(doc): """ Open the HTML document in a web browser (saving it to a temporary file to open it). | def open_in_browser(doc, encoding=None): """ Open the HTML document in a web browser, saving it to a temporary file to open it. Note that this does not delete the file after use. This is mainly meant for debugging. | def open_in_browser(doc): """ Open the HTML document in a web browser (saving it to a temporary file to open it). """ import os import webbrowser try: write_doc = doc.write except AttributeError: write_doc = etree.ElementTree(element=doc).write fn = os.tempnam() + '.html' write_doc(fn, method="html") url = 'file://' + ... |
write_doc = doc.write except AttributeError: write_doc = etree.ElementTree(element=doc).write fn = os.tempnam() + '.html' write_doc(fn, method="html") | doc.write(f, method="html", encoding=encoding or doc.docinfo.encoding or "UTF-8") finally: f.close() | def open_in_browser(doc): """ Open the HTML document in a web browser (saving it to a temporary file to open it). """ import os import webbrowser try: write_doc = doc.write except AttributeError: write_doc = etree.ElementTree(element=doc).write fn = os.tempnam() + '.html' write_doc(fn, method="html") url = 'file://' + ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.