bugged stringlengths 4 228k | fixed stringlengths 0 96.3M | __index_level_0__ int64 0 481k |
|---|---|---|
def Load(self,url,streaminfo = None): if DEBUG: print >>sys.stderr,"embedplay: Load:",url,streaminfo,currentThread().getName() | def Load(self,url,streaminfo = None): if DEBUG: print >>sys.stderr,"embedplay: Load:",url,streaminfo,currentThread().getName() | 444,800 |
def __init__(self, swarm, raw_server, address): self._swarm = swarm self._closed = False self._in_buffer = StringIO() self._next_len = 1 self._next_func = self.read_header_len self._address = address self._last_activity = time() | def __init__(self, swarm, raw_server, address): self._swarm = swarm self._closed = False self._in_buffer = StringIO() self._next_len = 1 self._next_func = self.read_header_len self._address = address self._last_activity = time() | 444,801 |
def _request_some_metadata_piece(self): if not self._closed: piece = self._swarm.reserve_metadata_piece() if isinstance(piece, int): if DEBUG: print >> sys.stderr, self._address, "MiniBitTorrent.got_extend_message() Requesting metadata piece", piece self._metadata_requests.append(piece) self.write_extend_message(self._... | def _request_some_metadata_piece(self): if not self._closed: piece, length = self._swarm.reserve_metadata_piece() if isinstance(piece, (int, long)): if DEBUG: print >> sys.stderr, self._address, "MiniBitTorrent.got_extend_message() Requesting metadata piece", piece self._metadata_requests.append(piece) self.write_exten... | 444,802 |
def _request_some_metadata_piece(self): if not self._closed: piece = self._swarm.reserve_metadata_piece() if isinstance(piece, int): if DEBUG: print >> sys.stderr, self._address, "MiniBitTorrent.got_extend_message() Requesting metadata piece", piece self._metadata_requests.append(piece) self.write_extend_message(self._... | def _request_some_metadata_piece(self): if not self._closed: piece = self._swarm.reserve_metadata_piece() if isinstance(piece, int): if DEBUG: print >> sys.stderr, self._address, "MiniBitTorrent.got_extend_message() Requesting metadata piece", piece self._metadata_requests[piece] = length self.write_extend_message(self... | 444,803 |
def got_extend_message(self, data): try: message = bdecode(data[2:], sloppy=True) if DEBUG: print >> sys.stderr, self._address, "MiniBitTorrent.got_extend_message()", len(message), "bytes as payload" # if DEBUG: print >> sys.stderr, message except: if DEBUG: print >> sys.stderr, self._address, "MiniBitTorrent.got_exten... | def got_extend_message(self, data): try: message = bdecode(data[2:], sloppy=True) if DEBUG: print >> sys.stderr, self._address, "MiniBitTorrent.got_extend_message()", len(message), "bytes as payload" # if DEBUG: print >> sys.stderr, message except: if DEBUG: print >> sys.stderr, self._address, "MiniBitTorrent.got_exten... | 444,804 |
def got_extend_message(self, data): try: message = bdecode(data[2:], sloppy=True) if DEBUG: print >> sys.stderr, self._address, "MiniBitTorrent.got_extend_message()", len(message), "bytes as payload" # if DEBUG: print >> sys.stderr, message except: if DEBUG: print >> sys.stderr, self._address, "MiniBitTorrent.got_exten... | def got_extend_message(self, data): try: message = bdecode(data[2:], sloppy=True) if DEBUG: print >> sys.stderr, self._address, "MiniBitTorrent.got_extend_message()", len(message), "bytes as payload" # if DEBUG: print >> sys.stderr, message except: if DEBUG: print >> sys.stderr, self._address, "MiniBitTorrent.got_exten... | 444,805 |
def got_extend_message(self, data): try: message = bdecode(data[2:], sloppy=True) if DEBUG: print >> sys.stderr, self._address, "MiniBitTorrent.got_extend_message()", len(message), "bytes as payload" # if DEBUG: print >> sys.stderr, message except: if DEBUG: print >> sys.stderr, self._address, "MiniBitTorrent.got_exten... | def got_extend_message(self, data): try: message = bdecode(data[2:], sloppy=True) if DEBUG: print >> sys.stderr, self._address, "MiniBitTorrent.got_extend_message()", len(message), "bytes as payload" # if DEBUG: print >> sys.stderr, message except: if DEBUG: print >> sys.stderr, self._address, "MiniBitTorrent.got_exten... | 444,806 |
def reserve_metadata_piece(self): """ A metadata piece request can be made. Find the most usefull piece to request. """ for block_tuple in self._metadata_blocks: if block_tuple[2] is None: block_tuple[0] += 1 self._metadata_blocks.sort() return block_tuple[1] return None | def reserve_metadata_piece(self): """ A metadata piece request can be made. Find the most usefull piece to request. """ for block_tuple in self._metadata_blocks: if block_tuple[2] is None: block_tuple[0] += 1 self._metadata_blocks.sort() return block_tuple[1] return None | 444,807 |
# def p(s): | # def p(s): | 444,808 |
# def p(s): | # def p(s): | 444,809 |
def RefreshData(self, data): if isinstance(data[2], dict): #update original_data for key in data[2].keys(): self.original_data[key] = data[2][key] else: self.original_data = data[2] control_index = 0 new_controls = False has_changed = False for i in xrange(len(self.columns)): type = self.columns[i].get('type','label... | def RefreshData(self, data): if isinstance(data[2], dict): #update original_data for key in data[2].keys(): self.original_data[key] = data[2][key] else: self.original_data = data[2] control_index = 0 new_controls = False has_changed = False for i in xrange(len(self.columns)): type = self.columns[i].get('type','label... | 444,810 |
def CreateItems(self, nr_items_to_create = LIST_ITEM_BATCH_SIZE, nr_items_to_add = LIST_ITEM_MAX_SIZE): if DEBUG: print >> sys.stderr, "ListBody: Creating items" done = True t1 = time.time() | def CreateItems(self, nr_items_to_create = LIST_ITEM_BATCH_SIZE, nr_items_to_add = LIST_ITEM_MAX_SIZE): if DEBUG: print >> sys.stderr, "ListBody: Creating items" done = True t1 = time.time() | 444,811 |
def handleBuddyCastMessage(self, sender_permid, buddycast_data, selversion): """ Handle received buddycast message Add peers, torrents and preferences into database and update last seen Add fresh peers to candidate list All database updates caused by buddycast msg should be handled here """ _now = now() cache_db_data... | def handleBuddyCastMessage(self, sender_permid, buddycast_data, selversion): """ Handle received buddycast message Add peers, torrents and preferences into database and update last seen Add fresh peers to candidate list All database updates caused by buddycast msg should be handled here """ _now = now() cache_db_data... | 444,812 |
def handleBuddyCastMessage(self, sender_permid, buddycast_data, selversion): """ Handle received buddycast message Add peers, torrents and preferences into database and update last seen Add fresh peers to candidate list All database updates caused by buddycast msg should be handled here """ _now = now() cache_db_data... | def handleBuddyCastMessage(self, sender_permid, buddycast_data, selversion): """ Handle received buddycast message Add peers, torrents and preferences into database and update last seen Add fresh peers to candidate list All database updates caused by buddycast msg should be handled here """ _now = now() cache_db_data... | 444,813 |
def __init__(self,httpport=6880): if VideoPlayer.__single: raise RuntimeError, "VideoPlayer is singleton" VideoPlayer.__single = self self.videoframe = None self.extprogress = None self.vod_download = None self.playbackmode = None self.preferredplaybackmode = None self.other_downloads = None self.closeextplayercallback... | def __init__(self,httpport=6880): if VideoPlayer.__single: raise RuntimeError, "VideoPlayer is singleton" VideoPlayer.__single = self self.videoframe = None self.extprogress = None self.vod_download = None self.playbackmode = None self.preferredplaybackmode = None self.other_downloads = None self.closeextplayercallback... | 444,814 |
def __init__(self, parent, colours = ["#ffffff","#92cddf","#006dc0"], *args, **kwargs ): ## "#ffffff","#CBCBCB","#ff3300" self.colours = colours self.pens = [wx.Pen(c,0) for c in self.colours] self.brushes = [wx.Brush(c) for c in self.colours] self.reset() style = wx.SIMPLE_BORDER wx.Control.__init__(self, parent, -... | def__init__(self,parent,colours=["#ffffff","#92cddf","#006dc0"],*args,**kwargs):##"#ffffff","#CBCBCB","#ff3300"self.colours=coloursself.pens=[wx.Pen(c,0)forcinself.colours]self.brushes=[wx.Brush(c)forcinself.colours]self.reset()style=wx.SIMPLE_BORDERwx.Control.__init__(self,parent,-1,style=style)self.SetMaxSize((-1,6))... | 444,815 |
def OnPaint(self, evt): # define condition x,y,maxw,maxh = self.GetClientRect() #dc.DrawRectangle(x,y,) numrect = float(len(self.blocks)) | def OnPaint(self, evt):# define condition x,y,maxw,maxh = self.GetClientRect() #dc.DrawRectangle(x,y,)numrect = float(len(self.blocks)) | 444,816 |
def OnPaint(self, evt): # define condition x,y,maxw,maxh = self.GetClientRect() #dc.DrawRectangle(x,y,) numrect = float(len(self.blocks)) | defbuffer = wx.EmptyBitmap(maxw, maxh) OnPaint(self,buffer = wx.EmptyBitmap(maxw, maxh) evt):buffer = wx.EmptyBitmap(maxw, maxh) buffer = wx.EmptyBitmap(maxw, maxh) #buffer = wx.EmptyBitmap(maxw, maxh) definebuffer = wx.EmptyBitmap(maxw, maxh) conditionbuffer = wx.EmptyBitmap(maxw, maxh) x,y,maxw,maxhbuffer = wx.EmptyB... | 444,817 |
def OnPaint(self, evt): # define condition x,y,maxw,maxh = self.GetClientRect() #dc.DrawRectangle(x,y,) numrect = float(len(self.blocks)) | def OnPaint(self, evt):# define condition x,y,maxw,maxh = self.GetClientRect() #dc.DrawRectangle(x,y,)numrect = float(len(self.blocks)) | 444,818 |
def OnPaint(self, evt): # define condition x,y,maxw,maxh = self.GetClientRect() #dc.DrawRectangle(x,y,) numrect = float(len(self.blocks)) | def OnPaint(self, evt): # define condition x,y,maxw,maxh = self.GetClientRect() #dc.DrawRectangle(x,y,) numrect = float(len(self.blocks)) | 444,819 |
def OnPaint(self, evt): # define condition x,y,maxw,maxh = self.GetClientRect() #dc.DrawRectangle(x,y,) numrect = float(len(self.blocks)) | def OnPaint(self, evt): # define condition x,y,maxw,maxh = self.GetClientRect() #dc.DrawRectangle(x,y,) numrect = float(len(self.blocks)) | 444,820 |
def OnPaint(self, evt): # define condition x,y,maxw,maxh = self.GetClientRect() #dc.DrawRectangle(x,y,) numrect = float(len(self.blocks)) | defOnPaint(self,evt):#defineconditionx,y,maxw,maxh=self.GetClientRect()#dc.DrawRectangle(x,y,)numrect=float(len(self.blocks)) | 444,821 |
def OnPaint(self, evt): # define condition x,y,maxw,maxh = self.GetClientRect() #dc.DrawRectangle(x,y,) numrect = float(len(self.blocks)) | def OnPaint(self, evt): # define condition x,y,maxw,maxh = self.GetClientRect() #dc.DrawRectangle(x,y,) numrect = float(len(self.blocks)) | 444,822 |
def refresh(self): """Returns a generator for a list of (title,urllib2openedurl_to_torrent) pairs for this feed. TorrentFeedReader instances keep a list of torrent urls in memory and will yield a torrent only once. If the feed points to a torrent url with webserver problems, that url will not be retried. urllib2openedu... | def refresh(self): """Returns a generator for a list of (title,urllib2openedurl_to_torrent) pairs for this feed. TorrentFeedReader instances keep a list of torrent urls in memory and will yield a torrent only once. If the feed points to a torrent url with webserver problems, that url will not be retried. urllib2openedu... | 444,823 |
def refresh(self): """Returns a generator for a list of (title,urllib2openedurl_to_torrent) pairs for this feed. TorrentFeedReader instances keep a list of torrent urls in memory and will yield a torrent only once. If the feed points to a torrent url with webserver problems, that url will not be retried. urllib2openedu... | def refresh(self): """Returns a generator for a list of (title,urllib2openedurl_to_torrent) pairs for this feed. TorrentFeedReader instances keep a list of torrent urls in memory and will yield a torrent only once. If the feed points to a torrent url with webserver problems, that url will not be retried. urllib2openedu... | 444,824 |
def getpid(): return 1 | def getpid(): return 1 | 444,825 |
def SetRatio(self, seeders, leechers): ratio = 0 pop = 0 self.blue = 0 if leechers <= 0 and seeders <= 0: self.barwidth = 0 self.green = 0 self.red = 0 else: if leechers == 0: ratio = sys.maxint elif seeders == 0: ratio = 0 else: ratio = seeders/(leechers*1.0) if ratio == 0: self.barwidth = 1 self.green = 0 self.red... | def SetRatio(self, seeders, leechers): ratio = 0 pop = 0 self.blue = 0 if leechers <= 0 and seeders <= 0: self.barwidth = 0 self.green = 0 self.red = 0 else: if leechers == 0: ratio = sys.maxint elif seeders == 0: ratio = 0 else: ratio = seeders/(leechers*1.0) if ratio == 0: self.barwidth = 1 self.green = 0 self.red... | 444,826 |
def extractBiTermPhrase(self, name_or_keywords): """ Extracts a bi-term phrase from a torrent name. Currently, this phrase consists of the first two terms extracted from it. @param name_or_keywords The name of the torrent. Alternatively, you may pass a list of keywords (i.e., the name split into words using split_into... | def extractBiTermPhrase(self, name_or_keywords): """ Extracts a bi-term phrase from a torrent name. Currently, this phrase consists of the first two terms extracted from it. @param name_or_keywords The name of the torrent. Alternatively, you may pass a list of keywords (i.e., the name split into words using split_into... | 444,827 |
def readfile(self): try: filename = self.getfilename() f = open(filename,"rb") for line in f.readlines(): for key in ['active', 'inactive']: if line.startswith(key): url = line[len(key)+1:-2] # remove \r\n if DEBUG: print >>sys.stderr,"subscrip: Add from file URL",url,"EOU" self.addURL(url,dowrite=False,status=key) f.c... | def readfile(self): try: filename = self.getfilename() f = open(filename,"rb") for line in f.readlines(): for key in ['active', 'inactive']: if line.startswith(key): url = line[len(key)+1:-2] # remove \r\n if DEBUG: print >>sys.stderr,"subscrip: Add from file URL",url,"EOU" self.addURL(url,dowrite=False,status=key) f.c... | 444,828 |
def do_poll(self, t): r = self.poll.poll(t*timemult) if r is None: connects = len(self.single_sockets) to_close = int(connects*0.05)+1 # close 5% of sockets self.max_connects = connects-to_close closelist = self.single_sockets.values() shuffle(closelist) closelist = closelist[:to_close] for sock in closelist: if DEBUG:... | def do_poll(self, t): r = self.poll.poll(t*timemult) if r is None: connects = len(self.single_sockets) to_close = int(connects*0.05)+1 # close 5% of sockets self.max_connects = connects-to_close closelist = [sock for sock in self.single_sockets.values() if not isinstance(sock, InterruptSocket)] shuffle(closelist) close... | 444,829 |
def OnRefreshTimer(self, event = None): self.refresh -= 1 if self.refresh <= 0: if self.IsShownOnScreen(): # needs fine-tuning: # (especially for cold-start/fresh Tribler install?) samplesize = NetworkBuzzDBHandler.DEFAULT_SAMPLE_SIZE # simple caching # (does not check for possible duplicates within display_size-windo... | def OnRefreshTimer(self, event = None): self.refresh -= 1 if self.refresh <= 0: if self.IsShownOnScreen(): # needs fine-tuning: # (especially for cold-start/fresh Tribler install?) samplesize = NetworkBuzzDBHandler.DEFAULT_SAMPLE_SIZE # simple caching # (does not check for possible duplicates within display_size-windo... | 444,830 |
def connection_timeout(self, connection): infohash, dns = c2infohash_dns(connection) if infohash != self.infohash: return if DEBUG: print >>sys.stderr, "RePEXer: connection_timeout: %s:%s" % dns | def connection_timeout(self, connection): infohash, dns = c2infohash_dns(connection) if infohash != self.infohash or dns is None: return if DEBUG: print >>sys.stderr, "RePEXer: connection_timeout: %s:%s" % dns | 444,831 |
def connection_closed(self, connection): self.active_sockets -= 1 if self.active_sockets < 0: self.active_sockets = 0 infohash, dns = c2infohash_dns(connection) c = None # Connecter.Connection if hasattr(connection, 'got_ut_pex'): c = connection connection = c.connection # Encrypter.Connection if infohash != self.infoh... | def connection_closed(self, connection): self.active_sockets -= 1 if self.active_sockets < 0: self.active_sockets = 0 infohash, dns = c2infohash_dns(connection) c = None # Connecter.Connection if hasattr(connection, 'got_ut_pex'): c = connection connection = c.connection # Encrypter.Connection if infohash != self.infoh... | 444,832 |
def connection_made(self, connection, ext_support): infohash, dns = c2infohash_dns(connection) if infohash != self.infohash: return if DEBUG: print >>sys.stderr, "RePEXer: connection_made: %s:%s ext_support = %s" % (dns + (ext_support,)) self.datacost['connections_made'] += 1 self.bt_connectable.add(dns) if ext_support... | def connection_made(self, connection, ext_support): infohash, dns = c2infohash_dns(connection) if infohash != self.infohash or dns is None: return if DEBUG: print >>sys.stderr, "RePEXer: connection_made: %s:%s ext_support = %s" % (dns + (ext_support,)) self.datacost['connections_made'] += 1 self.bt_connectable.add(dns)... | 444,833 |
def got_extend_handshake(self, connection, version=None): infohash, dns = c2infohash_dns(connection) ut_pex_support = connection.supports_extend_msg('ut_pex') if infohash != self.infohash: return if DEBUG: print >>sys.stderr, "RePEXer: got_extend_handshake: %s:%s version = %s ut_pex_support = %s" % (dns + (`version`,ut... | def got_extend_handshake(self, connection, version=None): infohash, dns = c2infohash_dns(connection) ut_pex_support = connection.supports_extend_msg('ut_pex') if infohash != self.infohash or dns is None: return if DEBUG: print >>sys.stderr, "RePEXer: got_extend_handshake: %s:%s version = %s ut_pex_support = %s" % (dns ... | 444,834 |
def got_ut_pex(self, connection, d): infohash, dns = c2infohash_dns(connection) is_tribler_peer = connection.is_tribler_peer() added = check_ut_pex_peerlist(d,'added')[:REPEX_PEX_MSG_MAX_PEERS] addedf = map(ord, d.get('addedf',[]))[:REPEX_PEX_MSG_MAX_PEERS] addedf.extend( [0]*(len(added)-len(addedf)) ) IS_SEED = 2 IS_S... | def got_ut_pex(self, connection, d): infohash, dns = c2infohash_dns(connection) is_tribler_peer = connection.is_tribler_peer() added = check_ut_pex_peerlist(d,'added')[:REPEX_PEX_MSG_MAX_PEERS] addedf = map(ord, d.get('addedf',[]))[:REPEX_PEX_MSG_MAX_PEERS] addedf.extend( [0]*(len(added)-len(addedf)) ) IS_SEED = 2 IS_S... | 444,835 |
def add_potential_peers(self, addresses): if not self._closed: for address in addresses: if not address in self._potential_peers: self._potential_peers[address] = 0 | def add_potential_peers(self, addresses): if not self._closed: for address in addresses: if not address in self._potential_peers: self._potential_peers[address] = 0 | 444,836 |
def _create_connections(self): now = time() | def _create_connections(self): now = time() | 444,837 |
def _create_connections(self): now = time() | def _create_connections(self): now = time() | 444,838 |
def _create_connections(self): now = time() | def _create_connections(self): now = time() | 444,839 |
def _create_connections(self): now = time() | def _create_connections(self): now = time() | 444,840 |
def _create_connections(self): now = time() | def _create_connections(self): now = time() | 444,841 |
def lookup(self,infohash): if DEBUG: print >>sys.stderr,"mainlineDHTChecker: Lookup",`infohash` | def lookup(self,infohash): if DEBUG: print >>sys.stderr,"mainlineDHTChecker: Lookup",`infohash` | 444,842 |
def load_recently_collected_torrents(self, num_recent, num_random): """ The self.recently_collected_torrents is used to inform other peers of existing torrent files. This list should also contain torrent files that have been collected in the past (not just this running session). | def load_recently_collected_torrents(self, num_recent, num_random): """ The self.recently_collected_torrents is used to inform other peers of existing torrent files. This list should also contain torrent files that have been collected in the past (not just this running session). | 444,843 |
def usercallback(infohash,metadata,filename): if tmp_hits.has_key(bin2str(infohash)): el_new = tmp_hits[bin2str(infohash)] self.channelcast_db.addTorrent(el_new) | def usercallback(infohash,metadata,filename): if tmp_hits.has_key(bin2str(infohash)): el_new = tmp_hits[bin2str(infohash)] self.channelcast_db.addTorrent(el_new) | 444,844 |
def calculateSwarmSize(self, torrentList, content, toBC=True): """ This method gets a list of torrent_ids and then calculat the size of the swarm for those torrents. @author: Rahim @param torrentList: A list of torrent_id. @param content: If it be 'infohash' , the content of the torrentList is infohsh of torrents. If i... | def calculateSwarmSize(self, torrentList, content, toBC=True): """ This method gets a list of torrent_ids and then calculat the size of the swarm for those torrents. @author: Rahim @param torrentList: A list of torrent_id. @param content: If it be 'infohash' , the content of the torrentList is infohsh of torrents. If i... | 444,845 |
def calculateSwarmSize(self, torrentList, content, toBC=True): """ This method gets a list of torrent_ids and then calculat the size of the swarm for those torrents. @author: Rahim @param torrentList: A list of torrent_id. @param content: If it be 'infohash' , the content of the torrentList is infohsh of torrents. If i... | def calculateSwarmSize(self, torrentList, content, toBC=True): """ This method gets a list of torrent_ids and then calculat the size of the swarm for those torrents. @author: Rahim @param torrentList: A list of torrent_id. @param content: If it be 'infohash' , the content of the torrentList is infohsh of torrents. If i... | 444,846 |
def __init__(self, rawserver, check_crawler, port = 0): # initialise connections now because it is used in shutdown which will # be called for Crawler instances as well self.connections = {} if check_crawler: from Tribler.Core.Statistics.Crawler import Crawler crawler = Crawler.get_instance() if crawler.am_crawler(): ... | def __init__(self, rawserver, check_crawler, port = 0): # initialise connections now because it is used in shutdown which will # be called for Crawler instances as well self.connections = {} if check_crawler: from Tribler.Core.Statistics.Crawler import Crawler crawler = Crawler.get_instance() if crawler.am_crawler(): ... | 444,847 |
def is_conn_eligible(self, conn): if conn.use_g2g: self.g2g_eligible = self.g2g_policy.apply(conn, self.download_state, self.storage) if DEBUG: print >>sys.stderr,"DenySeeding to g2g peer: ",self.download_state.get_download().get_dest_files() | def is_conn_eligible(self, conn): if conn.use_g2g: self.g2g_eligible = self.g2g_policy.apply(conn, self.download_state, self.storage) if DEBUG: print >>sys.stderr,"DenySeeding to g2g peer: ",self.download_state.get_download().get_dest_files() | 444,848 |
def is_conn_eligible(self, conn): if conn.use_g2g: self.g2g_eligible = self.g2g_policy.apply(conn, self.download_state, self.storage) if DEBUG: print >>sys.stderr,"DenySeeding to g2g peer: ",self.download_state.get_download().get_dest_files() | def is_conn_eligible(self, conn): if conn.use_g2g: self.g2g_eligible = self.g2g_policy.apply(conn, self.download_state, self.storage) if DEBUG: print >>sys.stderr,"DenySeeding to g2g peer: ",self.download_state.get_download().get_dest_files() | 444,849 |
def apply(self, _, download_state, storage): # No Bittorrent leeching (minimal ratio of 1.0) ul = storage["total_up"] + download_state.get_total_transferred(UPLOAD) dl = storage["total_down"] + download_state.get_total_transferred(DOWNLOAD) | def apply(self, _, download_state, storage): # No Bittorrent leeching (minimal ratio of 1.0) ul = storage["total_up"] + download_state.get_total_transferred(UPLOAD) dl = storage["total_down"] + download_state.get_total_transferred(DOWNLOAD) | 444,850 |
def apply(self, _, download_state, storage): # No Bittorrent leeching (minimal ratio of 1.0) ul = storage["total_up"] + download_state.get_total_transferred(UPLOAD) dl = storage["total_down"] + download_state.get_total_transferred(DOWNLOAD) | def apply(self, _, download_state, storage): # No Bittorrent leeching (minimal ratio of 1.0) ul = storage["total_up"] + download_state.get_total_transferred(UPLOAD) dl = storage["total_down"] + download_state.get_total_transferred(DOWNLOAD) | 444,851 |
def apply(self, conn, _, __): # Seeding to peers with large sharing ratio dl = conn.download.measure.get_total() ul = conn.upload.measure.get_total() | def apply(self, conn, _, __): # Seeding to peers with large sharing ratio dl = conn.download.measure.get_total() ul = conn.upload.measure.get_total() | 444,852 |
def apply(self, conn, _, __): # Seeding to peers with large sharing ratio dl = conn.download.measure.get_total() ul = conn.upload.measure.get_total() | def apply(self, conn, _, __): # Seeding to peers with large sharing ratio dl = conn.download.measure.get_total() ul = conn.upload.measure.get_total() | 444,853 |
def refresh(self): """Returns a generator for a list of (title,urllib2openedurl_to_torrent) pairs for this feed. TorrentFeedReader instances keep a list of torrent urls in memory and will yield a torrent only once. If the feed points to a torrent url with webserver problems, that url will not be retried. urllib2openedu... | def refresh(self): """Returns a generator for a list of (title,urllib2openedurl_to_torrent) pairs for this feed. TorrentFeedReader instances keep a list of torrent urls in memory and will yield a torrent only once. If the feed points to a torrent url with webserver problems, that url will not be retried. urllib2openedu... | 444,854 |
def potential_peers_from_dht(self, lookup_id, peers): self._swarm.add_potential_peers(peers) | def potential_peers_from_dht(self, lookup_id, peers): self._swarm.add_potential_peers(peers) | 444,855 |
def OnExpand(self, item): pass | def OnExpand(self, item): assert self.ready, "List not ready" | 444,856 |
def SetData(self, data): pass | def SetData(self, data): pass | 444,857 |
def RefreshData(self, key, data): pass | def RefreshData(self, key, data): assert self.ready, "List not ready" | 444,858 |
def InList(self, key): if self.ready: return self.list.InList(key) | def InList(self, key): assert self.ready, "List not ready" return self.list.InList(key) | 444,859 |
def GetItem(self, key): if self.ready: return self.list.GetItem(key) | def GetItem(self, key): assert self.ready, "List not ready" return self.list.GetItem(key) | 444,860 |
def Focus(self): if self.ready: self.list.SetFocus() | def Focus(self): assert self.ready, "List not ready" self.list.SetFocus() | 444,861 |
def HasFocus(self): if self.ready: focussed = wx.Window.FindFocus() return focussed == self.list | def HasFocus(self): assert self.ready, "List not ready" focussed = wx.Window.FindFocus() return focussed == self.list | 444,862 |
def ScrollToEnd(self, scroll_to_end): if self.ready: self.list.ScrollToEnd(scroll_to_end) | def ScrollToEnd(self, scroll_to_end): assert self.ready, "List not ready" self.list.ScrollToEnd(scroll_to_end) | 444,863 |
def load_recently_collected_torrents(self, num_recent, num_random): """ The self.recently_collected_torrents is used to inform other peers of existing torrent files. This list should also contain torrent files that have been collected in the past (not just this running session). | def load_recently_collected_torrents(self, num_recent, num_random): """ The self.recently_collected_torrents is used to inform other peers of existing torrent files. This list should also contain torrent files that have been collected in the past (not just this running session). | 444,864 |
def load_recently_collected_torrents(self, num_recent, num_random): """ The self.recently_collected_torrents is used to inform other peers of existing torrent files. This list should also contain torrent files that have been collected in the past (not just this running session). | def load_recently_collected_torrents(self, num_recent, num_random): """ The self.recently_collected_torrents is used to inform other peers of existing torrent files. This list should also contain torrent files that have been collected in the past (not just this running session). | 444,865 |
def add_task(self,task,t=0,id=None): """ t parameter is now usable, unlike before. If id is given, all the existing tasks with the same id will be removed before inserting this task """ if task is None: print_stack() self.cond.acquire() when = time()+t if DEBUG: print >>sys.stderr,"ttqueue: ADD EVENT",t,task if id !... | def add_task(self,task,t=0,id=None): """ t parameter is now usable, unlike before. If id is given, all the existing tasks with the same id will be removed before inserting this task """ if task is None: print_stack() self.cond.acquire() when = time()+t if DEBUG: print >>sys.stderr,"ttqueue: ADD EVENT",t,task if id !... | 444,866 |
def load_recently_collected_torrents(self, num_recent, num_random): """ The self.recently_collected_torrents is used to inform other peers of existing torrent files. This list should also contain torrent files that have been collected in the past (not just this running session). | def load_recently_collected_torrents(self, num_recent, num_random): """ The self.recently_collected_torrents is used to inform other peers of existing torrent files. This list should also contain torrent files that have been collected in the past (not just this running session). | 444,867 |
torrent_def = load(filename) | torrent_def = load(filename) | 444,868 |
torrent_def = load(filename) | torrent_def = load(filename) | 444,869 |
def torrent_exists(self, infohash): # if the torrent is already on disk, put it in db file_name = get_collected_torrent_filename(infohash) torrent_path = os.path.join(self.torrent_dir, file_name) if not os.path.exists(torrent_path): return None,None else: metadata = self.read_torrent(torrent_path) if not self.valid_me... | def torrent_exists(self, infohash): # if the torrent is already on disk, put it in db file_name = get_collected_torrent_filename(infohash) torrent_path = os.path.join(self.torrent_dir, file_name) if not os.path.exists(torrent_path): return None,None else: metadata = self.read_torrent(torrent_path) if not self.valid_me... | 444,870 |
def get_vlc_mediactrl(self): if not self.initialized: self._init_vlc() | def get_vlc_mediactrl(self): if not self.initialized: self._init_vlc() | 444,871 |
def __init__(self, dht_addr, logs_path): logging_conf.setup(logs_path, logging.DEBUG) self.controller = controller.Controller(dht_addr) self.controller.start() | def __init__(self, dht_addr, logs_path): logging_conf.setup(logs_path, logging.CRITICAL) self.controller = controller.Controller(dht_addr) self.controller.start() | 444,872 |
def saveAll(self, event): errors = [] valdown = self.elements['downloadCtrl'].GetValue().strip() if valdown != 'unlimited' and (not valdown.isdigit() or int(valdown) <= 0): errors.append('downloadCtrl') valup = self.elements['uploadCtrl'].GetValue().strip() if valup != 'unlimited' and (not valup.isdigit() or int(valu... | def saveAll(self, event): errors = [] valdown = self.elements['downloadCtrl'].GetValue().strip() if valdown != 'unlimited' and (not valdown.isdigit() or int(valdown) <= 0): errors.append('downloadCtrl') valup = self.elements['uploadCtrl'].GetValue().strip() if valup != 'unlimited' and (not valup.isdigit() or int(valu... | 444,873 |
def moveCollectedTorrents(self, old_dir, new_dir): #physical move old_dir = os.path.join(old_dir, 'collected_torrent_files') new_dir = os.path.join(new_dir, 'collected_torrent_files') os.renames(old_dir, new_dir) old_dir = os.path.join(old_dir, 'collected_subtitles_files') new_dir = os.path.join(new_dir, 'collected_su... | def moveCollectedTorrents(self, old_dir, new_dir): #physical move old_dir = os.path.join(old_dir, 'collected_torrent_files') new_dir = os.path.join(new_dir, 'collected_torrent_files') atexit.register(os.renames, old_dir, new_dir) old_dir = os.path.join(old_dir, 'collected_subtitles_files') new_dir = os.path.join(new_d... | 444,874 |
def moveCollectedTorrents(self, old_dir, new_dir): #physical move old_dir = os.path.join(old_dir, 'collected_torrent_files') new_dir = os.path.join(new_dir, 'collected_torrent_files') os.renames(old_dir, new_dir) old_dir = os.path.join(old_dir, 'collected_subtitles_files') new_dir = os.path.join(new_dir, 'collected_su... | def moveCollectedTorrents(self, old_dir, new_dir): #physical move old_dir = os.path.join(old_dir, 'collected_torrent_files') new_dir = os.path.join(new_dir, 'collected_torrent_files') atexit.register(os.renames, old_dir, new_dir) old_dir = os.path.join(old_dir, 'collected_subtitles_files') new_dir = os.path.join(new_d... | 444,875 |
def moveCollectedTorrents(self, old_dir, new_dir): #physical move old_dir = os.path.join(old_dir, 'collected_torrent_files') new_dir = os.path.join(new_dir, 'collected_torrent_files') os.renames(old_dir, new_dir) old_dir = os.path.join(old_dir, 'collected_subtitles_files') new_dir = os.path.join(new_dir, 'collected_su... | def moveCollectedTorrents(self, old_dir, new_dir): #physical move old_dir = os.path.join(old_dir, 'collected_torrent_files') new_dir = os.path.join(new_dir, 'collected_torrent_files') atexit.register(os.renames, old_dir, new_dir) old_dir = os.path.join(old_dir, 'collected_subtitles_files') new_dir = os.path.join(new_d... | 444,876 |
def getBuzz(self, size= DEFAULT_SAMPLE_SIZE, with_freq=True, flat=False): """ Samples both the TermFrequency and the TorrentBiTermPhrase table for high, medium, and low frequent terms and phrases. @param size Number of terms/phrases to be sampled for each category (high frequent, mid frequent, low frequent). @param wi... | def getBuzz(self, size= DEFAULT_SAMPLE_SIZE, with_freq=True, flat=False): """ Samples both the TermFrequency and the TorrentBiTermPhrase table for high, medium, and low frequent terms and phrases. @param size Number of terms/phrases to be sampled for each category (high frequent, mid frequent, low frequent). @param wi... | 444,877 |
def getBuzzForTable(self, table, size, with_freq=True, max_freq=None): """ Retrieves a sample of high, medium and low frequent terms or phrases, paired with their frequencies, depending on the table to be sampled from. @table Table to retrieve the highest frequency from. Must be a key in NetworkBuzzDBHandler.TABLES. @... | def getBuzzForTable(self, table, size, with_freq=True, max_freq=None): """ Retrieves a sample of high, medium and low frequent terms or phrases, paired with their frequencies, depending on the table to be sampled from. @table Table to retrieve the highest frequency from. Must be a key in NetworkBuzzDBHandler.TABLES. @... | 444,878 |
def getBuzzForTable(self, table, size, with_freq=True, max_freq=None): """ Retrieves a sample of high, medium and low frequent terms or phrases, paired with their frequencies, depending on the table to be sampled from. @table Table to retrieve the highest frequency from. Must be a key in NetworkBuzzDBHandler.TABLES. @... | def getBuzzForTable(self, table, size, with_freq=True, max_freq=None): """ Retrieves a sample of high, medium and low frequent terms or phrases, paired with their frequencies, depending on the table to be sampled from. @table Table to retrieve the highest frequency from. Must be a key in NetworkBuzzDBHandler.TABLES. @... | 444,879 |
def P2PSim_Single(db_row, nmyprefs): sim = 0 if db_row: peer_id, nr_items, overlap = db_row # Arno, 2010-01-14: Safety catch for weird by reported by Johan if nr_items is None: nr_items = 0 if nmyprefs is None: nmyprefs = 0 #Cosine Similarity With Emphasis on users with profilelength >= 40 sim = overlap * ((1.0/(nmypr... | def P2PSim_Single(db_row, nmyprefs): sim = 0 if db_row: peer_id, nr_items, overlap = db_row # Arno, 2010-01-14: Safety catch for weird by reported by Johan if (nr_items is None) or (nmyprefs is None): return sim if (nr_items is 0) or (nmyprefs is 0): return sim #Cosine Similarity With Emphasis on users with profilelen... | 444,880 |
def got_have_bitfield(self, have): if self.downloader.picker.am_I_complete() and have.complete(): # Arno: If we're both seeds if self.downloader.super_seeding: self.connection.send_bitfield(have.tostring()) # be nice, show you're a seed too self.connection.close() self.downloader.add_disconnected_seed(self.connection.... | def got_have_bitfield(self, have): if self.downloader.picker.am_I_complete() and have.complete(): # Arno: If we're both seeds if self.downloader.super_seeding: self.connection.send_bitfield(have.tostring()) # be nice, show you're a seed too self.connection.close() self.downloader.add_disconnected_seed(self.connection.... | 444,881 |
def got_have_bitfield(self, have): if self.downloader.picker.am_I_complete() and have.complete(): # Arno: If we're both seeds if self.downloader.super_seeding: self.connection.send_bitfield(have.tostring()) # be nice, show you're a seed too self.connection.close() self.downloader.add_disconnected_seed(self.connection.... | def got_have_bitfield(self, have): if self.downloader.picker.am_I_complete() and have.complete(): # Arno: If we're both seeds if self.downloader.super_seeding: self.connection.send_bitfield(have.tostring()) # be nice, show you're a seed too self.connection.close() self.downloader.add_disconnected_seed(self.connection.... | 444,882 |
def live_invalidate_ranges(self,toinvalidateranges,toinvalidateset): """ STBPEED: Faster version of live_invalidate that copies have arrays rather than iterate over them for clearing """ if len(toinvalidateranges) == 1: (s,e) = toinvalidateranges[0] emptyrange = [False for piece in xrange(s,e+1)] assert len(emptyrange)... | def live_invalidate_ranges(self,toinvalidateranges,toinvalidateset): """ STBPEED: Faster version of live_invalidate that copies have arrays rather than iterate over them for clearing """ if len(toinvalidateranges) == 1: (s,e) = toinvalidateranges[0] emptyrange = [False for piece in xrange(s,e+1)] assert len(emptyrange)... | 444,883 |
def _create_connections(self): now = time() | def _create_connections(self): now = time() | 444,884 |
def _create_connections(self): now = time() | defif DEBUG: print >> sys.stderr, len(self._connections), "/", len(self._potential_peers), "->", len(addresses) _create_connections(self):if DEBUG: print >> sys.stderr, len(self._connections), "/", len(self._potential_peers), "->", len(addresses) nowif DEBUG: print >> sys.stderr, len(self._connections), "/", len(self._... | 444,885 |
def network_send_query_callback(self,query,usercallback,max_peers_to_query): """ Called by overlay thread """ p = self.create_query(query,usercallback) m = QUERY+p query_conn_callback_lambda = lambda exc,dns,permid,selversion:self.conn_callback(exc,dns,permid,selversion,m) | def network_send_query_callback(self,query,usercallback,max_peers_to_query): """ Called by overlay thread """ p = self.create_query(query,usercallback) m = QUERY+p query_conn_callback_lambda = lambda exc,dns,permid,selversion:self.conn_callback(exc,dns,permid,selversion,m) | 444,886 |
def network_send_query_callback(self,query,usercallback,max_peers_to_query): """ Called by overlay thread """ p = self.create_query(query,usercallback) m = QUERY+p query_conn_callback_lambda = lambda exc,dns,permid,selversion:self.conn_callback(exc,dns,permid,selversion,m) | def network_send_query_callback(self,query,usercallback,max_peers_to_query): """ Called by overlay thread """ p = self.create_query(query,usercallback) m = QUERY+p query_conn_callback_lambda = lambda exc,dns,permid,selversion:self.conn_callback(exc,dns,permid,selversion,m) | 444,887 |
def network_send_query_callback(self,query,usercallback,max_peers_to_query): """ Called by overlay thread """ p = self.create_query(query,usercallback) m = QUERY+p query_conn_callback_lambda = lambda exc,dns,permid,selversion:self.conn_callback(exc,dns,permid,selversion,m) | def network_send_query_callback(self,query,usercallback,max_peers_to_query): """ Called by overlay thread """ p = self.create_query(query,usercallback) m = QUERY+p query_conn_callback_lambda = lambda exc,dns,permid,selversion:self.conn_callback(exc,dns,permid,selversion,m) | 444,888 |
def network_send_query_callback(self,query,usercallback,max_peers_to_query): """ Called by overlay thread """ p = self.create_query(query,usercallback) m = QUERY+p query_conn_callback_lambda = lambda exc,dns,permid,selversion:self.conn_callback(exc,dns,permid,selversion,m) | def network_send_query_callback(self,query,usercallback,max_peers_to_query): """ Called by overlay thread """ p = self.create_query(query,usercallback) m = QUERY+p query_conn_callback_lambda = lambda exc,dns,permid,selversion:self.conn_callback(exc,dns,permid,selversion,m) | 444,889 |
def http_response(self, req, resp): if resp.headers.get("content-encoding") == "gzip": gzip = GzipFile(fileobj=StringIO(resp.read()), mode="r") prev_resp = resp resp = urllib2.addinfourl(gzip, prev_resp.headers, prev_resp.url, prev_resp.code) resp.msg = prev_resp.msg return resp | def http_response(self, req, resp): if resp.headers.get("content-encoding") == "gzip": gzip = GzipFile(fileobj=StringIO(resp.read()), mode="r") prev_resp = resp resp = urllib2.addinfourl(gzip, prev_resp.headers, prev_resp.url) resp.code = prev_resp.code resp.msg = prev_resp.msg return resp | 444,890 |
def on_query_received(self): """Register a query from node. | def on_query_received(self): """Register a query from node. | 444,891 |
def on_response_received(self, rtt=0): """Register a reply from rnode. | def on_response_received(self, rtt=0): """Register a reply from rnode. | 444,892 |
def on_timeout(self): """Register a timeout for this rnode. | def on_timeout(self): """Register a timeout for this rnode. | 444,893 |
def add_task(self,task,t=0,id=None): """ t parameter is now usable, unlike before. If id is given, all the existing tasks with the same id will be removed before inserting this task """ if task is None: print_stack() | def add_task(self,task,t=0,id=None): """ t parameter is now usable, unlike before. If id is given, all the existing tasks with the same id will be removed before inserting this task """ if task is None: print_stack() | 444,894 |
def getStaticText(term): if len(self.tags) > 0: text = self.tags.pop() text.SetLabel(term) else: text = wx.StaticText(self.panel, wx.ID_ANY, term) text.Bind(wx.EVT_MOUSE_EVENTS, self.OnMouse) text.SetFont(self.TERM_FONTS[i]) text.SetForegroundColour(BuzzPanel.INACTIVE_COLOR) text.SetToolTipString("Click to search for ... | def getStaticText(term, font = None): if len(self.tags) > 0: text = self.tags.pop() text.SetLabel(term) else: text = wx.StaticText(self.panel, wx.ID_ANY, term) text.Bind(wx.EVT_MOUSE_EVENTS, self.OnMouse) text.SetFont(self.TERM_FONTS[i]) text.SetForegroundColour(BuzzPanel.INACTIVE_COLOR) text.SetToolTipString("Click t... | 444,895 |
def getStaticText(term): if len(self.tags) > 0: text = self.tags.pop() text.SetLabel(term) else: text = wx.StaticText(self.panel, wx.ID_ANY, term) text.Bind(wx.EVT_MOUSE_EVENTS, self.OnMouse) text.SetFont(self.TERM_FONTS[i]) text.SetForegroundColour(BuzzPanel.INACTIVE_COLOR) text.SetToolTipString("Click to search for ... | def getStaticText(term): if len(self.tags) > 0: text = self.tags.pop() text.SetLabel(term) else: text = wx.StaticText(self.panel, wx.ID_ANY, term) text.Bind(wx.EVT_MOUSE_EVENTS, self.OnMouse) if font: text.SetFont(font) text.SetForegroundColour(BuzzPanel.INACTIVE_COLOR) text.SetToolTipString("Click to search for '%s'"... | 444,896 |
def getStaticText(term): if len(self.tags) > 0: text = self.tags.pop() text.SetLabel(term) else: text = wx.StaticText(self.panel, wx.ID_ANY, term) text.Bind(wx.EVT_MOUSE_EVENTS, self.OnMouse) text.SetFont(self.TERM_FONTS[i]) text.SetForegroundColour(BuzzPanel.INACTIVE_COLOR) text.SetToolTipString("Click to search for ... | def getStaticText(term): if len(self.tags) > 0: text = self.tags.pop() text.SetLabel(term) else: text = wx.StaticText(self.panel, wx.ID_ANY, term) text.Bind(wx.EVT_MOUSE_EVENTS, self.OnMouse) text.SetFont(self.TERM_FONTS[i]) text.SetForegroundColour(BuzzPanel.INACTIVE_COLOR) text.SetToolTipString("Click to search for ... | 444,897 |
def add_event(self, ignore, msg): SimpleFileReporter.lock.acquire() try: if not self.file: self.file = open(self.path, 'a+b') self.file.write('%.2f %s\n' %(time.time(), msg)) self.file.flush() except: if DEBUG: print >>sys.stderr, 'Error writing puncture log' finally: SimpleFileReporter.lock.release() | def add_event(self, ignore, msg): SimpleFileReporter.lock.acquire() try: try: if not self.file: self.file = open(self.path, 'a+b') self.file.write('%.2f %s\n' %(time.time(), msg)) self.file.flush() except: if DEBUG: print >>sys.stderr, 'Error writing puncture log' finally: SimpleFileReporter.lock.release() | 444,898 |
def add_row(parent, sizer, name, value): if name: name = wx.StaticText(parent, -1, name) font = name.GetFont() font.SetWeight(wx.FONTWEIGHT_BOLD) name.SetFont(font) sizer.Add(name, 0, wx.LEFT, 10) value = wx.StaticText(parent, -1, unicode(value)) value.SetMinSize((1,-1)) sizer.Add(value, 0, wx.EXPAND|wx.LEFT, 10) ret... | def add_row(parent, sizer, name, value): if name: name = wx.StaticText(parent, -1, name) font = name.GetFont() font.SetWeight(wx.FONTWEIGHT_BOLD) name.SetFont(font) sizer.Add(name, 0, wx.LEFT, 10) try: value = wx.StaticText(parent, -1, unicode(value)) except: value = wx.StaticText(parent, -1, value.decode('utf-8','ign... | 444,899 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.