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

All Samples(17)  |  Call(8)  |  Derive(0)  |  Import(9)
Compute ceil(a / b). See comments for portability notes.

        def ceilDiv(a,b):
    "Compute ceil(a / b). See comments for portability notes."
    return divmod(a-1,b)[0]+1
        


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
    prng = getCommonPRNG()
    length = struct.pack("!L", len(data))
    paddingLen = ceilDiv(len(data), 1024)*1024 - len(data)
    padding = prng.getBytes(paddingLen)
    data = "".join([length,data,padding])

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, \
        perturbation = self._getPerturbation(path, periodStart, interval)
        t = periodStart + perturbation
        t += interval * ceilDiv(now-t, interval)
        if t>periodEnd:
            periodStart = periodEnd

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, \
 
            if pathSpec.lateSplit:
                n1 = ceilDiv(len(p),2)
            else:
                n1 = len(p1)
                raise UIError("Server %s is running old software that doesn't support exit headers."% nickname)
 
        exitKB = ceilDiv(self.exitSize, 1024)
 
        if self.isSSFragmented:

src/m/i/mixminion-HEAD/lib/mixminion/Config.py   mixminion(Download)
import mixminion.NetUtils
 
from mixminion.Common import MixError, LOG, ceilDiv, englishSequence, \
     formatBase64, isPrintingAscii, stripSpace, stringContains, UIError
 
                raise ConfigError("Repeated interval too small in %s"%s)
 
            ilist += [interval] * ceilDiv(duration, interval)
        elif item.startswith("every "):
            raise ConfigError(

src/m/i/mixminion-HEAD/lib/mixminion/server/ServerKeys.py   mixminion(Download)
from mixminion.ServerInfo import ServerInfo, PACKET_KEY_BYTES, MMTP_KEY_BYTES,\
     signServerInfo
from mixminion.Common import AtomicFile, LOG, MixError, MixFatalError, \
     ceilDiv, createPrivateDir, checkPrivateFile, englishSequence, \
     formatBase64, formatDate, formatTime, previousMidnight, readFile, \
 
        lifetime = self.config['Server']['PublicKeyLifetime'].getSeconds()
        nKeys = int(ceilDiv(timeToCover, lifetime))
 
        LOG.info("Creating %s keys", nKeys)

src/m/i/mixminion-HEAD/lib/mixminion/server/ServerQueue.py   mixminion(Download)
import mixminion.Filestore
 
from mixminion.Common import MixError, MixFatalError, secureDelete, LOG, \
     createPrivateDir, readPickled, writePickled, formatTime, readFile, \
     ceilDiv
            #DOCDOC
            retrySchedule = [3600]
        attempt += (ceilDiv(lastAttempt-attempt+60,retrySchedule[-1]) *
                    retrySchedule[-1])
        return attempt

src/m/i/mixminion-HEAD/lib/mixminion/server/ServerMain.py   mixminion(Download)
 
from bisect import insort
from mixminion.Common import LOG, LogStream, MixError, MixFatalError,\
     UIError, ceilDiv, createPrivateDir, disp64, formatTime, \
     installSIGCHLDHandler, Lockfile, LockfileLocked, readFile, secureDelete, \

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

src/m/i/mixminion-HEAD/lib/mixminion/testSupport.py   mixminion(Download)
import mixminion.Crypto
import mixminion.Common
from mixminion.Common import waitForChildren, ceilDiv, createPrivateDir, LOG
from mixminion.Config import _parseBoolean, _parseIntervalList, ConfigError
 
    def _prng(self,n):
        reps = ceilDiv(n+self.idx,256)
        r = (self.pattern*reps)[self.idx:self.idx+n]
        self.idx = (self.idx+n) % 256
        assert len(r) == n