rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
tracker = app.sharing_tracker.get_tracker(info) | tracker = app.sharing_tracker.get_tracker(info.id) | def on_row_clicked(self, view, iter): info = view.model[iter][0] info.mount = True self.view.model_changed() current_display = app.display_manager.get_current_display() # The displays don't disappear automatically so handle the case # where the user disconnects and then immediately reconnects to # the same share. Won'... |
self.calc_urls() | self.urls = self.calc_urls() | def lookup(self, engine, query): check_u(engine) check_u(query) self.reset() self.searching = True self.engine = engine self.query = query self.calc_urls() self.update() self.ufeed.signal_change() |
elif self.full_view.item_list.get_hidden_count() > 0: | else: | def _update_full_section(self, downloads, items, autoqueued_count): if self._search_text == '': itemtext = ngettext("%(count)d Item", "%(count)d Items", items, {"count": items}) downloadingtext = ngettext("%(count)d Downloading", "%(count)d Downloading", downloads, {"count": downloads}) if autoqueued_count: queuedtext ... |
else: text = _("All Items Match Search") text = u"| %s" % text | def _update_full_section(self, downloads, items, autoqueued_count): if self._search_text == '': itemtext = ngettext("%(count)d Item", "%(count)d Items", items, {"count": items}) downloadingtext = ngettext("%(count)d Downloading", "%(count)d Downloading", downloads, {"count": downloads}) if autoqueued_count: queuedtext ... | |
and resume_time > 10 | def play(self, start_at=0): duration = self.player.get_total_playback_time() self.emit('will-play', duration) resume_time = self.playlist[self.position].resume_time if start_at > 0: self.player.play_from_time(start_at) elif (config.get(prefs.RESUME_VIDEOS_MODE) and resume_time > 10 and not self.is_paused): self.player.... | |
self.id = None self.view = None | def __init__(self): ViewTracker.__init__(self) self.id = None self.view = None | |
pass | del self._hidden_items[id] | def remove_item(self, id): try: iter = self._iter_map.pop(id) except KeyError: pass # The item isn't in our current list, just skip it else: self.model.remove(iter) |
base_href = widgetutil.get_feed_info(item_info.feed_id).base_href | try: base_href = widgetutil.get_feed_info(item_info.feed_id).base_href except ValueError: logging.warn("Feed not present when clicking link (%s)", item_info.feed_id) return | def on_hotspot_clicked(self, itemview, name, iter): """Hotspot handler for ItemViews.""" |
self.retryTime = -1 | self.retryCount = -1 | def handle_network_error(self, error): if isinstance(error, httpclient.NetworkError): if (isinstance(error, httpclient.MalformedURL) or isinstance(error, httpclient.UnknownHostError) or isinstance(error, httpclient.UnexpectedStatusCode)): self.handle_error(error.getFriendlyDescription(), error.getLongDescription()) sel... |
self.bus.connect("message::eos", self.on_bus_message) self.bus.connect("message::state-changed", self.on_bus_message) self.bus.connect("message::error", self.on_bus_message) audiosink = config.get(options.GSTREAMER_AUDIOSINK) try: self.audiosink = gst.element_factory_make(audiosink, "sink") except gst.ElementNotFound... | self.watch_ids.append(self.bus.connect("message", self.on_bus_message)) | def __init__(self): logging.info("GStreamer version: %s", gst.version_string()) |
def select_file(self, filename, callback, errback): | def select_file(self, filename, callback, errback, sub_filename=""): | def select_file(self, filename, callback, errback): """starts playing the specified file""" self.stop() self.select_callbacks = (callback, errback) self.playbin.set_property("uri", "file://%s" % filename) self.playbin.set_state(gst.STATE_PAUSED) |
def _on_state_changed(self, bus, message, seconds): | def _set_current_time_actual(self, bus, message, seconds): | def _on_state_changed(self, bus, message, seconds): if self.playbin.get_state(0)[1] in (gst.STATE_PAUSED, gst.STATE_PLAYING): self._seek(seconds) self.bus.disconnect(self._on_state_changed_id) |
self.bus.disconnect(self._on_state_changed_id) | self.bus.disconnect(self._set_current_time_actual_id) | def _on_state_changed(self, bus, message, seconds): if self.playbin.get_state(0)[1] in (gst.STATE_PAUSED, gst.STATE_PLAYING): self._seek(seconds) self.bus.disconnect(self._on_state_changed_id) |
self._on_state_changed_id = self.bus.connect("message::state-changed", self._on_state_changed, seconds) | self._set_current_time_actual_id = self.bus.connect( "message::state-changed", self._set_current_time_actual, seconds) | def set_current_time(self, seconds): # only want to kick these off when PAUSED or PLAYING if self.playbin.get_state(0)[1] not in (gst.STATE_PAUSED, gst.STATE_PLAYING): self._on_state_changed_id = self.bus.connect("message::state-changed", self._on_state_changed, seconds) return |
self.playbin.set_state(gst.STATE_NULL) | if self.playbin: self.playbin.set_state(gst.STATE_NULL) self.destroy_playbin() | def reset(self): self.playbin.set_state(gst.STATE_NULL) |
self.playbin.set_state(gst.STATE_NULL) | if self.playbin: self.playbin.set_state(gst.STATE_NULL) self.destroy_playbin() | def stop(self): self.playbin.set_state(gst.STATE_NULL) |
logging.info("GStreamer version: %s", gst.version_string()) self.bus.connect('sync-message::element', self.on_sync_message) | def __init__(self): Renderer.__init__(self) logging.info("GStreamer version: %s", gst.version_string()) | |
self.sink = gst.element_factory_make(videosink, "sink") | self.videosink = gst.element_factory_make(videosink, "videosink") | def __init__(self): Renderer.__init__(self) logging.info("GStreamer version: %s", gst.version_string()) |
videosink = "ximagesink" self.sink = gst.element_factory_make(videosink, "sink") | videosink = "xvimagesink" self.videosink = gst.element_factory_make(videosink, "videosink") | def __init__(self): Renderer.__init__(self) logging.info("GStreamer version: %s", gst.version_string()) |
self.playbin.set_property("video-sink", self.sink) | self.textsink = gst.element_factory_make("textoverlay", "textsink") def build_playbin(self): Renderer.build_playbin(self) self.watch_ids.append(self.bus.connect('sync-message::element', self.on_sync_message)) self.playbin.set_property("video-sink", self.videosink) self.playbin.set_property("text-sink", self.textsink) ... | def __init__(self): Renderer.__init__(self) logging.info("GStreamer version: %s", gst.version_string()) |
self.playbin.set_state(gst.STATE_NULL) | if self.playbin: self.playbin.set_state(gst.STATE_NULL) | def on_destroy(self, widget): self.playbin.set_state(gst.STATE_NULL) |
if self.sink and hasattr(self.sink, "expose"): self.sink.expose() | if self.videosink and hasattr(self.videosink, "expose"): self.videosink.expose() | def on_expose(self, widget, event): if self.sink and hasattr(self.sink, "expose"): self.sink.expose() else: # if we had an image to show, we could do so here... that image # would show for audio-only items. widget.window.draw_rectangle(self.gc, True, 0, 0, widget.allocation.width, widget.allocation.height) return True |
if config.get(prefs.ENABLE_SUBTITLES): default_track = self.get_enabled_subtitle_track() if default_track is None: tracks = self.get_subtitle_tracks() if len(tracks) > 0: self.enable_subtitle_track(tracks[0]) else: self.disable_subtitles() | if hasattr(self, "pick_subtitle_track"): self.enable_subtitle_track(self.pick_subtitle_track) del self.__dict__["pick_subtitle_track"] else: if config.get(prefs.ENABLE_SUBTITLES): default_track = self.get_enabled_subtitle_track() if default_track is None: tracks = self.get_subtitle_tracks() if len(tracks) > 0: self.en... | def finish_select_file(self): if config.get(prefs.ENABLE_SUBTITLES): default_track = self.get_enabled_subtitle_track() if default_track is None: tracks = self.get_subtitle_tracks() if len(tracks) > 0: self.enable_subtitle_track(tracks[0]) else: self.disable_subtitles() |
tracks = range(self.playbin.get_property("n-text")) tracks = [(i, self._get_subtitle_track_name(i)) for i in tracks] | if self.playbin: tracks = range(self.playbin.get_property("n-text")) tracks = [(i, self._get_subtitle_track_name(i)) for i in tracks] else: tracks = [] | def get_subtitle_tracks(self): """Returns a 2-tuple of (index, language) for available tracks. """ tracks = range(self.playbin.get_property("n-text")) tracks = [(i, self._get_subtitle_track_name(i)) for i in tracks] return tracks |
def select_subtitle_file(self, path): pass class AudioRenderer(Renderer): pass | def select_subtitle_file(self, iteminfo, sub_path): total_time = self.get_duration() def handle_ok(): app.playback_manager.emit('will-play', total_time) self.play() app.playback_manager.emit('did-start-playing') def handle_err(): app.playback_manager.stop() app.playback_manager.emit('will-pause') self.select_file(itemi... | def select_subtitle_file(self, path): pass |
self.model = VideoConversionsTableModel() | self.model = VideoConversionsTableModel('object') | def build_widget(self): image_path = resources.path("images/icon-conversions_large.png") icon = imagepool.get(image_path) titlebar = VideoConversionsTitleBar(_("Conversions"), icon) self.widget.pack_start(titlebar) |
vbox.pack_space(5) | vbox.pack_space(1) | def pack_right(self, layout): vbox = cellpack.VBox(spacing=3) |
elif self.data.expiration_date and self.data.is_playable: | elif (self.data.is_playable and self.data.item_viewed and self.data.resume_time > 0 and config.get(prefs.RESUME_VIDEOS_MODE)): | def pack_infobar(self, layout): if self.show_progress_bar: return cellpack.align_bottom(self.pack_download_status(layout)) |
text = displaytext.expiration_date(self.data.expiration_date) | text = _("Resume at %(resumetime)s", {"resumetime": "%d:%02d" % divmod(self.data.resume_time, 60)}) | def pack_infobar(self, layout): if self.show_progress_bar: return cellpack.align_bottom(self.pack_download_status(layout)) |
if value.type == gconf.VALUE_STRING: return value.get_string() if value.type == gconf.VALUE_INT: return value.get_int() if value.type == gconf.VALUE_BOOL: return value.get_bool() if value.type == gconf.VALUE_FLOAT: return value.get_float() | try: return _convert_gconf_value(value) except TypeError, e: logging.warn("type error while getting gconf value %s: %s", fullkey, str(e)) | def _get_gconf(fullkey, default=None): gconf_lock.acquire() try: value = client.get(fullkey) if value != None: if value.type == gconf.VALUE_STRING: return value.get_string() if value.type == gconf.VALUE_INT: return value.get_int() if value.type == gconf.VALUE_BOOL: return value.get_bool() if value.type == gconf.VALUE_F... |
if ((self.has_downloader() | if ((self.is_external() and self.has_downloader() | def _sync_title(self): if ((self.has_downloader() and self.downloader.get_type() == "bittorrent" and self.downloader.get_state() == "downloading")): filename = os.path.basename(self.downloader.get_filename()) if self.title != filename: self.set_title(filename_to_unicode(filename)) |
self.assertEquals(len(httpauth.password_list.passwords), 0) | start_count = len(httpauth.password_list.passwords) | def test_basic_two_domains_same_realm(self): # test that if two domains have the same realm, we don't allow 1 # password to overwrite the other #14613 header = 'Basic realm="Protected Space"' url = 'http://example.com/foo/test.html' url2 = 'http://example2.com/foo/test.html' self.assertEquals(len(httpauth.password_list... |
self.assertEquals(len(httpauth.password_list.passwords), 1) | self.assertEquals(len(httpauth.password_list.passwords), start_count+1) | def test_basic_two_domains_same_realm(self): # test that if two domains have the same realm, we don't allow 1 # password to overwrite the other #14613 header = 'Basic realm="Protected Space"' url = 'http://example.com/foo/test.html' url2 = 'http://example2.com/foo/test.html' self.assertEquals(len(httpauth.password_list... |
self.assertEquals(len(httpauth.password_list.passwords), 2) | self.assertEquals(len(httpauth.password_list.passwords), start_count+2) | def test_basic_two_domains_same_realm(self): # test that if two domains have the same realm, we don't allow 1 # password to overwrite the other #14613 header = 'Basic realm="Protected Space"' url = 'http://example.com/foo/test.html' url2 = 'http://example2.com/foo/test.html' self.assertEquals(len(httpauth.password_list... |
self.assertEquals(len(httpauth.password_list.passwords), 3) | self.assertEquals(len(httpauth.password_list.passwords), start_count+3) | def test_basic_two_domains_same_realm(self): # test that if two domains have the same realm, we don't allow 1 # password to overwrite the other #14613 header = 'Basic realm="Protected Space"' url = 'http://example.com/foo/test.html' url2 = 'http://example2.com/foo/test.html' self.assertEquals(len(httpauth.password_list... |
self.assertEquals(len(httpauth.password_list.passwords), 4) | self.assertEquals(len(httpauth.password_list.passwords), start_count+4) | def test_basic_two_domains_same_realm(self): # test that if two domains have the same realm, we don't allow 1 # password to overwrite the other #14613 header = 'Basic realm="Protected Space"' url = 'http://example.com/foo/test.html' url2 = 'http://example2.com/foo/test.html' self.assertEquals(len(httpauth.password_list... |
if self.current_auth_type is not None: | if self.current_auth_type is None: | def build_stats(self): stats = TransferStats() getinfo = self.handle.getinfo # for easy typing |
for item in duplicate.itemList: | for item in duplicate.item_list: | def action(self): original_id, duplicate_id = self.args[0], self.args[1] from miro import downloader duplicate = downloader.get_downloader_by_dlid(duplicate_id) original = downloader.get_downloader_by_dlid(original_id) if duplicate is None: logging.warn("duplicate torrent doesn't exist anymore, " "ignoring (dlid %s)", ... |
'/home/specialdude/\u1234'.encode("utf-8"), True) | FilenameType('/home/specialdude/\u1234'.encode("utf-8")), True) | def setup_new(self): PCFProgramer.setup_new(self, u'I.M. Special', 44, 2.1, [], '/home/specialdude/\u1234'.encode("utf-8"), True) |
'/home/ben/\u1234'.encode("utf-8"), True) | FilenameType('/home/ben/\u1234'.encode("utf-8")), True) | def setUp(self): StoreDatabaseTest.setUp(self) self.lee = Human(u"lee", 25, 1.4, [], {u'virtual bowling': 212}) self.joe = RestorableHuman(u"joe", 14, 1.4, [self.lee], car=u'toyota', dog=u'scruffy') self.ben = PCFProgramer(u'ben', 25, 3.4, [self.joe], '/home/ben/\u1234'.encode("utf-8"), True) self.db = [self.lee, self.... |
str(error)) | error.encode('ascii', 'replace')) | def _updateErrback(self, error): if not self.ufeed.id_exists(): return logging.info("WARNING: error in Feed.update for %s -- %s", self.ufeed, str(error)) self.scheduleUpdateEvents(-1) self.updating = False self.ufeed.signal_change(needs_save=False) |
self.ufeed, url, str(error)) | self.ufeed, url, error.encode('ascii', 'replace')) | def _updateErrback(self, error, url): if not self.ufeed.id_exists(): return logging.warn("WARNING: error in Feed.update for %s (%s) -- %s", self.ufeed, url, str(error)) self.scheduleUpdateEvents(-1) self.updating -= 1 self.checkUpdateFinished() self.ufeed.signal_change(needs_save=False) |
if isinstance(obj, widgetset.VideoPlayer): | if isinstance(self.player, widgetset.VideoPlayer): | def _on_ready_to_play(self, obj): self.open_successful = True self.schedule_mark_as_watched(self.playlist[self.position].id) if isinstance(obj, widgetset.VideoPlayer): self.player.select_subtitle_encoding(self.initial_subtitle_encoding) self.play() |
return os.path.join(bundle.getBundleResourcePath(), u'resources') | path = str(bytearray(os.path.join(bundle.getBundleResourcePath(), u'resources'), 'utf-8')) return path | def root(): return os.path.join(bundle.getBundleResourcePath(), u'resources') |
return os.path.join(bundle.getBundlePath(), "Contents", "Theme", theme, | path = os.path.join(bundle.getBundlePath(), "Contents", "Theme", theme, | def theme_path(theme, relative_path): return os.path.join(bundle.getBundlePath(), "Contents", "Theme", theme, relative_path) |
logging.debug("youtube download: trying %s", new_url) | logging.debug("youtube download: trying %s %s", fmt, new_url) | def _youtube_callback_step2(info, video_id, callback): try: body = info['body'] params = cgi.parse_qs(body) if params.get("status", [""])[0] == "fail": logging.info("youtube download failed because: %s", params.get("reason", ["unknown"])[0]) callback(None) return # fmt_url_map is a comma separated list of pipe separat... |
for source in glob(os.path.join(resources_dir, "locale", "*.mo")): lang = os.path.basename(source)[:-3] dest = os.path.join(locale_temp_dir, lang, "LC_MESSAGES", "miro.mo") try: os.makedirs(os.path.dirname(dest)) except WindowsError: pass shutil.copyfile(source, dest) | def copy_locale_files(): print "*** copying locale files ***" locale_files = [] for source in glob(os.path.join(resources_dir, "locale", "*.mo")): lang = os.path.basename(source)[:-3] dest = os.path.join(locale_temp_dir, lang, "LC_MESSAGES", "miro.mo") locale_files.append((source, dest)) dir_util.create_tree(os.path.... | def fill_template(templatepath, outpath, **vars): s = open(templatepath, 'rt').read() s = string.Template(s).safe_substitute(**vars) f = open(outpath, "wt") f.write(s) f.close() |
self.copy_file("Miro.ico", os.path.join(dist_dir, "%s.ico" % template_vars['shortAppName'])) | shortappname = template_vars["shortAppName"] self.copy_file("Miro.ico", os.path.join(dist_dir, "%s.ico" % shortappname)) | def copy_ico(self): dist_dir = self.get_finalized_command('py2exe').dist_dir self.copy_file("Miro.ico", os.path.join(dist_dir, "%s.ico" % template_vars['shortAppName'])) |
raise AssertionError('cannot specify install images with generic installer') | raise AssertionError("cannot specify install images with " "generic installer") | def finalize_options(self): if self.generic and (self.install_icon or self.install_icon): raise AssertionError('cannot specify install images with generic installer') if self.generic: self.install_icon = 'miro-installer-generic.ico' self.install_image = 'miro-install-generic.bmp' if self.install_icon is None: self.inst... |
nsisVars = {} for (ourName, nsisName) in [ ('appVersion', 'CONFIG_VERSION'), ('projectURL', 'CONFIG_PROJECT_URL'), ('shortAppName', 'CONFIG_SHORT_APP_NAME'), ('longAppName', 'CONFIG_LONG_APP_NAME'), ('publisher', 'CONFIG_PUBLISHER')]: nsisVars[nsisName] = template_vars[ourName] nsisVars['CONFIG_EXECUTABLE'] = "%s.exe"... | nsis_vars = {} for our_name, nsis_name in [('appVersion', 'CONFIG_VERSION'), ('projectURL', 'CONFIG_PROJECT_URL'), ('shortAppName', 'CONFIG_SHORT_APP_NAME'), ('longAppName', 'CONFIG_LONG_APP_NAME'), ('publisher', 'CONFIG_PUBLISHER')]: nsis_vars[nsis_name] = template_vars[our_name] nsis_vars['CONFIG_EXECUTABLE'] = "%s.... | def run(self): self.run_command('bdist_miro') self.dist_dir = self.get_finalized_command('py2exe').dist_dir |
nsisVars['CONFIG_MOVIE_DATA_EXECUTABLE'] = "%s_MovieData.exe" % \ | nsis_vars['CONFIG_MOVIE_DATA_EXECUTABLE'] = "%s_MovieData.exe" % \ | def run(self): self.run_command('bdist_miro') self.dist_dir = self.get_finalized_command('py2exe').dist_dir |
nsisVars['CONFIG_ICON'] = "%s.ico" % template_vars['shortAppName'] nsisVars['CONFIG_PROG_ID'] = template_vars['longAppName'].replace(" ", ".") + ".1" nsisVars['MIRO_INSTALL_ICON'] = self.install_icon nsisVars['MIRO_INSTALL_IMAGE'] = self.install_image nsisVars['CONFIG_BINARY_KIT'] = BINARY_KIT_ROOT | nsis_vars['CONFIG_ICON'] = "%s.ico" % template_vars['shortAppName'] nsis_vars['CONFIG_PROG_ID'] = template_vars['longAppName'].replace(" ", ".") + ".1" nsis_vars['MIRO_INSTALL_ICON'] = self.install_icon nsis_vars['MIRO_INSTALL_IMAGE'] = self.install_image nsis_vars['CONFIG_BINARY_KIT'] = BINARY_KIT_ROOT | def run(self): self.run_command('bdist_miro') self.dist_dir = self.get_finalized_command('py2exe').dist_dir |
nsisVars['GENERIC_INSTALLER'] = '1' | nsis_vars['GENERIC_INSTALLER'] = '1' | def run(self): self.run_command('bdist_miro') self.dist_dir = self.get_finalized_command('py2exe').dist_dir |
outputFile = "%s-%s-generic.exe" | output_file = "%s-%s-generic.exe" | def run(self): self.run_command('bdist_miro') self.dist_dir = self.get_finalized_command('py2exe').dist_dir |
outputFile = "%s-%s.exe" outputFile = outputFile % \ (template_vars['shortAppName'], template_vars['appVersion']) nsisVars['CONFIG_OUTPUT_FILE'] = outputFile nsisVars['CONFIG_TWOSTAGE'] = "No" nsisArgs = ["/D%s=%s" % (k, v) for (k, v) in nsisVars.iteritems()] nsisArgs.append(os.path.join(self.dist_dir, "Miro.nsi")) i... | output_file = "%s-%s.exe" output_file = (output_file % (template_vars['shortAppName'], template_vars['appVersion'])) nsis_vars['CONFIG_OUTPUT_FILE'] = output_file nsis_vars['CONFIG_TWOSTAGE'] = "No" nsis_args = ["/D%s=%s" % (k, v) for (k, v) in nsis_vars.iteritems()] nsis_args.append(os.path.join(self.dist_dir, "Miro.... | def run(self): self.run_command('bdist_miro') self.dist_dir = self.get_finalized_command('py2exe').dist_dir |
outputFile = '%s-%s-generic-twostage.exe' | output_file = '%s-%s-generic-twostage.exe' | def run(self): self.run_command('bdist_miro') self.dist_dir = self.get_finalized_command('py2exe').dist_dir |
outputFile = "%s-%s-twostage.exe" outputFile = outputFile % \ (template_vars['shortAppName'], template_vars['appVersion']) nsisVars['CONFIG_OUTPUT_FILE'] = outputFile nsisVars['CONFIG_TWOSTAGE'] = "Yes" nsisArgs = ["/D%s=%s" % (k, v) for (k, v) in nsisVars.iteritems()] nsisArgs.append(os.path.join(self.dist_dir, "Miro... | output_file = "%s-%s-twostage.exe" output_file = (output_file % (template_vars['shortAppName'], template_vars['appVersion'])) nsis_vars['CONFIG_OUTPUT_FILE'] = output_file nsis_vars['CONFIG_TWOSTAGE'] = "Yes" nsis_args = ["/D%s=%s" % (k, v) for (k, v) in nsis_vars.iteritems()] nsis_args.append(os.path.join(self.dist_d... | def run(self): self.run_command('bdist_miro') self.dist_dir = self.get_finalized_command('py2exe').dist_dir |
self.addFile(nsisVars['CONFIG_EXECUTABLE']) self.addFile(nsisVars['CONFIG_ICON']) self.addFile(nsisVars['CONFIG_MOVIE_DATA_EXECUTABLE']) self.addGlob("*.dll") self.addDirectory("defaults") self.addDirectory("resources") self.addDirectory("xulrunner") | self.add_file(nsis_vars['CONFIG_EXECUTABLE']) self.add_file(nsis_vars['CONFIG_ICON']) self.add_file(nsis_vars['CONFIG_MOVIE_DATA_EXECUTABLE']) self.add_glob("*.dll") self.add_directory("defaults") self.add_directory("resources") self.add_directory("xulrunner") | def run(self): self.run_command('bdist_miro') self.dist_dir = self.get_finalized_command('py2exe').dist_dir |
def addGlob(self, wildcard): | def add_glob(self, wildcard): | def addGlob(self, wildcard): wildcard = os.path.join(self.dist_dir, wildcard) length = len(self.dist_dir) for filename in iglob(wildcard): if filename[:length] == self.dist_dir: filename = filename[length:] while len(filename) > 0 and (filename[0] == '/' or filename[0] == '\\'): filename = filename[1:] print "Compressi... |
while len(filename) > 0 and (filename[0] == '/' or filename[0] == '\\'): | while (len(filename) > 0 and (filename[0] == '/' or filename[0] == '\\')): | def addGlob(self, wildcard): wildcard = os.path.join(self.dist_dir, wildcard) length = len(self.dist_dir) for filename in iglob(wildcard): if filename[:length] == self.dist_dir: filename = filename[length:] while len(filename) > 0 and (filename[0] == '/' or filename[0] == '\\'): filename = filename[1:] print "Compressi... |
def addFile(self, filename): | def add_file(self, filename): | def addFile(self, filename): length = len(self.dist_dir) if filename[:length] == self.dist_dir: filename = filename[length:] while len(filename) > 0 and (filename[0] == '/' or filename[0] == '\\'): filename = filename[1:] print "Compressing %s" % filename self.zipfile.write(os.path.join(self.dist_dir, filename), filena... |
while len(filename) > 0 and (filename[0] == '/' or filename[0] == '\\'): | while (len(filename) > 0 and (filename[0] == '/' or filename[0] == '\\')): | def addFile(self, filename): length = len(self.dist_dir) if filename[:length] == self.dist_dir: filename = filename[length:] while len(filename) > 0 and (filename[0] == '/' or filename[0] == '\\'): filename = filename[1:] print "Compressing %s" % filename self.zipfile.write(os.path.join(self.dist_dir, filename), filena... |
def addDirectory(self, dirname): | def add_directory(self, dirname): | def addDirectory(self, dirname): for root, dirs, files in os.walk(os.path.join(self.dist_dir, dirname)): for name in files: self.addFile(os.path.join(root, name)) |
self.addFile(os.path.join(root, name)) | self.add_file(os.path.join(root, name)) | def addDirectory(self, dirname): for root, dirs, files in os.walk(os.path.join(self.dist_dir, dirname)): for name in files: self.addFile(os.path.join(root, name)) |
}, ) | ) | def addDirectory(self, dirname): for root, dirs, files in os.walk(os.path.join(self.dist_dir, dirname)): for name in files: self.addFile(os.path.join(root, name)) |
Widget.remove_viewport(self) | self._hack_remove_viewport() | def remove_viewport(self): Widget.remove_viewport(self) self.view.setPolicyDelegate_(nil) self.view.setResourceLoadDelegate_(nil) self.view.setFrameLoadDelegate_(nil) self.view.setUIDelegate_(nil) |
def _hack_remove_viewport(self): if self.viewport is not None: offscreen_rect = NSRect((-5000, -5000), self.view.frame().size) self.viewport.reposition(offscreen_rect) | def remove_viewport(self): Widget.remove_viewport(self) self.view.setPolicyDelegate_(nil) self.view.setResourceLoadDelegate_(nil) self.view.setFrameLoadDelegate_(nil) self.view.setUIDelegate_(nil) | |
if gtcache.codeset is None: | global LOCALE_HAS_UNIT_CONVERSIONS if gtcache.codeset is None or not LOCALE_HAS_UNIT_CONVERSIONS: | def strftime_to_unicode(nbytes): """Convert the value return by strftime() to a unicode string. By default, it's in whatever the default codeset is. """ if gtcache.codeset is None: return nbytes else: return nbytes.decode(gtcache.codeset) |
return nbytes.decode(gtcache.codeset) | try: return nbytes.decode(gtcache.codeset) except LookupError: LOCALE_HAS_UNIT_CONVERSIONS = False return nbytes | def strftime_to_unicode(nbytes): """Convert the value return by strftime() to a unicode string. By default, it's in whatever the default codeset is. """ if gtcache.codeset is None: return nbytes else: return nbytes.decode(gtcache.codeset) |
def start(self, resume=False): | def start(self, resume=True): | def start(self, resume=False): """Continues a paused or stopped download thread. """ if self.state in ('paused', 'stopped', 'offline'): self.state = "downloading" self.start_download(resume=resume) |
def start(self, resume=False): | def start(self, resume=True): | def start(self, resume=False): # for BT downloads, resume doesn't mean anything, so we # ignore it. if self.state not in ('paused', 'stopped', 'offline'): return |
'participatoryculture.org': {'/democracytest/normalpage.txt': 'I AM A NORMAL PAGE\n', '/democracytest/normalpage2.txt': 'I AM A NORMAL PAGE\n', '/democracytest/normalpage3.txt': 'I AM A NORMAL PAGE\n', '/democracytest/nohead.php': "DYNAMIC CONTENT", '/democracytest/cookie.php': "DYNAMIC CONTENT" | 'pculture.org': {'/normalpage.txt': 'I AM A NORMAL PAGE\n', '/normalpage2.txt': 'I AM A NORMAL PAGE\n', '/normalpage3.txt': 'I AM A NORMAL PAGE\n', '/nohead.php': 'DYNAMIC CONTENT', '/cookie.php': 'normal page', '/etag.txt': 'normal page', '/BasicAuthentication/': 'normal page', '/DigestAuthentication/': 'normal page',... | def __init__(self, closeCallback=None): self.open = False self.paused = False self.readCallback = None self.closeCallback = closeCallback self.timedOut = False self.connectionErrback = None self.name = "" self.output = '' self.unprocessed = '' self.input = '' self.pendingOutput = '' self.timedOut = False self.pages = {... |
'jigsaw.w3.org': {'/HTTP/Basic/': "normal page", '/HTTP/Digest/': "normal page" }, | 'www.foo.com': {'/': "Normal", '/2': "Blah"}, | def __init__(self, closeCallback=None): self.open = False self.paused = False self.readCallback = None self.closeCallback = closeCallback self.timedOut = False self.connectionErrback = None self.name = "" self.output = '' self.unprocessed = '' self.input = '' self.pendingOutput = '' self.timedOut = False self.pages = {... |
{'/': "Normal", '/2': "Blah" }, 'www.gibill.va.gov': {'/wave/': "Normal" }, | {'/': "Normal", '/2': "Blah"}, | def __init__(self, closeCallback=None): self.open = False self.paused = False self.readCallback = None self.closeCallback = closeCallback self.timedOut = False self.connectionErrback = None self.name = "" self.output = '' self.unprocessed = '' self.input = '' self.pendingOutput = '' self.timedOut = False self.pages = {... |
self.cookie_pages = { 'participatoryculture.org': ['/democracytest/cookie.php'] } self.no_head_pages = { 'participatoryculture.org': [ '/democracytest/nohead.php'] } self.basic_auth_pages = { 'jigsaw.w3.org': {'/HTTP/Basic/': 'Basic Z3Vlc3Q6Z3Vlc3Q='} } self.digest_auth_pages = { 'jigsaw.w3.org': {'/HTTP/Digest/': 'STU... | def __init__(self, closeCallback=None): self.open = False self.paused = False self.readCallback = None self.closeCallback = closeCallback self.timedOut = False self.connectionErrback = None self.name = "" self.output = '' self.unprocessed = '' self.input = '' self.pendingOutput = '' self.timedOut = False self.pages = {... | |
basic_host = self.basic_auth_pages.get(headers["Host"], {}) digest_host = self.digest_auth_pages.get(headers["Host"], {}) cookie_host = self.cookie_pages.get(headers["Host"], {}) if ((uri in basic_host.keys() and (not headers.has_key('Authorization') or basic_host[uri] != headers['Authorization']))): | if ((uri == '/BasicAuthentication/' and (not headers.has_key('Authorization') or headers['Authorization'] != 'Basic Z3Vlc3Q6Z3Vlc3Q='))): | def _generateResponse(self, method, uri, version, headers): text = None now = email.Utils.formatdate(usegmt=True) if not self.pages.has_key(headers["Host"]): self.errback(httpclient.ConnectionError("Can't connect")) return None |
elif ((uri in digest_host.keys() | elif ((uri == '/DigestAuthentication/' | def _generateResponse(self, method, uri, version, headers): text = None now = email.Utils.formatdate(usegmt=True) if not self.pages.has_key(headers["Host"]): self.errback(httpclient.ConnectionError("Can't connect")) return None |
or (digest_host[uri] != headers['Authorization'])))): | or (headers['Authorization'] != 'FOO')))): | def _generateResponse(self, method, uri, version, headers): text = None now = email.Utils.formatdate(usegmt=True) if not self.pages.has_key(headers["Host"]): self.errback(httpclient.ConnectionError("Can't connect")) return None |
"WWW-Authenticate: Digest realm=\"test\",domain=\"/HTTP/Digest\",nonce=\"13dc6f6b70fec989c0d5bd5956818b33\"", | "WWW-Authenticate: Digest realm=\"test\",domain=\"/DigestAuthentication\",nonce=\"13dc6f6b70fec989c0d5bd5956818b33\"", | def _generateResponse(self, method, uri, version, headers): text = None now = email.Utils.formatdate(usegmt=True) if not self.pages.has_key(headers["Host"]): self.errback(httpclient.ConnectionError("Can't connect")) return None |
elif uri in cookie_host: text = "STUFF" | elif uri == '/etag.txt': etag = "\"1262547188.66\"" if headers.get("If-None-Match") == etag: return "\r\n".join([ "HTTP/1.1 304 Not Modified", "ETag: %s" % etag, "", ""]) else: return "\r\n".join([ "HTTP/1.1 200 OK", "ETag: %s" % etag, "Last-Modified: Sun, 03 Jan 2010 19:33:08 GMT", "Content-Length: %d" % len(text), "C... | def _generateResponse(self, method, uri, version, headers): text = None now = email.Utils.formatdate(usegmt=True) if not self.pages.has_key(headers["Host"]): self.errback(httpclient.ConnectionError("Can't connect")) return None |
"Set-Cookie: MiroTestCookie=foobar; path=/democracytest/; domain=participatoryculture.org", | "Set-Cookie: MiroTestCookie=foobar; path=/; domain=pculture.org", | def _generateResponse(self, method, uri, version, headers): text = None now = email.Utils.formatdate(usegmt=True) if not self.pages.has_key(headers["Host"]): self.errback(httpclient.ConnectionError("Can't connect")) return None |
if ((self.no_head_pages.has_key(headers["Host"]) and (uri in self.no_head_pages[headers["Host"]]))): | if uri == '/nohead.php': | def _generateResponse(self, method, uri, version, headers): text = None now = email.Utils.formatdate(usegmt=True) if not self.pages.has_key(headers["Host"]): self.errback(httpclient.ConnectionError("Can't connect")) return None |
def testCloseDurringAcceptConnection(self): | def test_close_during_accept_connection(self): | def testCloseDurringAcceptConnection(self): """ Test opening a connection, then closing the HTTPConnection before it happens. The openConnection callback shouldn't be called. Open a socket on localhost and try to connect to that, this should be pretty much instantaneous, so we don't need a long timeout to runEventLoo... |
url = 'http://participatoryculture.org/democracytest/normalpage.txt' httpclient.grabURL(url, self.callback, self.errback, | url = 'http://pculture.org/normalpage.txt' httpclient.grabURL(url, self.callback, self.errback, | def test_real_request(self): url = 'http://participatoryculture.org/democracytest/normalpage.txt' httpclient.grabURL(url, self.callback, self.errback, clientClass=TestHTTPClient) self.runEventLoop(timeout=10) self.assert_(self.callbackCalled) self.assertEquals(self.data['body'], "I AM A NORMAL PAGE\n") |
url = 'http://participatoryculture.org/democracytest/normalpage.txt' httpclient.grabHeaders(url, self.callback, self.errback, | url = 'http://pculture.org/normalpage.txt' httpclient.grabHeaders(url, self.callback, self.errback, | def test_grab_headers(self): url = 'http://participatoryculture.org/democracytest/normalpage.txt' httpclient.grabHeaders(url, self.callback, self.errback, TestingHeaderGrabber) self.runEventLoop(timeout=10) self.assert_(self.callbackCalled) self.assertEquals(self.data['body'], "") self.assertEquals(self.data['status'],... |
url = 'http://participatoryculture.org/democracytest/nohead.php' | url = 'http://pculture.org/nohead.php' | def test_grab_headers2(self): url = 'http://participatoryculture.org/democracytest/nohead.php' httpclient.grabHeaders(url, self.callback, self.errback, clientClass = TestingHeaderGrabber) self.runEventLoop(timeout=10) self.assert_(self.callbackCalled) self.assertEquals(self.data['body'], "") self.assertEquals(self.data... |
url = 'http://participatoryculture.org/democracytest/normalpage.txt' | url = 'http://pculture.org/normalpage.txt' | def test_grab_headers_cancel(self): url = 'http://participatoryculture.org/democracytest/normalpage.txt' client = httpclient.grabHeaders(url, self.callback, self.errback, clientClass = TestingHeaderGrabber) client.cancel() |
req.sendRequest(self.callback, self.errback, "participatoryculture.org", 80, method='GET', path='/democracytest/normalpage.txt') | req.sendRequest(self.callback, self.errback, "pculture.org", 80, method='GET', path='/normalpage.txt') | def middleCallback(data): self.firstData = data req.sendRequest(self.callback, self.errback, "participatoryculture.org", 80, method='GET', path='/democracytest/normalpage.txt') |
self.addIdle(lambda: req.openConnection('participatoryculture.org', 80, stopEventLoop, self.errback), | self.addIdle(lambda: req.openConnection('pculture.org', 80, stopEventLoop, self.errback), | def stopEventLoop(conn): self.stopEventLoop(False) |
"participatoryculture.org", | "pculture.org", | def stopEventLoop(conn): self.stopEventLoop(False) |
path='/democracytest/normalpage.txt'), | path='/normalpage.txt'), | def stopEventLoop(conn): self.stopEventLoop(False) |
url = "http://participatoryculture.org/404" | url = "http://pculture.org/404" | def onBodyData(data): self.onBodyDataCalled = True |
url = 'http://participatoryculture.org/democracytest/normalpage.txt' | url = 'http://pculture.org/normalpage.txt' | def headerCallback(response): self.headerResponse = copy(response) self.callbackCalledInHeaderCallback = self.callbackCalled self.errbackCalledInHeaderCallback = self.errbackCalled self.stopEventLoop(False) |
url = 'http://participatoryculture.org/democracytest/normalpage.txt' | url = 'http://pculture.org/normalpage.txt' | def headerCallback(response): reqId.cancel() self.stopEventLoop(False) |
url = 'http://participatoryculture.org/democracytest/normalpage.txt' | url = 'http://pculture.org/normalpage.txt' | def bodyDataCallback(response): reqId.cancel() self.stopEventLoop(False) |
url = 'http://participatoryculture.org/democracytest/normalpage.txt' | url = 'http://pculture.org/normalpage.txt' | def test_body_data_callback_real_request(self): url = 'http://participatoryculture.org/democracytest/normalpage.txt' self.gotData = '' def bodyDataCallback(data): self.gotData += data if self.gotData == 'I AM A NORMAL PAGE\n': self.stopEventLoop(False) |
url = 'http://jigsaw.w3.org/HTTP/Basic/' | url = 'http://pculture.org/BasicAuthentication/' | def test_auth(self): self.addLogin(u'ben', u'baddpassword') self.addLogin(u'guest', u'guest') url = 'http://jigsaw.w3.org/HTTP/Basic/' client = TestHTTPClient(url, self.callback, self.errback) client.startRequest() self.runEventLoop() self.assert_(self.callbackCalled) self.assertEquals(self.data['status'], 200) self.as... |
url = 'http://jigsaw.w3.org/HTTP/Basic/' | url = 'http://pculture.org/BasicAuthentication/' | def test_bad_auth(self): self.addLogin(u'baduser', u'baddpass') self.addLogin(u'anotherbadtry', u'god') self.addLogin(u'billgates', u'password') url = 'http://jigsaw.w3.org/HTTP/Basic/' client = TestHTTPClient(url, self.callback, self.errback) client.startRequest() self.runEventLoop() self.assert_(self.errbackCalled) s... |
url = 'http://jigsaw.w3.org/HTTP/Digest/' | url = 'http://pculture.org/DigestAuthentication/' | def test_digest_auth(self): # we don't support digest authorization yet, make sure we get the # right errback at least url = 'http://jigsaw.w3.org/HTTP/Digest/' client = TestHTTPClient(url, self.callback, self.errback) client.startRequest() self.runEventLoop() self.assert_(self.errbackCalled) self.assert_(isinstance(se... |
url = "http://participatoryculture.org/democracytest/cookie.php" httpclient.grabURL(url, self.callback, self.errback, | url = "http://pculture.org/cookie.php" httpclient.grabURL(url, self.callback, self.errback, | def test_cookie(self): url = "http://participatoryculture.org/democracytest/cookie.php" httpclient.grabURL(url, self.callback, self.errback, clientClass=TestHTTPClient) self.runEventLoop(timeout=5) # self.data is a 404 self.assertEquals(len(self.data['cookies']), 1) self.assert_(self.data['cookies'].has_key('MiroTestCo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.