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

All Samples(22)  |  Call(14)  |  Derive(0)  |  Import(8)
Return the contents of the file named <fn>.

        def readFile(fn, binary=0):
    """Return the contents of the file named ."""
    f = open(fn, ['r', 'rb'][binary])
    try:
        return f.read()
    finally:
        f.close()
        


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, \
                else:
                    assert isinstance(fn, StringType)
                    s = readFile(fn, 1)
                try:
                    if stringContains(s,
                message = sys.stdin.read()
            else:
                message = readFile(inFile)
        except KeyboardInterrupt:
            print "Interrupted.  Message not sent."
                message = sys.stdin.read()
            else:
                message = readFile(inFile)
        except KeyboardInterrupt:
            print "Interrupted."
    else:
        try:
            s = readFile(inputFile)
        except OSError, e:
            LOG.error("Could not read file %s: %s", inputFile, e)

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, \
        if os.path.exists(fn):
            checkPrivateFile(fn)
            r = readFile(fn)
            if len(r) == mixminion.Crypto.DIGEST_LEN:
                self.pingerSeed = r
           publication failed for some other reason."""
        fname = self.getDescriptorFileName()
        descriptor = readFile(fname)
        fields = urllib.urlencode({"desc" : descriptor})
        f = None
                                   nickname,
                                   certStarts, certEnds)
    certText = readFile(fname)
    os.unlink(fname)
    mixminion.Crypto.generate_cert(fname,
                                   identityKey, identityKey,
                                   nickname, nickname,
                                   certStarts, certEnds)
 
    identityCertText = readFile(fname)

src/m/i/mixminion-HEAD/lib/mixminion/Filestore.py   mixminion(Download)
import whichdb
 
from mixminion.Common import MixError, MixFatalError, secureDelete, LOG, \
     createPrivateDir, readFile, replaceFile, tryUnlink, writePickled
from mixminion.Crypto import getCommonPRNG
        try:
            self._lock.acquire()
            return readFile(os.path.join(self.dir, "msg_"+handle), 1)
        finally:
            self._lock.release()
        # If there's a journal file, snarf it into memory.
        if os.path.exists(self.journalFileName):
            j = readFile(self.journalFileName, 1)
            for i in xrange(0, len(j), klen+vlen):
                if vlen:

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, \
 
    try:
        pid = int(readFile(pidFile))
    except (IOError, ValueError), e:
        raise UIError("Couldn't read pid file: %s"%e)

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
    assert list(map(len, magicList)) == [8]*len(magicList)
 
    text = readFile(fname)
    r = unarmorText(text, ["TYPE III KEYRING"])
    if len(r) != 1:

src/m/i/mixminion-HEAD/lib/mixminion/directory/ServerList.py   mixminion(Download)
from mixminion.Crypto import pk_decode_public_key, pk_encode_public_key, \
     pk_same_public_key
from mixminion.Common import IntervalSet, LOG, MixError, MixFatalError, \
     UIError, createPrivateDir, formatBase64, formatDate, formatFnameTime, \
     formatTime, iterFileLines, Lockfile, openUnique, previousMidnight, readFile,\

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
    def __init__(self, fname=None, string=None, includeStr="deny"):
        """Read the address set from a file or a string."""
        if string is None:
            string = readFile(fname)
 

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