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

All Samples(19)  |  Call(11)  |  Derive(0)  |  Import(8)
Compute floor(a / b). See comments for portability notes.

        def floorDiv(a,b):
    "Compute floor(a / b). See comments for portability notes."
    return divmod(a,b)[0]

src/m/i/mixminion-HEAD/lib/mixminion/server/Pinger.py   mixminion(Download)
import mixminion.server.MMTPServer
from mixminion.Common import MixError, AtomicFile, ceilDiv, createPrivateDir, \
     floorDiv, formatBase64, formatFnameDate, formatTime, IntervalSet, LOG, \
     parseFnameDate, previousMidnight, readPickled, secureDelete, \
                    (serverID, startTime, endTime))
        for sent,received in cur:
            pIdx = floorDiv(sent-startTime, self._PING_GRANULARITY)
            nSent[pIdx] += 1
            nPings += 1
            if d:
                dailyMedianLatency.append(d[floorDiv(len(d), 2)])
                    (serverID, startTime, endTime))
        for sent,received in cur:
            pIdx = floorDiv(sent-startTime, self._PING_GRANULARITY)
            if received:
                nReceived[pIdx] += 1
        # 3. Write current overall results into the DB.
        if allLatencies:
            latent = self._roundLatency(allLatencies[floorDiv(len(allLatencies),2)])
            latent = 0

src/m/i/mixminion-HEAD/lib/mixminion/server/EventStats.py   mixminion(Download)
from time import time
from mixminion.Common import formatTime, LOG, previousMidnight, floorDiv, \
     createPrivateDir, MixError, readPickled, tryUnlink, writePickled
            mid = previousMidnight(self.nextRotation)
            rest = self.nextRotation - mid
            self.nextRotation = mid + 3600 * floorDiv(rest+55*60, 3600)
def configureLog(config):

src/m/i/mixminion-HEAD/lib/mixminion/ClientMain.py   mixminion(Download)
import mixminion.MMTPClient
from mixminion.Common import LOG, Lockfile, LockfileLocked, MixError, \
     MixFatalError, MixProtocolBadAuth, MixProtocolError, STATUS, UIError, \
     UsageError, createPrivateDir, englishSequence, floorDiv, formatTime, \
    now = time.time()
    for server, count, date in res_items:
        days = floorDiv(now-date, 24*60*60)
        if days < 1:
            days = "<1"

src/m/i/mixminion-HEAD/lib/mixminion/server/Modules.py   mixminion(Download)
import mixminion.server.PacketHandler
from mixminion.Config import ConfigError
from mixminion.Common import LOG, MixError, ceilDiv, createPrivateDir, \
     encodeBase64, floorDiv, isPrintingAscii, isSMTPMailbox, previousMidnight,\
     readFile, waitForChildren
        sz = 32*1024
    if sz & 0x3FF:
        kb = floorDiv(sz,1024)+1
        LOG.warn("Rounding %s maximum message size up to %s KB",modname,kb)
        sz = 1024*kb
                  Maximum-Size: %s
                  Allow-From: %s
               """ % (floorDiv(self.maxMessageSize,1024), allowFrom)
    def getName(self):
        return ("[Delivery/SMTP]\nVersion: 0.1\n"
                "Maximum-Size: %s\nAllow-From: %s\n") % (
                    floorDiv(self.maxMessageSize,1024), allowFrom)
    def getName(self):
        return "SMTP"

src/m/i/mixminion-HEAD/lib/mixminion/directory/DirFormats.py   mixminion(Download)
import mixminion.ServerInfo
from mixminion.Common import formatBase64, formatDate, floorDiv, LOG, \
     MixError, previousMidnight
    # Next -- what is the result of the vote? (easy cases)
    threshold = floorDiv(len(voters)+1, 2)
    includedClientVersions = commonElements(
        [ d['Recommended-Software']['MixminionClient'] for d in goodVotes ],

src/m/i/mixminion-HEAD/lib/mixminion/ClientDirectory.py   mixminion(Download)
import mixminion.ServerInfo
from mixminion.Common import LOG, MixError, MixFatalError, UIError, \
     ceilDiv, createPrivateDir, formatDate, formatFnameTime, openUnique, \
     previousMidnight, readPickled, readPossiblyGzippedFile, \

src/m/i/mixminion-HEAD/lib/mixminion/ClientUtils.py   mixminion(Download)
import mixminion.Packet
from mixminion.Common import LOG, MixError, UIError, ceilDiv, \
     createPrivateDir, floorDiv, previousMidnight, readFile, \
     succeedingMidnight, writeFile, armorText, unarmorText, MixFatalError

src/m/i/mixminion-HEAD/lib/mixminion/Packet.py   mixminion(Download)
import zlib
from socket import inet_ntoa, inet_aton
from mixminion.Common import MixError, MixFatalError, encodeBase64, \
     floorDiv, formatBase64, formatTime, isSMTPMailbox, LOG, armorText, \
     unarmorText, isPlausibleHostname