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

All Samples(7)  |  Call(4)  |  Derive(0)  |  Import(3)
Move the file named 'f1' to a new name 'f2'.  Replace any file
already named 'f2'.

            def replaceFile(f1, f2):
        """Move the file named 'f1' to a new name 'f2'.  Replace any file
           already named 'f2'."""
        os.rename(f1, f2)
        


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 isGzipped:
            replaceFile(tmpname, self.fnameBase+".gz")
            tryUnlink(self.fnameBase)
        else:
            replaceFile(tmpname, self.fnameBase)

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, \
        generateCertChain(tmpName, mmtpKey, self.getIdentityKey(),
                          self.nickname, certStarts, certEnds)
        replaceFile(tmpName, self.certFile)
 
        self._tlsContext = (

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
            self._lock.acquire()
            try:
                replaceFile(os.path.join(self.dir, s1+"_"+handle),
                            os.path.join(self.dir, s2+"_"+handle))
            except OSError, e: