Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(50)  |  Call(35)  |  Derive(0)  |  Import(15)
Allow a sequence of booleans to be used as an indexable bitfield

src/o/w/OwnTube-HEAD/videoportal/BitTornadoABC/BitTornado/BT1/StorageWrapper.py   OwnTube(Download)
# Written by Bram Cohen
# see LICENSE.txt for license information
 
from BitTornado.bitfield import Bitfield
from sha import sha
        self.amount_obtained = 0
        self.amount_desired = self.total_length
        self.have = Bitfield(len(hashes))
        self.have_cloaked_data = None
        self.blocked = [False] * len(hashes)
    def get_have_list_cloaked(self):
        if self.have_cloaked_data is None:
            newhave = Bitfield(copyfrom = self.have)
            unhaves = []
            n = min(randrange(2, 5), len(self.hashes))    # between 2-4 unless torrent is small
    def pickle(self):
        if self.have.complete():
            return {'pieces': 1}
        pieces = Bitfield(len(self.hashes))
        places = []
                assert not data.get('places', None)
                assert not data.get('partials', None)
                have = Bitfield(len(self.hashes))
                for i in xrange(len(self.hashes)):
                    have[i] = True

src/f/r/FriendlyTorrent-HEAD/src/tornado/BitTornado/BT1/StorageWrapper.py   FriendlyTorrent(Download)
# Written by Bram Cohen
# see LICENSE.txt for license information
 
from BitTornado.bitfield import Bitfield
from hashlib import sha1
        self.amount_obtained = 0
        self.amount_desired = self.total_length
        self.have = Bitfield(len(hashes))
        self.have_cloaked_data = None
        self.blocked = [False] * len(hashes)
    def get_have_list_cloaked(self):
        if self.have_cloaked_data is None:
            newhave = Bitfield(copyfrom = self.have)
            unhaves = []
            n = min(randrange(2,5),len(self.hashes))    # between 2-4 unless torrent is small
    def pickle(self):
        if self.have.complete():
            return {'pieces': 1}
        pieces = Bitfield(len(self.hashes))
        places = []
                assert not data.get('places',None)
                assert not data.get('partials',None)
                have = Bitfield(len(self.hashes))
                for i in xrange(len(self.hashes)):
                    have[i] = True

src/b/i/BitTornado-HEAD/BitTornado/BT1/StorageWrapper.py   BitTornado(Download)
import hashlib
from BitTornado.bitfield import Bitfield
from BitTornado.clock import clock
from random import randrange
try:
        self.amount_obtained = 0
        self.amount_desired = self.total_length
        self.have = Bitfield(len(hashes))
        self.have_cloaked_data = None
        self.blocked = [False] * len(hashes)
    def get_have_list_cloaked(self):
        if self.have_cloaked_data is None:
            newhave = Bitfield(copyfrom=self.have)
            unhaves = []
            # between 2-4 unless torrent is small
    def pickle(self):
        if self.have.complete:
            return {'pieces': 1}
        pieces = Bitfield(len(self.hashes))
        places = []
                assert not data.get('places', None)
                assert not data.get('partials', None)
                have = Bitfield(len(self.hashes))
                for i in xrange(len(self.hashes)):
                    have[i] = True

src/h/e/Herd-HEAD/BitTornado/BT1/StorageWrapper.py   Herd(Download)
# Written by Bram Cohen
# see LICENSE.txt for license information
 
from BitTornado.bitfield import Bitfield
from sha import sha
        self.amount_obtained = 0
        self.amount_desired = self.total_length
        self.have = Bitfield(len(hashes))
        self.have_cloaked_data = None
        self.blocked = [False] * len(hashes)
    def get_have_list_cloaked(self):
        if self.have_cloaked_data is None:
            newhave = Bitfield(copyfrom = self.have)
            unhaves = []
            n = min(randrange(2,5),len(self.hashes))    # between 2-4 unless torrent is small
    def pickle(self):
        if self.have.complete():
            return {'pieces': 1}
        pieces = Bitfield(len(self.hashes))
        places = []
                assert not data.get('places',None)
                assert not data.get('partials',None)
                have = Bitfield(len(self.hashes))
                for i in xrange(len(self.hashes)):
                    have[i] = True

src/s/w/swarm-HEAD/BitTornado/BT1/StorageWrapper.py   swarm(Download)
# Written by Bram Cohen
# see LICENSE.txt for license information
 
from BitTornado.bitfield import Bitfield
from sha import sha
        self.amount_obtained = 0
        self.amount_desired = self.total_length
        self.have = Bitfield(len(hashes))
        self.have_cloaked_data = None
        self.blocked = [False] * len(hashes)
    def get_have_list_cloaked(self):
        if self.have_cloaked_data is None:
            newhave = Bitfield(copyfrom = self.have)
            unhaves = []
            n = min(randrange(2,5),len(self.hashes))    # between 2-4 unless torrent is small
    def pickle(self):
        if self.have.complete():
            return {'pieces': 1}
        pieces = Bitfield(len(self.hashes))
        places = []
                assert not data.get('places',None)
                assert not data.get('partials',None)
                have = Bitfield(len(self.hashes))
                for i in xrange(len(self.hashes)):
                    have[i] = True

src/o/w/OwnTube-HEAD/videoportal/BitTornadoABC/BitTornado/BT1/Connecter.py   OwnTube(Download)
# Written by Bram Cohen
# see LICENSE.txt for license information
 
from BitTornado.bitfield import Bitfield
from BitTornado.clock import clock
        elif t == BITFIELD:
            try:
                b = Bitfield(self.numpieces, message[1:])
            except ValueError:
                connection.close()

src/f/r/FriendlyTorrent-HEAD/src/tornado/BitTornado/BT1/Connecter.py   FriendlyTorrent(Download)
# Written by Bram Cohen
# see LICENSE.txt for license information
 
from BitTornado.bitfield import Bitfield
from BitTornado.clock import clock
        elif t == BITFIELD:
            try:
                b = Bitfield(self.numpieces, message[1:])
            except ValueError:
                if DEBUG2:

src/b/i/BitTornado-HEAD/BitTornado/BT1/Connecter.py   BitTornado(Download)
from BitTornado.bitfield import Bitfield
from BitTornado.clock import clock
from binascii import hexlify, unhexlify
 
DEBUG1 = False
        elif t == BITFIELD:
            try:
                b = Bitfield(self.numpieces, message[1:])
            except ValueError:
                if DEBUG2:

src/h/e/Herd-HEAD/BitTornado/BT1/Connecter.py   Herd(Download)
# Written by Bram Cohen
# see LICENSE.txt for license information
 
from BitTornado.bitfield import Bitfield
from BitTornado.clock import clock
        elif t == BITFIELD:
            try:
                b = Bitfield(self.numpieces, message[1:])
            except ValueError:
                connection.close()

src/s/w/swarm-HEAD/BitTornado/BT1/Connecter.py   swarm(Download)
# Written by Bram Cohen
# see LICENSE.txt for license information
 
from BitTornado.bitfield import Bitfield
from BitTornado.clock import clock
        elif t == BITFIELD:
            try:
                b = Bitfield(self.numpieces, message[1:])
            except ValueError:
                connection.close()

  1 | 2  Next