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

All Samples(5)  |  Call(2)  |  Derive(0)  |  Import(3)
Convert 's' to a multiline base-64 representation.  Improves upon
base64.encodestring by having a variable line width.  Implementation
is based upon that function.

        def encodeBase64(s, lineWidth=64, oneline=0):
    """Convert 's' to a multiline base-64 representation.  Improves upon
       base64.encodestring by having a variable line width.  Implementation
       is based upon that function.
    """
    pieces = []
    bytesPerLine = floorDiv(lineWidth, 4) * 3
    for i in xrange(0, len(s), bytesPerLine):
        chunk = s[i:i+bytesPerLine]
        pieces.append(binascii.b2a_base64(chunk))
    if oneline:
        return "".join([ s.strip() for s in pieces ])
    else:
        return "".join(pieces)
        


src/m/i/mixminion-HEAD/lib/mixminion/server/PacketHandler.py   mixminion(Download)
import types
 
from mixminion.Common import encodeBase64, formatBase64, LOG
import mixminion.Crypto as Crypto
import mixminion.Packet as Packet
            return self.contents
        else:
            return encodeBase64(self.contents)
 
    def getHeaders(self):

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
            return self.contents
        else:
            return encodeBase64(self.contents)
    def getHeaders(self):
        if self.contents is None:

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