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

All Samples(66)  |  Call(49)  |  Derive(0)  |  Import(17)

src/k/a/kamaelia-HEAD/Sketches/RJL/bittorrent/BitTorrent/BitTorrent/Rerequester.py   kamaelia(Download)
from BitTorrent import version
from BitTorrent.platform import bttime
from BitTorrent.zurllib import urlopen, quote, Request
from BitTorrent.btformats import check_peers
    def _check(self):
        if self.current_started is not None:
            if self.current_started <= bttime() - 58:
                               _("Tracker announce still not complete "
        if self.fail_wait is not None:
            if self.last_time + self.fail_wait <= bttime():
        if self.last_time > bttime() - self.config['rerequest_interval']:
            getmore = self.howmany() < self.config['min_peers']
        if getmore or bttime() - self.last_time > self.announce_interval:

src/k/a/kamaelia-HEAD/Sketches/RJL/bittorrent/BitTorrent/BitTorrent/RateMeasure.py   kamaelia(Download)
# Written by Bram Cohen
from BitTorrent.platform import bttime
    def data_came_in(self, amount):
        if not self.got_anything:
            self.got_anything = True
            self.start = bttime() - 2
            self.last = self.start
            self.left -= amount
        self.update(bttime(), amount)
    def get_time_left(self):
        if not self.got_anything:
            return None
        t = bttime()
        if t - self.last > 15:

src/k/a/kamaelia-HEAD/Sketches/RJL/bittorrent/BitTorrent/BitTorrent/CurrentRateMeasure.py   kamaelia(Download)
# Written by Bram Cohen
from BitTorrent.platform import bttime
class Measure(object):
    def __init__(self, max_rate_period, fudge=5):
        self.max_rate_period = max_rate_period
        self.ratesince = bttime() - fudge
    def update_rate(self, amount):
        self.total += amount
        t = bttime()
        self.rate = (self.rate * (self.last - self.ratesince) +
            amount) / (t - self.ratesince)
    def time_until_rate(self, newrate):
        if self.rate <= newrate:
            return 0
        t = bttime() - self.ratesince
        return ((self.rate * t) / newrate) - t

src/k/a/kamaelia-HEAD/Sketches/RJL/bittorrent/BitTorrent/BitTorrent/RawServer.py   kamaelia(Download)
from BitTorrent.platform import bttime
from BitTorrent import WARNING, CRITICAL, FAQ_URL
from BitTorrent.defer import Deferred
        self.handler = handler
        self.buffer = []
        self.last_hit = bttime()
        self.fileno = sock.fileno()
        self.connected = False
    def add_task(self, func, delay, args=(), context=None):
        assert thread.get_ident() == self.ident
        assert type(args) == list or type(args) == tuple
        if context in self.live_contexts:
            insort(self.funcs, (bttime() + delay, func, args, context))
    def scan_for_timeouts(self):
        t = bttime() - self.config['socket_timeout']
        tokill = []
                if event & (POLLIN | POLLHUP):
                    s.last_hit = bttime()
                        data, addr = s.socket.recvfrom(100000)

src/k/a/kamaelia-HEAD/Sketches/RJL/bittorrent/BitTorrent/BitTorrent/TorrentQueue.py   kamaelia(Download)
from BitTorrent import GetTorrent
from BitTorrent.platform import bttime
from BitTorrent.download import Feedback, Multitorrent
from BitTorrent.bencode import bdecode
    def _check_version(self):
        now = bttime()
        if self.last_version_check > 0 and \
               self.last_version_check > now - 24*60*60:
    def _dump_state(self):
        self.last_save_time = bttime()
        r = []
        def write_entry(infohash, t):
            if t.dlpath is None:
    def _queue_loop(self):
        if self.doneflag.isSet():
        self.rawserver.add_task(self._queue_loop, 20)
        now = bttime()
        status = torrent.dl.get_status(want_spew, want_fileinfo)
        if torrent.finishtime is not None:
            now = bttime()
            uptotal = status['upTotal'] + torrent.uptotal_old
            downtotal = status['downTotal'] + torrent.downtotal_old

src/k/a/kamaelia-HEAD/Sketches/RJL/bittorrent/BitTorrent/khashmir/ktable.py   kamaelia(Download)
# License.
from BitTorrent.platform import bttime as time
from bisect import *
from types import *
        # full bucket, check to see if any nodes are invalid
        t = time()
        invalid = [x for x in self.buckets[i].invalid.values() if x.invalid]
        if len(invalid) and not nocheck:
        self.min = min
        self.max = max
        self.lastAccessed = time()
    def touch(self):
        self.lastAccessed = time()

src/k/a/kamaelia-HEAD/Sketches/RJL/bittorrent/BitTorrent/khashmir/node.py   kamaelia(Download)
import khash
from BitTorrent.platform import bttime as time
from types import *
        self.invalid = True
        self.id = self.host = self.port = ''
        self.age = time()
    def init(self, id, host, port):
    def updateLastSeen(self):
        self.lastSeen = time()
        self.fails = 0
        self.invalid = False

src/k/a/kamaelia-HEAD/Sketches/RJL/bittorrent/BitTorrent/khashmir/kstore.py   kamaelia(Download)
        return d.keys()
from BitTorrent.platform import bttime as time
class KItem:
    def __init__(self, key, value):
        self.t = time()
    def __repr__(self):
        return `(self.k, self.v, time() - self.t)`
## in memory data store for distributed tracker
## keeps a list of values per key in dictionary

src/k/a/kamaelia-HEAD/Sketches/RJL/bittorrent/BitTorrent/khashmir/KRateLimiter.py   kamaelia(Download)
# License.
from BitTorrent.platform import bttime as time
from BitTorrent.CurrentRateMeasure import Measure
from const import *
    def sendto(self, s, i, addr):
        self.q.append((time(), (s, i, addr)))
        if not self.running:
    def run(self, check=False):
        t = time()

src/k/a/kamaelia-HEAD/Sketches/RJL/bittorrent/BitTorrent/BitTorrent/StatusLight.py   kamaelia(Download)
from BitTorrent.platform import bttime
class StatusLight(object):
    initial_state = 'stopped'
        if new_state == 'pre-natted':
            if (self.mystate == 'pre-natted' and
                bttime() - self.start_time > self.time_to_nat):
                # go to natted state after a while
                new_state = 'natted'
            elif self.mystate != 'pre-natted':
                # start pre-natted timer
                self.start_time = bttime()

  1 | 2  Next